Generate node firmware from YAML #120
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/yaml-nodes"
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 node can now be described in
nodes/*.yamland built withNODE=nodes/x.yaml pio run -e gen_xiao_c3|gen_xiao_s3|gen_lolin32. The generator lives innode_gen/. Outputs react to other endpoints, local or on another node, throughbinds(toggle/follow) in the runtime, with a strategy per target endpoint type; a bind's source may be an input or an output's state, and ameasurebind feeds a heater its cabin temperature from a local or remote sensor. Inputs push throughcommands:toggle,on,offorfollowsendsCMD_SWITCHto an output on another node, andmodebroadcastsSYS_MODE; afixed: truenode file describes a hand-written node so it resolves by label.virtual: truemakes an output with no hardware, so a button can toggle a group through it. Outputs, binds and commands declare the modes that disable them withdisabled_modes. Settings are onetype: settingwithsetting_type(toggle,duration,percentage,temperature), remembered across restarts, and can gate an input (enabled_by), tune an occupancyhold, a follow bind'son_delayandrun_time, a dimmer'snight_brightness, or a blowerthresholdand water heatingdelta; each of those also takes a plain literal. Dimmers take adimming_curve.indexis optional and auto-increments. The Autoterm Flow 5D is aflow5dblock at index 0 to 25 withdiagnosticsoff by default, andheater_blowerandwater_heatingshare its node. Format and ID rules are innodes/README.md; spec section 4 reserves wire IDs 0–10, section 7 defines lights and fans by semantic class and lets a node hold a listed endpoint off for a mode's duration, section 9.5 covers binds, follow timing, the night level, measure binds, state sources and commands, and section 12 the class filter folding.nodes/node.schema.jsonis a JSON Schema generated from the generator's tables with shared$defs, for front ends; CI fails if it is stale.nodes/holds no node yet; test nodes live innode_gen/tests/fixtures/.Types:
light,fan,load,dimmable_light,variable_fan,colour_light(WS2805 strip),switch,touch,occupancy,temperature,humidity,setting,flow5d,heater_blower,water_heating.Merges #117 (docs), #118 (runtime binds,
SwitchInput), #119 (generator), #121 (schema), #122 (script tests moved into a tests folder), #123 (sample node moved to the fixtures), #124 and #125 (output types; mode rules by semantic class), #126 (occupancy binds suppressed in modes, since replaced), #127 (pinslist on PWM outputs), #128 (strapping pins warn instead of failing), #129 (bind strategy per target type), #130 (disabled_modes), #131 (touch), #132 (colour_light), #134 (toggleanddurationsettings,enabled_by), #133 (followon_delayandrun_time), #135 (percentageandnight_brightness), #136 (modebinds, since folded into commands), #137 (optionalindex), #139 (settingwithsetting_type,humidity), #140 (flow5d), #141 (heater_blower), #142 (water_heating), #138 (measurebinds, class filter), #143 (dimming_curve), #145 (schema$defs), #144 (virtual, state sources), #146 (commands, fixed nodes), #147 (generator moved tonode_gen/) and #148 (generator split into modules).Behaviour changes to existing code:
SwitchEndpointwrites its off level beforepinMode, takes an optionalinvertand acceptsctrl::noPin;LevelEndpointskips LEDC with no pins and itsrequesttakes arememberflag, default true;modeSwitchesOffdecides by semantic class rather than endpoint type;Node::addBindreturns whether the bind was accepted; theSYS_MODEhandler is nowNode::applyMode, so a node can set its own mode;HeaterEndpointgainsisOn()and anonMeasurepath; MCP2515 class selection lives inclass_filter.hand folds low class bits until the wanted classes fit.BlowerControlmoved tolib/heater-blower(heater::), andWaterHeatingandHeaterDemandArbitertolib/autoterm(autoterm::); the hand-written heater node changes includes and namespaces only. No existing node's behaviour changes; the water heater's final pin level is unchanged.Tested in CI: native suite, the generator and schema unit tests, and a build of every test fixture on its board's env (C3, S3, LOLIN32). Not run on hardware; dimmer PWM resolution is calculated, not bench-checked.
YN-1 to YN-32, except YN-28 which records a design gap.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.