Show each sensor's longest report gap; stop recording volatile attributes
Choosing room and weather freshness limits required knowing how long each sensor normally goes without reporting, which HA does not show. Add max_age_seconds_24h to every source in input_quality: the largest report age seen at polls over the last 24 hours (hourly buckets, reset on reload, underestimates by up to one poll interval). input_quality and weather_comparison change every poll, so the Recorder stored a new attribute row every five minutes. Mark them unrecorded; they remain visible on the Status entity. Model coefficients and other attributes are still recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c0e4de832b
commit
4daba5028b
6 files changed
+64
-3
No files matched your search
@@ -27,6 +27,11 @@ async def test_setup_reload_unload(hass, entry, inputs):
|
||||
assert len(entities) == 5
|
||||
ids = {e.unique_id: e.entity_id for e in entities}
|
||||
assert coordinator.data["status"] == "learning"
|
||||
status = hass.states.get(ids[f"{entry.entry_id}_status"])
|
||||
assert status.attributes["input_quality"]["rooms"]["sensor.room"]["max_age_seconds_24h"] == 0
|
||||
# Volatile diagnostics stay visible but are not written to the Recorder.
|
||||
assert {"input_quality", "weather_comparison"} <= status.state_info["unrecorded_attributes"]
|
||||
assert "models" not in status.state_info["unrecorded_attributes"]
|
||||
proposal_id = registry.async_get_entity_id("binary_sensor", DOMAIN, f"{entry.entry_id}_proposal")
|
||||
assert hass.states.get(proposal_id).state == "unavailable"
|
||||
assert await hass.config_entries.async_reload(entry.entry_id)
|
||||
|
||||
Reference in new issue
Block a user