Add a mode bind action that broadcasts SYS_MODE from a button #136
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/yn-18-mode-bind"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A
switchortouchcan carry a bind withaction: modeandmode:(normal, night, lights_out, away, travel). A fresh press broadcastsSYS_MODEand applies the mode to the node itself, which needs a newNode::applyModebecause 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_modesandenabled_byapply; a stale first report does nothing.Runtime:
BindAction::Mode,Bind::mode, aModeStrategychosen inBinds::addbefore the target is looked at, andBindStrategy::onSourcenow takes theNode&instead of the mode. Nothing else touchesBind::targeton 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 runand the C3 fixture build pass.YN-18
No blocking findings. Two small ones.
modeBindModesrepeatsdisabledModesplusnormal. Build it as{"normal": "Normal", **disabledModes}.bind.enabledreturning false on a mode bind. Removing that check fromModeStrategy::onSourceleaves every C++ test green. The only coverage is the generator string test.