Skip to content

fix: auto-select v2 clean payload by firmware version (#37)#38

Draft
sjmotew wants to merge 1 commit into
masterfrom
fix/37-firmware-version-v2-autodetect
Draft

fix: auto-select v2 clean payload by firmware version (#37)#38
sjmotew wants to merge 1 commit into
masterfrom
fix/37-firmware-version-v2-autodetect

Conversation

@sjmotew

@sjmotew sjmotew commented May 17, 2026

Copy link
Copy Markdown
Owner

Staged — do not merge until #37 outcome 3 is confirmed

This branch is parked here ready to ship the moment we confirm @saeft2003's case is the "legacy returns SUCCESS but robot ignores room list" failure mode rather than the cleaner NOT_APPLICABLE one.

Summary

Adds firmware-version-based clean-payload schema selection so newer Flow firmware (>= v01.07.22.00) skips the legacy schema entirely instead of relying on a NOT_APPLICABLE response that may never come.

Behavior matrix

Firmware start() start_rooms()
< v01.07.22 (older) legacy → on NOT_APPLICABLE retry v2 legacy → on NOT_APPLICABLE retry v2
>= v01.07.22 (known v2) v2 directly v2 directly
unknown / empty legacy → on NOT_APPLICABLE retry v2 legacy → on NOT_APPLICABLE retry v2
any + `force_v2=True` n/a v2 directly

When to merge

#37 retest outcome Merge this PR?
Legacy SUCCESS + correct rooms clean ❌ Close — fix not needed
NOT_APPLICABLE → v2 fallback + correct rooms ❌ Close — current master is enough
Legacy SUCCESS but wrong rooms clean (ack-and-ignore) ✅ Merge — this is what fixes it

Files touched

  • `narwal_client/client.py` + embedded copy — version parser, requires-v2 check, version-based shortcut in start() and start_rooms()
  • `tests/test_client.py` — 10 new tests (170 passing total)

Notes

…rsion (#37)

Adds _parse_firmware_version + _firmware_requires_v2 helpers. Flow
firmware at or above v01.07.22.00 — the lowest confirmed-affected
version from #36 (ralong777) and #37 (saeft2003, v01.08.00.07) — now
skips the legacy clean payload entirely and sends v2 directly. Older
firmware keeps the legacy-first behavior with NOT_APPLICABLE fallback.

Catches the ack-and-ignore case from #37 where the legacy schema
returns SUCCESS but the robot quietly runs its onboard plan (first
Narwal-app shortcut) instead of the rooms HA requested.

Unknown firmware versions default to legacy-first so we don't ship
v2 prematurely to a robot that may not accept it.

Extracts the v2 retry path in start() into _start_v2() with a reason
tag so logs distinguish "firmware-known-v2" from
"legacy-NOT_APPLICABLE".

10 new tests cover the version parser (edge cases: empty, malformed,
short forms), the requires-v2 check against #36/#37 firmwares, and
the start()/start_rooms() version-based shortcut.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant