feat: add current_room sensor from working_status field 6 - #24
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>
|
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. |
…-room sensor (sjmotew#24) - Cleaning area read working_status field 13 (totalDryStationBagTime, a station timer stuck at 18000) and divided by 10000 -> permanently 1.8 m2. Read field 2 (coveredArea, float32 m2) instead; correct the WorkingStatusField names. - Add a current-room sensor from working_status field 6 (cleaningZoneId), resolved to a room name via the cached map. - Pass config_entry to DataUpdateCoordinator so entities resolve device info.
|
@clawtom — this is still the version of Ask: please rebase after #52 lands (step 4 in #66 — the base_status field audit, which corrects several mislabeled fields in Separately, two things you found earlier deserve an update:
|
|
@clawtom — merging #48 and #51 has put this into conflict; This is the rebase point I mentioned in #66, so the target is real now rather than hypothetical. Your I've also approved CI on the fork PRs, so you'll get actual check results this time. Separately, if you get a chance: the room-clean fix (#49) is close, and you're the original reporter on #25. A retest on your Flow 2 once it lands would be valuable. |
|
@clawtom — one more rebase needed, and then I'm done asking. Sorry. Today's merges moved The good news is the churn is over. The room-type table was the thing causing repeated conflicts in this area, and it's now settled with decompiled evidence rather than inference — see #48 and #22. It isn't going to move again. Likewise the One thing worth checking while you're in there: #52 added station and consumable diagnostic entities and touched how To restate what I said on 07-27, since it's been a while: this is still the version of Once rebased I'll take it straight in — it's not gated on #49 or anything else in the queue. |
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