Stop stale-telemetry handling from overriding an active battery floor lock
This commit is contained in:
1 parent
f05ebceefc
commit
3007c1caa1
1 file changed
+29
@@ -543,6 +543,13 @@ class Engine:
|
||||
self.stale_action_state = None
|
||||
self.pre_stale_state = None
|
||||
|
||||
if self.floor_latched:
|
||||
self.report(
|
||||
"battery floor is still active, not restoring pre-outage state",
|
||||
force=True,
|
||||
)
|
||||
return
|
||||
|
||||
if previous is None or previous == applied:
|
||||
return
|
||||
|
||||
@@ -886,6 +893,17 @@ class Engine:
|
||||
if self.profile.on_stale == "stop":
|
||||
raise RuntimeError("stopping: MQTT session disconnected")
|
||||
if self.profile.on_stale == "safe_state":
|
||||
if self.floor_latched:
|
||||
floor_state = self.profile.battery_floor.desired_state()
|
||||
await self.apply(
|
||||
session,
|
||||
floor_state,
|
||||
"battery floor holding through a lost connection",
|
||||
now,
|
||||
force=True,
|
||||
cause="floor",
|
||||
)
|
||||
else:
|
||||
if self.stale_action_state is None:
|
||||
self.pre_stale_state = self.last_commanded
|
||||
self.stale_action_state = self.profile.safe_state
|
||||
@@ -956,6 +974,17 @@ class Engine:
|
||||
if self.profile.on_stale == "stop":
|
||||
raise RuntimeError("stopping: telemetry went stale")
|
||||
if self.profile.on_stale == "safe_state":
|
||||
if self.floor_latched:
|
||||
floor_state = self.profile.battery_floor.desired_state()
|
||||
await self.apply(
|
||||
session,
|
||||
floor_state,
|
||||
"battery floor holding through stale telemetry",
|
||||
now,
|
||||
force=True,
|
||||
cause="floor",
|
||||
)
|
||||
else:
|
||||
if self.stale_action_state is None:
|
||||
self.pre_stale_state = self.last_commanded
|
||||
self.stale_action_state = self.profile.safe_state
|
||||
|
||||
Reference in new issue
Block a user