Skip to content

Fix Vision border-cut: build mz payload from cached zones (keep zones/topology)#393

Open
ascha191 wants to merge 1 commit into
MTrab:masterfrom
ascha191:fix/vision-border-cut-keep-zones
Open

Fix Vision border-cut: build mz payload from cached zones (keep zones/topology)#393
ascha191 wants to merge 1 commit into
MTrab:masterfrom
ascha191:fix/vision-border-cut-keep-zones

Conversation

@ascha191
Copy link
Copy Markdown

@ascha191 ascha191 commented Jun 4, 2026

Description

Border-cut on Vision (protocol 1) mowers is a per-zone setting (cfg.mz.s[*].cfg.cut), and the zone topology lives separately in cfg.mz.p. The previous mz form sent a single hard-coded zone with an empty p, which the mower interprets as "these are all the zones" → it drops the other zones and the beacon mapping (MTrab/landroid_cloud#1289). #390 worked around that by sending the top-level {"cut":...} form, but Vision models silently ignore it, so border-cut no longer applies.

This builds the command from the mower's cached cfg.mz (read-modify-write): it changes only the cut values and keeps s (all zones) and p (topology) intact. When no multizone config is cached it falls back to the top-level {"cut":...} form, so existing behaviour is unchanged.

Test strategy

  • ruff format / ruff check — clean
  • pytest tests/test_api_lifecycle.py — 65 passed
  • Existing border-cut tests stay green (their mocks have no cfg.mz → fallback path)
  • New test test_border_cut_settings_preserves_zones_via_mz: with a cached two-zone cfg.mz, asserts the published payload is {"mz":...} with both zones present, p unchanged, only cut updated, and the cache not mutated in place
  • Validated on physical hardware (WR206E Vision, 2 zones): border-cut applied, both zones and beacon topology preserved (confirmed in the Worx app). Counter-test with the old p:[] payload reproduced the zone deletion; re-sending the original mz restored both zones.

Open question

The service has no zone parameter, so this applies the same ob/bd to all zones. Is that the intended behaviour, or should it target only the active zone? Happy to adjust.

Known limitations

No change for non-multizone devices (fallback path). The local cfg.mz cache is not mirrored after sending; it is corrected by the next mower status.

Required configuration changes

None.

Semver

patch

Refs MTrab/landroid_cloud#1289, MTrab/landroid_cloud#876

Border-cut on Vision (protocol 1) mowers is a per-zone setting
(cfg.mz.s[*].cfg.cut) and the zone topology lives in cfg.mz.p. The previous mz
form sent a single hard-coded zone with an empty p, which made the mower drop
the other zones and the beacon mapping (MTrab/landroid_cloud#1289). PR MTrab#390
switched to the top-level {"cut":...} form, but Vision models ignore it, so
border-cut stopped applying.

Build the command from the mower's cached cfg.mz, changing only the cut values
and keeping s (all zones) and p (topology) intact. Fall back to the top-level
cut form when no multizone config is cached.

Verified on physical hardware (WR206E Vision, 2 zones): border-cut applied,
both zones and topology preserved.

Refs MTrab/landroid_cloud#1289, MTrab/landroid_cloud#876

Co-Authored-By: Claude Opus 4.8 <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