HA entity, sensor and device classes (iteration 2, step 3)
HaEntity describes an entity for device-based discovery, throttles its state (SEN-14) and reports availability (SEN-15); HaSensor is the `sensor` type. HaDevice publishes discovery, availability and states after each connect and after HA's birth message, provides the last will and removes itself from HA. Unit tests with a fake MQTT client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -399,8 +399,8 @@ delete).
|
||||
|
||||
| Test | Content |
|
||||
|---|---|
|
||||
| `tst_haentity` | discovery component, topics, throttling (several values within an interval → one publish with the last value), unavailable without a value |
|
||||
| `tst_hadevice` (fake client) | discovery payload, `online` and states after connect, republish after reconnect and birth, will configuration, `removeFromHa()` |
|
||||
| `tst_haentity` | discovery component (optional keys only when set), topics, throttling (several values within an interval → one state with the newest value; unchanged or reverted values not emitted), first value → state then available, cleared → unavailable |
|
||||
| `tst_hadevice` (`tests/FakeMqttClient.h`) | topics, discovery prefix, last will, discovery payload, what is published after a connect and in which order, entity without value unavailable, changes while connected, nothing buffered and current state after reconnect, birth message (delayed; cancelled by a disconnect; other messages ignored), `removeFromHa()` |
|
||||
| `tst_mqtt` (integration; real `mosquitto` on a free port, QSKIP without it) | connect and messages; retained message for a later subscriber; nothing published while disconnected; first connect retried until the broker runs; reconnect after a broker restart; unresolvable host; last will after `kill -9` of a helper process (the test binary itself, `--will-helper`); `disconnectFromBroker()` publishes the will; login right and wrong; TLS with a test CA (step 5) |
|
||||
| `tst_surfaces` | `--desktop-novr`; app command: hook called, no surface created, exit code returned |
|
||||
| Manual | from the PC against the user's HA: device appears, online/offline, broker restart, two devices, `--ha-remove`, UI-1 in `--desktop`. On the Frame: the package with libmosquitto runs |
|
||||
|
||||
+7
-2
@@ -23,8 +23,9 @@ CLAUDE.md ("Working rules").
|
||||
The error itself is covered off the device by `tst_config`. Checks 3 and 4 run in the next
|
||||
session on the Frame (iteration 2 testing needs it too).
|
||||
- **Implementation** follows the order in DESIGN.md (steps 1–7). Steps 1 (libmosquitto in
|
||||
CMake and the containers) and 2 (`MqttClient`, `MosquittoClient`, `tst_mqtt`) done; next:
|
||||
step 3 (`HaEntity`, `HaSensor`, `HaDevice`, unit tests).
|
||||
CMake and the containers), 2 (`MqttClient`, `MosquittoClient`, `tst_mqtt`) and 3
|
||||
(`HaEntity`, `HaSensor`, `HaDevice`, unit tests) done; next: step 4 (app wiring,
|
||||
`--desktop-novr`, UI-1).
|
||||
|
||||
## Next steps
|
||||
|
||||
@@ -144,6 +145,10 @@ Known limitation: the bundled-Qt package does not support WebEngine in this iter
|
||||
host 3 × 12/12; `container-test.sh` 9/9 (Debian's libmosquitto 2.0.21), no Vulkan
|
||||
validation messages; cross build: private Qt symbols only `QVulkan*`, at most
|
||||
`GLIBC_2.34`; the app binary links libmosquitto only from step 4 on (first use).
|
||||
- Step 3: `HaEntity` (description, discovery component, throttling, availability),
|
||||
`HaSensor`, `HaDevice` (discovery payload, publish all after connect and after HA's birth
|
||||
message with random delay, last will, `removeFromHa()`), `FakeMqttClient` for tests.
|
||||
`tst_haentity` 11/11, `tst_hadevice` 14/14 on the host.
|
||||
|
||||
### 2026-10-05: requirements approved
|
||||
|
||||
|
||||
Reference in New Issue
Block a user