fix: keep active vacuum status from working_status telemetry - #63
Conversation
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
d5b9730 to
3e551d4
Compare
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
…ate (#73) Refines the #63 fix. update_from_working_status treated the mere presence of field 3 as proof of an active clean, so a working_status frame reporting timeConsuming=0 would set working_status=CLEANING, clear the dock indicators and show a parked robot as running for the 15s freshness window — the mirror image of the bug #63 set out to fix. Activity now requires a positive value: timeConsuming > 0 or coveredArea > 0. Station-only frames and zeroed session counters no longer override base_status. Also flags WorkingStatus.CLEANING_V2 (3) as UNCONFIRMED: it arrived with #63 on "observed on newer Flow 2 firmware" with no capture, and PROTOCOL.md has no entry for 3. Kept as active because #73's failure mode is showing docked during a clean, but the uncertainty is now recorded at the definition.
|
Merged as 1. Conflicts resolved here rather than sent back#50, #62, #61 and #24 all landed ahead of this today, so 2. Activity now requires a positive counter (
|
) Root cause of the frozen vacuum state, found on hardware during a live room clean rather than inferred. The robot only broadcasts status/working_status and display_map while an active_robot_publish subscription is live, and that subscription lasts 600 s. It was sent once at setup and never renewed. Once it expired the robot went quiet on both topics while continuing to flood status/robot_base_status, so the vacuum entity kept deriving its state from base_status alone, sat at "docked" while the robot was audibly cleaning, and the live map stopped moving. cleaning_area and cleaning_time never populated at all. Measured on a Flow (AX12, v01.08.03.07) mid-clean. Subscription expired: 423 base_status / 1 working_status / 1 display_map. Immediately after re-subscribing: 211 / 30 / 30, and the entity went to cleaning, room=Pantry, area=2.58 m2, elapsed=312 s within seconds. It was also a deadlock. The only renewal path was _resub_topics, reached from the display_map dropout recovery, which is gated on is_cleaning — and is_cleaning cannot become true without working_status. So the one thing that could have recovered the subscription required the subscription. The poll loop now renews unconditionally after TOPIC_RESUBSCRIBE_AFTER (240 s, well inside the 600 s TTL), independent of believed cleaning state. This supersedes the mechanism assumed by #63: that fix reads fresh working_status telemetry to override a stale docked base_status, but on this firmware there was no working_status telemetry to read. Both changes are complementary — this one keeps the telemetry flowing, #63 interprets it.
What
Rebuilds the old Flow 2 status work as a focused fix for #73. Fresh
status/working_statustask metrics now keep the vacuum entity in an active state briefly, while unconfirmed stalerobot_base_statusdock/idle overlays only refresh battery/consumables instead of clobbering activity. Confirmed dock indicators still end the active state.Also maps
working_status=3as an active cleaning state observed on newer Flow 2 firmware.Why
#73 reports the vacuum entity freezing on its last base-status state, usually
docked, while the robot is actually cleaning and other sensors continue updating. The activity path was effectively trustingrobot_base_statusover the live task metrics topic.Validation
No live robot validation yet. Non-hardware checks only:
python -m compileall -q custom_components/narwal narwal_client testsgit diff --checkpytestis not installed in this checkout, so the focused unit files were added but not run here.