Add a mode bind action that broadcasts SYS_MODE from a button #136

Merged
Claude merged 3 commits from feat/yn-18-mode-bind into feat/yaml-nodes 2026-10-16 19:50:32 +00:00
Collaborator

A switch or touch can carry a bind with action: mode and mode: (normal, night, lights_out, away, travel). A fresh press broadcasts SYS_MODE and applies the mode to the node itself, which needs a new Node::applyMode because a node's own frames never reach its mode handler. The bind has no target and no named source: it is sourced from the input it sits on. disabled_modes and enabled_by apply; a stale first report does nothing.

Runtime: BindAction::Mode, Bind::mode, a ModeStrategy chosen in Binds::add before the target is looked at, and BindStrategy::onSource now takes the Node& instead of the mode. Nothing else touches Bind::target on a Mode bind (follow lookup compares pointers, the tick and source-loss paths are no-ops). Generator, schema, README, spec 9.5 and the C3 fixture are updated; shutdown is rejected.

Tested: native and Python counts in the handover; pio run and the C3 fixture build pass.

YN-18

A `switch` or `touch` can carry a bind with `action: mode` and `mode:` (normal, night, lights_out, away, travel). A fresh press broadcasts `SYS_MODE` and applies the mode to the node itself, which needs a new `Node::applyMode` because a node's own frames never reach its mode handler. The bind has no target and no named source: it is sourced from the input it sits on. `disabled_modes` and `enabled_by` apply; a stale first report does nothing. Runtime: `BindAction::Mode`, `Bind::mode`, a `ModeStrategy` chosen in `Binds::add` before the target is looked at, and `BindStrategy::onSource` now takes the `Node&` instead of the mode. Nothing else touches `Bind::target` on a Mode bind (follow lookup compares pointers, the tick and source-loss paths are no-ops). Generator, schema, README, spec 9.5 and the C3 fixture are updated; shutdown is rejected. Tested: native and Python counts in the handover; `pio run` and the C3 fixture build pass. YN-18
Add mode binds to YAML switch and touch endpoints
Some checks failed
Build and test / build (pull_request) Has been cancelled
Build and test / release (pull_request) Has been cancelled
a92252e173
Claude left a comment

No blocking findings. Two small ones.

  • scripts/yaml_node.py: modeBindModes repeats disabledModes plus normal. Build it as {"normal": "Normal", **disabledModes}.
  • test/test_binds/test_binds.cpp: nothing covers bind.enabled returning false on a mode bind. Removing that check from ModeStrategy::onSource leaves every C++ test green. The only coverage is the generator string test.
No blocking findings. Two small ones. - scripts/yaml_node.py: `modeBindModes` repeats `disabledModes` plus `normal`. Build it as `{"normal": "Normal", **disabledModes}`. - test/test_binds/test_binds.cpp: nothing covers `bind.enabled` returning false on a mode bind. Removing that check from `ModeStrategy::onSource` leaves every C++ test green. The only coverage is the generator string test.
Cover the mode bind gate and share the mode names
All checks were successful
Build and test / build (pull_request) Successful in 5m19s
Build and test / release (pull_request) Has been skipped
564c6e5492
Claude merged commit 124cc9c9cb into feat/yaml-nodes 2026-10-16 19:50:32 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rob/CampervanControlSystems!136
No description provided.