mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-27 20:34:20 +02:00
feat: add adapt_only_on_ha_turn_on to skip adapting externally turned-on lights
When a light turns on from `off` via a source outside Home Assistant — a physical wall switch or a hub/manufacturer scene (e.g. Lutron) — and `detect_non_ha_changes` is enabled, Adaptive Lighting adapts the light on the resulting `off` → `on` event, overriding the brightness/color the external source just set. Disabling `detect_non_ha_changes` avoids this but also stops detection of manual changes to already-on lights; the two behaviors were coupled to a single flag. Add `adapt_only_on_ha_turn_on` (default `false`, requires `take_over_control`). When enabled, an `off` → `on` transition with no matching HA `light.turn_on` context is marked `manual_control` and left untouched, independent of `detect_non_ha_changes`, decoupling the two behaviors. The off→on guard reduces to the previous expression when the option is `false`, so existing configurations are unaffected. Includes a parametrized regression test, docs, and regenerated strings/services/README via scripts/update-generated-content. Refs #435 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
7afdf5bc5c
commit
cb0e552ec5
9 changed files with 148 additions and 6 deletions
|
|
@ -98,6 +98,24 @@ adaptive_lighting:
|
|||
adapt_only_on_bare_turn_on: true
|
||||
```
|
||||
|
||||
### adapt_only_on_ha_turn_on
|
||||
|
||||
When enabled, a light that turns on from `off` is only adapted if the turn-on came from a Home Assistant `light.turn_on` call. Lights turned on by an external source — a physical wall switch or a hub/manufacturer scene (such as a Lutron keypad or Pico scene) — are marked as manually controlled and left at whatever brightness/color that source set, instead of being immediately overridden by Adaptive Lighting.
|
||||
|
||||
This is the option to reach for when turning a light on with its local switch (or a native Lutron/Caséta scene) makes Adaptive Lighting override your brightness a moment later, forcing you to set it twice.
|
||||
|
||||
Its advantage over simply disabling `detect_non_ha_changes` is that the two behaviors are decoupled: you can keep `detect_non_ha_changes: true` to catch manual dimming of lights that are *already on*, while still leaving *externally turned-on* lights untouched.
|
||||
|
||||
```yaml
|
||||
adaptive_lighting:
|
||||
- name: "Respect physical switches and Lutron scenes"
|
||||
lights:
|
||||
- light.living_room
|
||||
take_over_control: true
|
||||
detect_non_ha_changes: true # still catch manual changes to already-on lights
|
||||
adapt_only_on_ha_turn_on: true # but don't override external off→on turn-ons
|
||||
```
|
||||
|
||||
## Checking Manual Control Status
|
||||
|
||||
You can see which lights are marked as manually controlled by checking the switch attributes:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue