Add night_brightness to dimmable lights and a percentage setting #135

Merged
Claude merged 3 commits from feat/yn-17-night-brightness into feat/yaml-nodes 2026-10-16 09:41:22 +00:00
Collaborator

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 percentage setting type (whole percent, min/max/default) and night_brightness on dimmable_light: an integer percent 1-100, or the label of a percentage setting on the same node (copied in at the top of loop).

The night level lives on LevelEndpoint (setNightLevel, 0 = none), so one field serves every bind on that light. A DimmerStrategy derived from OnOffStrategy reads it through a single turn() hook; other target types keep OnOffStrategy as is. Spec 9.5, schema, README and the LOLIN32 fixture are updated.

Tested: native and Python counts in the handover; pio run and the LOLIN32 fixture build pass.

YN-17

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 `percentage` setting type (whole percent, `min`/`max`/`default`) and `night_brightness` on `dimmable_light`: an integer percent 1-100, or the label of a `percentage` setting on the same node (copied in at the top of `loop`). The night level lives on `LevelEndpoint` (`setNightLevel`, 0 = none), so one field serves every bind on that light. A `DimmerStrategy` derived from `OnOffStrategy` reads it through a single `turn()` hook; other target types keep `OnOffStrategy` as is. Spec 9.5, schema, README and the LOLIN32 fixture are updated. Tested: native and Python counts in the handover; `pio run` and the LOLIN32 fixture build pass. YN-17
Add night_brightness and a percentage setting to YAML nodes
Some checks failed
Build and test / release (pull_request) Has been cancelled
Build and test / build (pull_request) Has been cancelled
e9f194989a
Claude left a comment

One defect, one test gap.

  1. lib/node-runtime/src/bind.cpp, DimmerStrategy::turn: dimmer.request(nightLevel) goes through LevelEndpoint::request, which sets rememberedLevel_ = 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).

  2. 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.

One defect, one test gap. 1. lib/node-runtime/src/bind.cpp, DimmerStrategy::turn: `dimmer.request(nightLevel)` goes through LevelEndpoint::request, which sets `rememberedLevel_ = 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). 2. 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.
Keep the remembered level when a bind turns on at the night level
All checks were successful
Build and test / build (pull_request) Successful in 5m18s
Build and test / release (pull_request) Has been skipped
4ec6c01aa0
Claude merged commit 3331744c95 into feat/yaml-nodes 2026-10-16 09:41:22 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rob/CampervanControlSystems!135
No description provided.