Stop double-converting filterUsage on AIR_FILTER/HEPA_FILTER (#330)

filterUsage is already a 0-100 percentage on every confirmed family,
including ARTIK051_PRAC: filterStatus flips to 'wash' at
filterUsage == '100' regardless of filterCapacity (60/224/500 across
other fixtures), which only holds if filterUsage is already a percent.
filter_usage_percent() divided by filterCapacity again, reading a
filter due for washing as 20% fresh.

air_filter_usage_hours had the mirror problem: it read filterUsage
directly as an hour count with device_class=duration, when the field
is a percent. It's now derived from the percentage and filterCapacity
(new filter_usage_hours() in common.py) instead.
This commit is contained in:
Marc Billow committed 2026-08-09 00:37:09 +00:00
1 parent efea9e9888
commit 07c20e82aa
4 files changed
+54 -27

No files matched your search

+1 -1
View File
@@ -59,5 +59,5 @@ def test_air_quality_and_filter_sensors_present():
assert state["dust"] == 10
assert state["fine_dust"] == 9
assert state["odor"] == 1
assert state["hepa_filter_usage"] == 0
assert state["hepa_filter_usage"] == 30
assert state["hepa_filter_status"] == "normal"