Stop collapsing a genuine fivepercentHumidity=0 reading to unknown (#160)

#146's zero-as-"not measuring" carve-out was meant for ARTIK051 boards'
plain x.com.samsung.da.humidity field, which only populates while Air
monitoring is briefly on and zeroes out afterward. It was accidentally
applied to fivepercentHumidity too, which every other AC board relies on
and which has never been documented getting stuck at zero -- so a real 0%
reading on those boards silently became "unknown". Only the humidity
fallback field now collapses 0; fivepercentHumidity passes 0 through as a
real reading.
This commit is contained in:
Marc Billow committed 2026-07-28 13:28:46 +00:00
1 parent 1cdad7f84c
commit c8597532b0
2 files changed
+24 -7

No files matched your search

@@ -210,14 +210,20 @@ def _humidity(rep):
(51% observed, matching what the same unit's cloud integration reported at
that moment), then zeroes the field and switches Air monitoring back off by
itself. So 0 reads as "not measuring" and is reported as unknown rather than
as 0% humidity, which would poison long-term history -- which is also why
the boards that do have fivepercentHumidity read a permanent 0 here.
as 0% humidity, which would poison long-term history.
That zero-as-"not measuring" carve-out is specific to the ARTIK051
fallback field's hardware quirk -- every other board's fivepercentHumidity
has never been documented getting stuck at zero, and collapsing a
genuine 0% reading there to unknown is a regression, not a safeguard
(issue #160). So fivepercentHumidity passes 0 through unchanged; only the
humidity fallback applies the zero-collapse.
"""
for field in ('x.com.samsung.da.fivepercentHumidity',
'x.com.samsung.da.humidity'):
if field in rep:
value = _num(rep[field])
return value if value else None
if 'x.com.samsung.da.fivepercentHumidity' in rep:
return _num(rep['x.com.samsung.da.fivepercentHumidity'])
if 'x.com.samsung.da.humidity' in rep:
value = _num(rep['x.com.samsung.da.humidity'])
return value if value else None
return None