cantabile_edge, cantabile_modbus, cantabile_eebus 0.1.650: full source
This commit is contained in:
1 parent
85edd56ec8
commit
3edd015039
20 files changed
+2021
-35
No files matched your search
@@ -56,6 +56,7 @@ class _Track:
|
||||
override_until: float = 0.0
|
||||
override_entity: str = ""
|
||||
moved: float = -1e18 # when a cover was last moved by the agent
|
||||
changed: dict = field(default_factory=dict) # "mode" | "set" -> when the agent last changed it (steady.py)
|
||||
|
||||
|
||||
# The service each channel uses, by domain: nothing else can be called.
|
||||
@@ -151,6 +152,9 @@ class Guard:
|
||||
tr = self._t(a.control)
|
||||
tr.times.append(now)
|
||||
tr.commanded[a.entity] = (now, a.value)
|
||||
c = self.controls.get(a.control)
|
||||
boiler = c is not None and c.kind in ("heating", "cooling") and a.channel == "switch"
|
||||
tr.changed["set" if a.quantity or boiler else "mode"] = now
|
||||
if a.domain == "cover":
|
||||
tr.moved = now
|
||||
if a.quantity == "":
|
||||
@@ -187,6 +191,11 @@ class Guard:
|
||||
self.events.append({"control": control_id, "entity": entity, "value": value, "agent_set": want,
|
||||
"until": int(tr.override_until), "at": int(now)})
|
||||
|
||||
def last_change(self, control_id: str, kind: str) -> float | None:
|
||||
"""When the agent last changed a control's mode or setpoint (kind
|
||||
"mode" | "set"; a boiler's on/off is its setpoint), or None."""
|
||||
return self._t(control_id).changed.get(kind)
|
||||
|
||||
def overridden(self, control_id: str) -> bool:
|
||||
return self.clock() < self._t(control_id).override_until
|
||||
|
||||
|
||||
Reference in new issue
Block a user