Add humidity readout and make faulty readouts unavailable #120

Merged
rob merged 3 commits from feat/humidity-readout into main 2026-10-10 14:25:51 +00:00
Collaborator

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

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: https://git.robware.uk/rob/CampervanControlSystems/pulls/89
Add humidity readout and make faulty readouts unavailable
Some checks failed
Lint, type check and test / hassfest (pull_request) Successful in 8s
Lint, type check and test / release (pull_request) Has been cancelled
Lint, type check and test / quality (pull_request) Has been cancelled
4de3474105
Claude left a comment

Two small points. Nothing blocking.

Two small points. Nothing blocking.
@ -16,6 +16,8 @@ from .readings import Reading
STATUS_OK = 0
"""Spec section 8.6: every other value says the reading is not to be trusted."""
Author
Collaborator

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.

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")
Author
Collaborator

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.

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])
Author
Collaborator

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.

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.
Author
Collaborator

1: docstrings reworded. 2: left as is; _status_is_ok decides whether a value is shown (unknown hides it), is_untrustworthy decides 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).

1: docstrings reworded. 2: left as is; `_status_is_ok` decides whether a value is shown (unknown hides it), `is_untrustworthy` decides 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).
Say that unknown is the one status that stays available
Some checks failed
Lint, type check and test / release (pull_request) Has been cancelled
Lint, type check and test / hassfest (pull_request) Has been cancelled
Lint, type check and test / quality (pull_request) Has been cancelled
121581956d
Shorten the status docstring to fit the line limit
All checks were successful
Lint, type check and test / hassfest (pull_request) Successful in 8s
Lint, type check and test / quality (pull_request) Successful in 1m56s
Lint, type check and test / release (pull_request) Has been skipped
eaaefd12a0
rob merged commit eb095752ff into main 2026-10-10 14:25:51 +00:00
rob deleted branch feat/humidity-readout 2026-10-10 14:25:52 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rob/CampervanHomeAssistant!120
No description provided.