šŸ’” Adaptive Lighting automatically adapts the brightness and color of your lights based on the sun's temperature but stops when you manually make a change

I had less problems when using deconz. I canā€™t remember if this was one of them. I did use zigbee groups (deconz), still use them (ZHA), and have problems. Iā€™m just hoping for occasional bugfixes to fix this problem as a side effect :smiley:

Well I setp ZHA with the new Sonoff Zigbee USB and tried to make Zigbee groups and yes if I group an entire room and then turn of one of them lights, that light turns back on in a couple of seconds.

Hey all. Iā€™ve made the switch over to Home Assistant and am loving Adaptive Lighting.

The only thing Iā€™d really love to be able to do is say.
At 11PM or after use red light instead of kelvin.

Possible?

You could create an automation to simply turn off AL at that time and set the light colour to red.

1 Like

Mostly AL works great for me, but I have problem. I have a bunch of Zigbee bulbs (IKEA Tradfri) controlled at the wall using a Philips Hue Wall Switch Module all running over DeConz. The bulbs are hot wired, and the Module just issues a Zigbee on command through DeConz directly, only sending and event to HA.

Most of the time, when I turn the bulbs on using the wall switch, they will remain fixed in their previous brightness state (usually dim from the night before) even though the colour is adjusted.

If I turn the light on using Lovelace, AL adjusts both the brightness and colour.

Any ideas for what is happening?

Thanks for the push @sparkydave. Being new to HASS this set me down a path of experimentation.
I ultimately landed on using pyscript (after trying NodeRed and HASS native automation templates).

Hereā€™s what I have that works well so far.

toggle_area_lights handles toggling areas on/off. If the time is between 8:30PM to 6AM it will set the color to red. After 6AM, if AL is on, it toggles to the current Adaptive Lighting color state. If AL is off toggles on to the last used state.

turn_on_night_mode triggers at 8:30PM. It turns off Adaptive Lighting and sets any light that is currently on to red.

turn_off_night_mode triggers at 6:00AM. It turns on Adaptive Lighting which automatically applies the current Adaptive Lighting setting to any lights that happen to be on.

from datetime import datetime, time


def is_time_between(start, end):
    now = datetime.now().time()
    if start <= end:
        return start <= now < end
    else:  # spanning midnight e.g., 23:30-04:15
        return start <= now or now < end


# We only have Lutron Aurora dimmer switches.
# When pressed they fire the "short_release" event.
# Each switch is in an Area with the same entity name.
# e.g. - Area: living_room  Switch in Area: living_room_button.
@event_trigger("hue_event", "type == 'short_release'")
def toggle_area_lights(id, **kwargs):
    area = id.removesuffix("_button")

    if is_time_between(time(20, 30), time(6)):
        light.toggle(area_id=area, color_name="red")

    else:
        al = switch.adaptive_lighting_adaptive_lighting
        if al == "on":
            light.toggle(
                area_id=area,
                brightness_pct=al.brightness_pct,
                kelvin=al.color_temp_kelvin,
            )
        else:
            light.toggle(area_id=area)


@time_trigger("once(20:30)")
def turn_on_night_mode():
    switch.turn_off(entity_id="switch.adaptive_lighting_adaptive_lighting")

    for id in state.names(domain="light"):
        if state.get(id) == "on":
            light.turn_on(entity_id=id, color_name="red")


@time_trigger("once(06:00)")
def turn_off_night_mode():
    switch.turn_on(entity_id="switch.adaptive_lighting_adaptive_lighting")

I realize this won't directly help anyone else because your setup/desires are different but posting here anyway as I found it useful to read about how others do things while figuring this all out.

:+1:

1 Like

Has anyone created a visualization card for the lovelace dashboard that shows where AL is in the day?

Something like what the f.lux app has on desktop?

1 Like

If you create a template sensor using the switch.adaptive_lighting_YOUR_ENTITY and grab the color_temp_kelvin attribute you could then use the mini graph card or history graph card to display that template sensor

2 Likes

Hello,

