Move bind actions into a per-target-type strategy #129
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/yn-11-bind-strategy"
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?
Binds now picks a stateless BindStrategy from the target's endpoint type in add(). One strategy exists, on/off, for Switch, Dimmer, Fan and ColourLight; it owns source handling, mode suppression and source loss. Binds keeps source matching, heard stamping, frame decoding and the loop. add() returns false for a target type with no strategy; Node::addBind ignores that for now.
No behaviour change: test/test_binds is untouched apart from one added test for the rejection. pio test -e native: 605 -> 606 pass; pio run passes.
YN-11
Moved logic matches the base branch line for line. Two things to act on.
Node::addBindignores the newboolfromBinds::add. A bind to an unsupported target type (Valve, Motor, Heater and so on) now vanishes silently. Before, it was accepted and ran the on/off logic. Return the result fromaddBindtoo, or make the rejection loud.Binds::adddereferencesbind->targetbefore thecount_ == maxBindscheck. A null target now crashes at add time. Minor.anyFollowSourceOnwent public so the strategy can call it. Fine, but it widens the API.