189 files
This commit is contained in:
@@ -247,6 +247,13 @@ class MaintenanceSensor(MaintenanceEntity, SensorEntity):
|
||||
"priority": task.get("priority") or DEFAULT_TASK_PRIORITY,
|
||||
}
|
||||
|
||||
# Recorded readings (#83 / #161 phase 2): the newest completion's
|
||||
# value(s) — stable between completions, so templates can read a
|
||||
# meter without parsing history. Only present once a value exists.
|
||||
from .helpers.reading_slots import last_reading_attributes
|
||||
|
||||
attrs.update(last_reading_attributes(task.get("history")))
|
||||
|
||||
# Task phases (#139): which cycle step is due — stable (changes once
|
||||
# per completion), so it belongs on the entity for automations
|
||||
# ("announce 'replace blades' only when THAT phase comes up").
|
||||
@@ -851,7 +858,10 @@ class BatteryFleetLowSensor(SensorEntity):
|
||||
sticky.pop(eid, None) # gone from the fleet
|
||||
continue
|
||||
level = current.get("level")
|
||||
if level is not None and float(level) >= sticky[eid] + self._HYSTERESIS_PERCENT:
|
||||
# A sensorless note (D#162) has no level to hover — it leaves
|
||||
# `low` only when its forecast re-anchors (or the option is
|
||||
# switched off), and that is the real all-clear.
|
||||
if current.get("no_sensor") or (level is not None and float(level) >= sticky[eid] + self._HYSTERESIS_PERCENT):
|
||||
sticky.pop(eid, None)
|
||||
return len(low_ids | set(sticky))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user