Iā€™ve been on HA since new years and Iā€™ve been successfully running 4 instances of adaptive lighting without issue. I was wondering how feasible it is to ask for the sleep config to be set to red. I have 37 accent light strips that are at red/1% all night. Obviously I can do this a zillion ways and Iā€™m doing that, I just thought it would be nice to be able to configure it within the app so I can use the sleep function.

Itā€™s my understanding that sleep mode can only be configā€™d to kelvin; If thatā€™s wrong, please let me know.

I saw a few PRā€™s and I do see where work has been done recently on the app, I didnā€™t want to be a nuisance with this feature request if itā€™s not a realistic ask. Love the app, btw (as a person obsessed with making sure the CT is always right in a room).

Hi,

Iā€™m running a bunch of white tunable Ikea and Hue bulbs with integration into HA with deConz. I also have the Hue Wall Switch Modules behind my light switches set up to control the lights in Phoscon. Most of my on/off activity is through the wall switches and only some programmatic automations through HA.

Does AL treat the on/off commands issues by deConz as external to HA or internal for the purpose of taking control?

Most of the time AL works fine, but if I play with the switches (night mode etc), change birghtness in Lovelace, the bulbs seem to regularly get stuck in some fixed brightness when I turn then on/off at the wall. As if AL does not take back control.

If itā€™s external, does this mean that I should actually create a bunch of automations tracking the wall switches (through the deConz events they send to HA) to keep track of when to give back AL automatic control through the a_l.apply/manual services?

I posted this on the Github repository, but it doesnā€™t seem like a lot of discussions go on there so I thought Iā€™d share it in this thread as well.

When turning my LIFX lights on it can take AL a few seconds to apply the change. This can be jarring especially late at night.

LIFX supports changing the brightness and color of a bulb without changing its power state with the lifx.set_state service. It would be great if AL could be configured to take advantage of that and update them throughout the day regardless of their on/off state.

If they are issued completely outside of home-assistant, they are external. At least thatā€™s my understanding and experience.

So I have a Zigbee switch which sends a deConz event every time it is flipped. It is bound to the bulbs, so switches them on/off by itself without HA. I then have an automation set up to watch for on/off/on to sends the brightness to max if I need it at night: calls ā€˜light.turn_onā€™ with ā€˜brightness_pct: 100ā€™. This makes the light manual.

I understand now that when I switch the light off at the switch and then back on later, it is stuck on manual ā€“ the only way to bring it back to AL control is to go to lovelace and cycle it a couple of times. How can I make this automatic?

Is the optimal solution to have another automation watch for a smingle off deconz_event (which will independently power down bound the bulbs) and then call adaptive_light.set_manual_control to "manual_control: false`?

Anyone else having problems lately with the adaptive lighting integration? The Attributes seem to have stopped updating. They always stay the same (Brightness, Color Temp, etcā€¦)

I am running nearly 20 instances of adaptive lighting and Iā€™ve not noticed any problems with that. Just a bunch of trash in the logs.

I would DEFINITELY notice if mine wasnā€™t working.

well problem solved, sleep mode switch was on, never used it before and i have no automation or script turning that on or offā€¦ :roll_eyes:

2 Likes

New to HA and am having a hard time figuring out how to turn of AL with an automation. I have a helper dropdown setup. If the option for the dropdown is set to one of my options, I want to turn of the AL ā€œswitchā€ so that it stops applying the effect. But I do not see the AL entities (sleep, brightness, color, switch) as a device so that I can set it to off. How do I control those entities within an automation?

I responded to another user here and it kinda lays it all out: Trying to setup adaptive light add-on - #2 by Sergeantpup

I did see your post but it doesnā€™t help me in my current issue. I am coming from SmarThings with CL so I knew the basics of AL. Your outline did solidify that my understanding of AL was correct. In the end what I had to do in HA was for the action, call the service to turn a switch off and then I selected the AL switch that enables it or not. I was expecting the AL switch to show up as a device, just like my other actual light switches show up. After I used the service, I was able to do the automation that I needed.
I set mood lighting when I am watching tv so I needed an automation to turn of the AL switch when my Logitech Harmony TV mode was on so that it didnā€™t affect what I did to my bulbs using a different automation.

My light always turns on at 90% brightness, shouldnā€™t it rise / fall throughout the day?