cantabile_edge, cantabile_modbus, cantabile_eebus 0.1.676: full source
This commit is contained in:
1 parent
3edd015039
commit
d48b9aff87
32 files changed
+4633
-133
No files matched your search
@@ -31,8 +31,11 @@ keeps the value in force, its why says so) unless all hold:
|
||||
Not here, so never held back: the console's and the building's commands,
|
||||
the safe defaults, the grid operator's order (the plan is made again at
|
||||
once within its bounds; a kept value outside the bounds in force is never
|
||||
kept), the owner's own changes (the guard's hands off) and the guard's
|
||||
floors. The entry the plan made is kept in the entry as "planned".
|
||||
kept), the owner's own changes (the guard's hands off; and the owner's
|
||||
preferences, preferences.py: the first plan after a change of a control's
|
||||
preferences or overrides, `free`, is taken as it is for that control) and
|
||||
the guard's floors. The entry the plan made is kept in the entry as
|
||||
"planned".
|
||||
"""
|
||||
import math
|
||||
|
||||
@@ -117,10 +120,13 @@ def _within(bounds, v) -> bool:
|
||||
return (lo is None or v >= lo - 1e-9) and (hi is None or v <= hi + 1e-9)
|
||||
|
||||
|
||||
def stabilise(plan: dict, state: dict, controls, col, last_set=None, now: float | None = None) -> dict:
|
||||
def stabilise(plan: dict, state: dict, controls, col, last_set=None, now: float | None = None,
|
||||
free: set | None = None) -> dict:
|
||||
"""The plan with changes that do not matter kept out (module
|
||||
docstring). last_set(control id, kind "mode"|"set") -> when the agent
|
||||
last changed that (None: not known). In place; returns the plan."""
|
||||
last changed that (None: not known). free: control ids (or "*": all)
|
||||
whose preferences the owner just changed: their entries as planned.
|
||||
In place; returns the plan."""
|
||||
now = plan.get("made", 0) if now is None else now
|
||||
step = plan.get("step_s", 900)
|
||||
end = plan.get("start", now) + step * state.get("steps", 192)
|
||||
@@ -133,6 +139,8 @@ def stabilise(plan: dict, state: dict, controls, col, last_set=None, now: float
|
||||
entries = (plan.get("devices") or {}).get(c.id)
|
||||
if not entries or c.kind not in ("battery", "heating", "cooling", "ev"):
|
||||
continue
|
||||
if free and (c.id in free or "*" in free):
|
||||
continue # the owner's change: not held back
|
||||
cur = current(c, col)
|
||||
if cur is None:
|
||||
continue
|
||||
|
||||
Reference in new issue
Block a user