feat: add current_room sensor from working_status field 6#24
Open
clawtom wants to merge 1 commit into
Open
Conversation
Adds a 'Current room' text sensor that shows which room the Narwal vacuum is actively cleaning, updated in real-time as the robot moves between rooms. **Protocol source (confirmed 2026-04-24 from live Flow 2 capture):** working_status field 6 carries the current target room_id as a varint. The value changed from 4 (Corridor) to 1 (Living Room) mid-cleaning, matching the Narwal app display exactly. **Changes:** - `NarwalState.current_room_id` — populated from working_status field 6 during active cleaning; None when idle or field absent - `NarwalState.current_room_name` — resolves room_id to a display name via the cached room map from get_map; None if map not loaded yet - New `current_room` sensor entity (string, mdi:map-marker) - Translation strings for both strings.json and en.json - 12 new tests covering field parsing, name lookup, live capture replay, and edge cases (zero room_id, absent field, unknown room_id) Closes sjmotew#21 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
|
Reviewed. Clean scoped change — 12 new tests, +207/0, reuses the existing One thing before I merge: Related: blocked-then-unblocks for PR #35 (which also touches Flow 2 state decoding) — let's merge this first since it's narrow. |
This was referenced May 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the current room the Narwal is actively cleaning as a new
Current roomtext sensor in Home Assistant. The room name updates in real-time as the robot moves between rooms.Source:
working_statusfield 6 (room_id) — confirmed via live capture on Flow 2 (firmware v01.07.16.01). Field 6 changes value as the robot transitions between rooms; cross-referenced against the room list fromget_mapto resolve the display name.Changes
narwal_client/models.py— addcurrent_room_id: int | NonetoNarwalState; parse field 6 inupdate_from_working_status(); addcurrent_room_nameproperty that resolves the ID via the cached room mapsensor.py— addNarwalCurrentRoomSensorentity descriptionstrings.json/translations/en.json— addcurrent_roomsensor stringstests/test_models.py— 133 lines of new tests covering field 6 parsing, name resolution, edge cases (unknown room, no map, duplicate room type names)Behavior
unavailablewhen the robot is docked, idle, or before the map has loadeddisplay_namelogic as the existing room segment selector — user-assigned names take priority over type-derived names; duplicate type names get numbered suffixes ("Bathroom 1", "Bathroom 2", "Bathroom 3")Testing
152 tests pass (
pytest tests/). 12 new tests specifically for the current room feature.Closes #21