mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-28 04:44:39 +02:00
feat: expose per-attribute manual-control state (#1469)
Adds two new read-only state attributes on the AdaptiveSwitch entity: - manual_control_brightness: list of light entity_ids whose brightness axis is currently in manual override (i.e. AL is paused for brightness on those lights). - manual_control_color: same, for the color axis. These mirror the existing 'manual_control' attribute (which is a union of both axes) but expose the LightControlAttributes bitfield that AL already tracks internally per-light. Why: the existing 'manual_control' state attribute and the adaptive_lighting.manual_control event are useful, but neither lets a template or dashboard see which axis is paused without subscribing to events. This is especially important with take_over_control_mode: pause_changed, where one axis can be manual while the other still adapts. Now a Lovelace card or template sensor can display brightness/color manual state directly via state_attr(). Test: extends test_manual_control to assert the new attributes reflect the bitfield correctly. No new platform, no breaking changes. Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
This commit is contained in:
parent
61896eb86a
commit
e453541a78
4 changed files with 55 additions and 0 deletions
|
|
@ -1151,6 +1151,18 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
extra_state_attributes["manual_control"] = [
|
||||
light for light in self.lights if self.manager.manual_control.get(light)
|
||||
]
|
||||
extra_state_attributes["manual_control_brightness"] = [
|
||||
light
|
||||
for light in self.lights
|
||||
if self.manager.manual_control.get(light, LightControlAttributes.NONE)
|
||||
& LightControlAttributes.BRIGHTNESS
|
||||
]
|
||||
extra_state_attributes["manual_control_color"] = [
|
||||
light
|
||||
for light in self.lights
|
||||
if self.manager.manual_control.get(light, LightControlAttributes.NONE)
|
||||
& LightControlAttributes.COLOR
|
||||
]
|
||||
extra_state_attributes.update(self._settings)
|
||||
timers = self.manager.auto_reset_manual_control_timers
|
||||
extra_state_attributes["autoreset_time_remaining"] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue