adaptive-lighting
adaptive-lighting copied to clipboard
Can't seem to get manual control working.
Hi, I may totally be misunderstanding the functionality provided, but I have both "take_over_control" and "detect_non_HA_changes" flags enabled in the UI setup, but when someone changes the brightness on a physical switch that is on and already adapted, the brightness will still be adapted/reverted about 20 seconds later. The only way to stop adaptive lighting from overriding it is through HA alone, which has serious WAF issues.
Thanks for the help! Otherwise love the component.
I have the same and I was suspecting that my tradfri hub is somehow having troubles. No logs yet.
Same problem here with Philips Hue + ConBee II + Deconz.
Any updates on this? Having the same issue with the TP-Link HS220 switches. I may also be misunderstanding how to use take_over_control
, but each time I set the brightness on the physical switch to a level that's different than the adapted brightness, it reverts back to the adapted brightness after 20-30 seconds.
Did you have resolution?
Same issue here. I'm using Shelly Dimmer 2's and it seems hit or miss if the light will stay dimmed when someone hits the switch.
Seems a few others are having this problem as well
https://community.home-assistant.io/t/new-adaptive-lighting-integration/243788/192?u=jiredell
I've worked around the issue that manual_control is sometimes not detected when I use my Ikea switches to control the brightness of my lights.
It is a work in progress, but it is working in my environment. So, I thought I'd share. When I control any light via device external to HA. then this is more or less instantly picked up and the lights involved are set to manual_control.
Using this technique I have no need for detect_non_ha_changes: true
Notes:
- Not all variables are needed.
- "context_id" containing 'adapt_lgt_' means Adaptive Lighting is doing something. This is where things can break in the future. If 'adapt_lgt_' changes.
- I only look for brightness changes, but that can be changed in "{{ new_brightness != old_brightness }}"
- The last condition ensures that I only allow the automation to execute if the triggered light is in the specified light group.
- Logging can of course be commented out.
This is the "code":
light:
- platform: group
name: all_except_entrance
entities:
- light.kitchen_table
- light.kitchen_window
- light.kitchen_spot1
- light.kitchen_spot2
- light.kitchen_spot3
- light.kitchen_spot4
- light.kitchen_spot5
- light.hall
- light.living_room_picture_wall
- light.living_room_glow
- light.office_table
- light.aaa
- light.bbb
- light.ccc
- light.ddd
- platform: group
name: livingroom
entities:
- light.office_table
- light.living_room_glow
- light.living_room_picture_wall
- platform: group
name: bedrooms
entities:
- light.aaa
- light.bbb
- light.ccc
- light.ddd
automation:
- alias: "Turn on lights outside HA set to manual control TESTING"
mode: parallel
max: 100
trigger:
- platform: event #https://www.home-assistant.io/docs/automation/trigger/#event-trigger
event_type: state_changed
variables:
light: "{{ trigger.event.data.entity_id | default }}"
newlight: "{{ trigger.event.data.new_state.entity_id | default }}"
oldlight: "{{ trigger.event.data.old_state.entity_id | default }}"
domain: "{{ trigger.event.data.new_state.domain | default }}"
newstate: "{{ trigger.event.data.new_state.state | default }}"
oldstate: "{{ trigger.event.data.old_state.state | default }}"
context_user_id: "{{ trigger.event.data.new_state.context.user_id | default }}"
context_id: "{{ trigger.event.data.new_state.context.id | default }}"
context_parent_id: "{{ trigger.event.data.new_state.context.parent_id | default }}"
new_brightness: "{{ trigger.event.data.new_state.attributes.brightness | default }}"
old_brightness: "{{ trigger.event.data.old_state.attributes.brightness | default }}"
new_color_temp: "{{ trigger.event.data.new_state.attributes.color_temp | default }}"
old_color_temp: "{{ trigger.event.data.old_state.attributes.color_temp | default }}"
condition:
- "{{ domain == 'light' }}"
- "{{ newstate == 'on' }}"
- "{{ oldstate == 'on' }}"
- "{{ context_parent_id == none }}"
- "{{ context_user_id == none }}"
- "{{ 'adapt_lgt_' not in context_id }}"
- "{{ new_brightness != old_brightness }}"
- "{{ light in expand(state_attr('light.all_except_entrance', 'entity_id'))|map(attribute='entity_id')|list}}"
action:
- service: system_log.write
data:
message: "Monitor Adaptive Lighting ({{ light }}/{{ newlight }}/{{ oldlight }}) changed by {{ context_user_id }}/{{ context_id }}/{{ context_parent_id }}. Brigthness ({{ old_brightness }}-> {{ new_brightness }}). Color Temp ({{ old_color_temp }}-> {{ new_color_temp }})"
level: warning
- service: script.manual_control_of_light
data:
light: "{{ light }}"
script:
manual_control_of_light:
alias: 'Light changed outside HA. Set Adaptive Lighting Manual Control'
mode: parallel
sequence:
- choose:
- conditions:
- condition: template
value_template: "{{ light in expand(state_attr('light.bedrooms', 'entity_id'))|map(attribute='entity_id')|list}}"
sequence:
- service: adaptive_lighting.set_manual_control
data:
entity_id: switch.adaptive_lighting_bedrooms
manual_control: true
lights: "{{ light }}"
- conditions:
- condition: template
value_template: "{{ light in expand(state_attr('light.livingroom', 'entity_id'))|map(attribute='entity_id')|list}}"
sequence:
- service: adaptive_lighting.set_manual_control
data:
entity_id: switch.adaptive_lighting_livingroom
manual_control: true
lights: "{{ light }}"
I think take_over_control doesn't work properly (at least with Hue Hub) because take_over_control is looking for light on/off service calls instead of state_changed.
If I turn on/off a light using Hue tap switch, it shows state_changed and not a service call. I wonder if this is due to the change in the way Hue integration tracks states?
That automation/script seems fairly straightforward, this logic should be fairly easy to add into the component itself.
is looking for light on/off service calls instead of state_changed
Unfortunately, this needs to be the case because some lights just randomly update their status to some slightly different light setting all the time.
Only when using detect_non_HA_changes
then it looks at state changes.
@mindtripper, I do not really understand why your automation would work. IIUC you switch to manual control on every state change, also the ones resulting from adaptive-lighting. Perhaps I am missing something?
@basnijholt I only trigger the automation if the change was not made by Adaptive Lighting and only if the brightness has changed. The key is in conditions. This is my use-case as Adaptive Lightning via "detect_non_ha_changes" does not reliably detect these changes using Ikea Trådfri light and controllers.
condition:
- "{{ 'adapt_lgt_' not in context_id }}" #ensures it is adaptive lighting making the change.
- "{{ new_brightness != old_brightness }}" # ensures it only triggers if the brightness has changed.
This can of course be extended to any light attribute change. But for me brightness is key.
The script condition ensures that a lights in not set to manually_controlled if it's already manually_controlled.
- condition: template
value_template: "{{ light in expand(state_attr('light.bedrooms', 'entity_id'))|map(attribute='entity_id')|list}}"
Side-note: I even have an automation that triggers if any of my HA users turn on the light from off. The use-case being that;
- I want them to be manually_controlled if a person turns on the lights.
- the lights not be manually_controlled if motion detector is turning them on.
trigger:
- platform: event
event_type: state_changed
context:
user_id:
- "zzzzzxxxyyyzxxxyzyzyxyxz" # Me
- "zzzzzxxxyyyzxxxyzyzyxyxz" # Someoneelse
condition:
- "{{ domain == 'light' }}"
- "{{ new_state == 'on' }}"
- "{{ old_state == 'off' }}"
As an added bonus I do not need HA to call 'homeassistant.update_entity' every 'interval'.
Hi,
Any update about this issue ?
I'm currently in the process of doing version 2. This will be added/fixed.
Keep this ticket open until you can verify that it's properly working in the upcoming version 2.
Is there an update on when version 2 is coming out? My wife can't control our dimmers manually. She's about to rage.
Assume I'll need to implement the workaround above, but this has been open for over a year... What gives?
If your wife’s gonna rage maybe turn off AL
You can turn this thing off!?!? What a revelation
I have Philips Hue lights throughout my home connected to a Hue hub. Many of them are controlled by a Lutron Aurora Smart Bulb Dimmer Switch for adjusting the brightness, and turning on and off. I love AL, but take_over_control and detect_non_ha_changes do not work at all for me with these bulbs and switches. I'm desperate for a solution to restore peace in my home.
Like the other Hue consumers, AL is invasive even with the take_over_control
and detect_non_ha_changes
toggles enabled.
Would love it if this one was given a little more attention.
Should be fixed in 1.10.0