Thanks for helping out. This is a Home Assistant custom component for Hive. It is installed through HACS and builds on the Hive integration in Home Assistant core.
You need uv and jq.
script/setup # .venv with Python 3.14, Home Assistant and the test tools, same as CI| Command | What it does |
|---|---|
script/test |
Run the tests. Extra arguments go to pytest: script/test tests/test_climate.py -x |
script/lint |
Fix lint and formatting, and regenerate translations/en.json |
script/lint --check |
The checks CI runs, without changing anything |
script/develop |
Run Home Assistant at http://localhost:8123 with this component loaded |
script/develop keeps its Home Assistant instance in config/. The first time,
go through onboarding, then add the Hive integration with a real Hive account.
Restart it after changing code.
sensor.pyandconfig_flow.pyare this repo's own code.__init__.pyis too.binary_sensor.py,climate.py,light.py,switch.py,water_heater.pyandentity.pyare one-line re-exports of Home Assistant core's hive platforms. To change their behaviour, either replace the re-export with a real module here, or change it in core.- Talking to Hive is done by
pyhive-integration(imported asapyhiveapi). Its version is pinned inmanifest.json. - Text shown in the UI lives in
strings.json. Runscript/lintafter editing it;translations/en.jsonis generated from it and a test checks they match.
The tests start a real Home Assistant in memory and mock the Hive API, so they
need no network or account. There is one file per platform. The fixtures in
tests/conftest.py do most of the work:
make_device(...)builds a device the way pyhive returns it.- Parametrize
sensor_devicesorplatform_devicesto choose what Hive reports. setup_integrationloads the integration with those devices.
@pytest.mark.parametrize(
"platform_devices",
[{"switch": [make_device("activeplug", True, ha_type="switch", ha_name="Fan")]}],
)
@pytest.mark.usefixtures("setup_integration")
async def test_plug(hass: HomeAssistant) -> None:
assert hass.states.get("switch.fan").state == "on"Add or update a test with every behaviour change.
- Branch from
masterand open the PR againstmaster. - CI must pass: HACS validation, hassfest, lint and tests.
- @KJonline is asked to review automatically.
- Don't bump
versioninmanifest.jsonunless the PR is meant to be released (see MAINTAINING.md).