Add virtual outputs and output state as a bind source #144
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/yn-27-virtual-endpoints"
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?
virtual: trueon alight,fan,load,dimmable_lightorvariable_fangives an endpoint with no hardware that holds its state, reports, takes commands and can be bound to. A bind may now follow or toggle from any such output, so one touch can drive a virtual "Main lights" and the real lights follow it.Runtime (shared paths, for review):
SwitchEndpointtakesctrl::noPinand skips the GPIO calls; hand-written nodes are unchanged.LevelEndpointskips LEDC set-up and writes when it has no pins, so a virtual dimmer cannot reconfigure a real channel.StateSwitchandStateLevel,onfrom the state, nofreshPress. The generator mapstogglefrom an output toToggleOnChange.class_filter.hnow folds as many low class bits as it takes until every wanted class fits, so Event plus State plus the required classes always fit in four MCP2515 slots. A remote output source addsStateto the interests.Generator:
virtualfield (rejectspin,pins,invert,frequency), virtual PWM endpoints use no PWM channel, output types are accepted as bind sources, a bind cannot take its own endpoint as source. Schema, README (field rows and a Virtual endpoints section), spec 9.5 and 12, and the LOLIN32 fixture (virtual light toggled by the touch pad, the ceiling dimmer following it) are updated.dimming_curveis not rejected on virtual endpoints yet because it does not exist on this base.Tested: native 647 -> 652, Python 140 -> 146;
pio runand the LOLIN32 fixture build pass.YN-27
Two findings.
scripts/yaml_node.py
resolve_bind: only a self-source is rejected. Two outputs on one node that toggle from each other (AtoggleB, BtoggleA) become twoToggleOnChangebinds. Each state report flips the other, andmarkDirtyre-reports, so they oscillate for ever and flood the bus. Reject a cycle of toggle binds at generation time (a follow-only cycle settles, so it can stay). Add a test.test/test_class_filter:
test_event_and_state_together_fit_with_every_required_classpasses on the old one-bit fold, so it can't fail if the new loop is reverted. Event+State needs {0,1,7,4,3}; folding one bit gives {0,6,4,2}, which fits. Drop it. The Command/Event/Diag/Bulk test is the one that pins the change.Runtime checks (noPin, empty-PinList LevelEndpoint, fold termination and masks, decoder cross-trigger, first-report sync) found no defects. Schema tests are skipped on my machine (28 skipped), so the if/then/else was not run.
8a85eb772b408f867fb0408f867fb0e67585deb3