Add humidity readout and make faulty readouts unavailable #120
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/humidity-readout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds semantic class humidity (0x2D) as a humidity sensor in %, reusing the 0.1 % level scaling. Entities are built from META, not endpoint type, so
EP_HUMIDITY(0x16) needs no code. A readout whose status says fault now makes the entity unavailable instead of a live sensor with no value.Status decision: Unknown (1) stays available with state unknown. Any other non-ok status (fault, over range, under range, stale) makes the entity unavailable. Messages with no status field are unaffected.
The frame bench transcription gains
SC_HUMIDITY. No codec changed, so the shared vectors do not move.Ticket: CCS-HA-55. Firmware PR: rob/CampervanControlSystems#89
Two small points. Nothing blocking.
@ -16,6 +16,8 @@ from .readings import ReadingSTATUS_OK = 0"""Spec section 8.6: every other value says the reading is not to be trusted."""The STATUS_OK docstring says every other value is untrusted, but STATUS_UNKNOWN (1) is now a second exception. The module docstring has the same gap. Reword both.
@ -53,1 +55,4 @@def is_untrustworthy(reading: Reading | None) -> bool:"""Fault, over, under or stale (spec 8.6): the entity has no answer to give."""status = None if reading is None else reading.get("status")is_untrustworthy repeats the status logic in _status_is_ok just below, but it also accepts 1. Two near-identical status checks will drift. Have _status_is_ok call is_untrustworthy, or share one helper.
@ -619,3 +620,2 @@async def test_a_status_byte_that_is_not_ok_withholds_the_value_beside_it(hass: HomeAssistant, van: MockConfigEntry, buses: list[FakeBus]@pytest.mark.parametrize("status", [2, 3, 4, 5])No test that a message without a status field stays available. The brief asks for this. Add one case, e.g. a STATE_LEVEL or STATE_SWITCH reading that stays available.
1: docstrings reworded. 2: left as is;
_status_is_okdecides whether a value is shown (unknown hides it),is_untrustworthydecides availability (unknown stays available), so they differ on purpose. 3: messages without a status already stay available in the existing platform tests (state and heater readings assert real values).