You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Temperature/humidity sensors for H5109 and friends (#62)
Adds sensor entities backed by the devices.capabilities.property
sensorTemperature and sensorHumidity instances. Routing is capability-
based, so H5109 (the issue reporter's device), H5179, and any other
SKU in the same family pick up the entities without per-SKU logic.
Both common API state shapes are parsed: a plain number under
state.value, or the legacy {currentTemperature/currentHumidity} STRUCT
under state.value.
Leak-sensor support for H5054 is deferred — see the research doc;
follow-up needs diagnostics from the reporter to identify the actual
event capability instance.
**Reporter**: steamer70 — wants H5054 (water detector) and H5109 (smart temperature sensor) support.
7
+
8
+
---
9
+
10
+
## Summary
11
+
12
+
Two devices, two different capability shapes. Implemented the well-documented half (temperature/humidity via the standard `devices.capabilities.property` capability — covers H5109, H5179, and any future SKU that exposes the same instances). Deferred the leak-detector half (H5054) pending diagnostics from the reporter — without ground truth on what the cloud API returns, the right binary-sensor instance name is a guess, and PR #56 is already negotiating the related but distinct hub-LoRa H5058 path.
13
+
14
+
## H5109 — implemented
15
+
16
+
Per `docs/govee-protocol-reference.md` §8.5 the canonical thermometer SKU is H5179, which exposes:
- Adds `DEVICE_TYPE_THERMOMETER` and `is_thermometer` for completeness, but routing is **capability-based, not SKU-based** — anything that exposes those property instances picks up the entities, regardless of `device_type`.
29
+
- Adds `supports_temperature_sensor` / `supports_humidity_sensor` on `GoveeDevice`.
30
+
- Adds `sensor_temperature` / `sensor_humidity` fields on `GoveeDeviceState` and parses them in `update_from_api`. The parser handles both shapes seen in the wild — `state.value` as a plain number, and the legacy `state.value.currentTemperature` / `state.value.currentHumidity` STRUCT.
31
+
- Adds `GoveeTemperatureSensor` / `GoveeHumiditySensor` entities in `sensor.py`, each gated on the matching `supports_*` predicate so they don't appear on light devices that happen to share the platform.
32
+
- Translation strings updated in `strings.json` and `translations/en.json`.
33
+
- Tests in `tests/test_thermometer.py` exercise both the H5109 and H5179 device shapes plus both API state-payload variants.
34
+
35
+
Because the gating is capability-based, this also covers any other Govee SKU that exposes the same instances — H5074, H5075, H5101, H5102, etc. — for free.
36
+
37
+
## H5054 — deferred
38
+
39
+
The H5054 is a stand-alone water sensor with a different lineage from H5058. PR #56 hardcodes `LEAK_SENSOR_SKUS = {"H5058", "H5054", "H5055"}` but routes everything through the H5043 hub's LoRa multiSync MQTT path — that's correct for H5058 but speculative for H5054, which (per Govee's product pages) does not advertise as a hub-paired sensor.
40
+
41
+
Without a diagnostics dump from the reporter we don't know:
42
+
- The actual `device_type` returned by `/device/list/v1`.
43
+
- Whether the leak signal is exposed as `devices.capabilities.event` (and under which instance name — `leakEvent`? `waterDetectionEvent`? something else) or as a `property`.
44
+
- Whether battery is exposed at all.
45
+
46
+
Action: comment on the issue asking for diagnostics, then add a generic event-driven leak binary sensor once we have a real payload. The temperature/humidity work shipping today is decoupled and doesn't block this follow-up.
47
+
48
+
## Tests
49
+
50
+
-`tests/test_thermometer.py` (8 tests) — capability detection, state parsing both shapes, missing-value safety, light device must not pick up sensors.
51
+
52
+
Full suite: 697 → 705 passing. Mypy clean. Flake8 clean.
0 commit comments