Add night_brightness to dimmable lights and a percentage setting #135
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/yn-17-night-brightness"
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 bind that turns a dimmable light on while the node is in Night mode now requests the light's night level instead of its remembered level. Going off, other modes and bus commands are unchanged. YAML gains the
percentagesetting type (whole percent,min/max/default) andnight_brightnessondimmable_light: an integer percent 1-100, or the label of apercentagesetting on the same node (copied in at the top ofloop).The night level lives on
LevelEndpoint(setNightLevel, 0 = none), so one field serves every bind on that light. ADimmerStrategyderived fromOnOffStrategyreads it through a singleturn()hook; other target types keepOnOffStrategyas is. Spec 9.5, schema, README and the LOLIN32 fixture are updated.Tested: native and Python counts in the handover;
pio runand the LOLIN32 fixture build pass.YN-17
One defect, one test gap.
lib/node-runtime/src/bind.cpp, DimmerStrategy::turn:
dimmer.request(nightLevel)goes through LevelEndpoint::request, which setsrememberedLevel_ = level. After one Night turn-on, the remembered level is the night level. Next morning, a bind (or an HA On command) turns the light on dim, not at the level the user set. The spec line says "instead of the remembered level", so it should be left alone. Fix: apply the night level without touching rememberedLevel_ (for example restore it after the request, or add a path that skips the write).test/test_binds/test_binds.cpp: nothing catches (1). The "remembered level outside Night" test uses a fresh rig, and the bus-command test never has a Night bind turn-on first. Add: Night bind turns on, bind turns off, mode to Day, bind turns on, assert settledLevel == the original remembered level.