New Adaptive Lighting Integration

Hi! I’m pretty excited for this integration as it fixes some niggles i had with the existing Circadian integration.

I’m wondering what the best way of doing a slow transition fade for automatic lights on would be. For clarity, what I do is have automatic lights turn on at sunset on an offset so they fade in over half an hour or an hour or so.

One major issue I had with CL was that I’d have to disable the switch for circadian whenever i wanted to transition lights. it was… kinda messy and gross. This method seems better as you can just call it for individual lights.

I’ve put together a super quick and dirty script i can call with automations that will set manual control for the lights that are being transitioned and wondered if anyone had a better method? Ideally, I’d like the lights to slowly transition to on at the correct colour temp for that time of day, and then have the adaptive lighting controls kick back off so that they change as it gets darker.

Here’s my script I’ve made. It seems to work pretty well.

 sequence:
   - service: adaptive_lighting.set_manual_control
     data:
       lights: '{{ light }}'
       manual_control: true
     entity_id: switch.adaptive_lighting_adaptive_lights
   - service: light.turn_on
     data:
       entity_id: '{{ light }}'
       transition: '{{ time }}'
   - delay: '{{ time }}'
   - service: adaptive_lighting.set_manual_control
     data:
       lights: '{{ light }}'
       manual_control: false
     entity_id: switch.adaptive_lighting_adaptive_lights
 mode: single

I’d wondered about simply calling a brightness in my fade in, though haven’t managed to get that to work (it’d be a data template off the adaptive lighting switch, and either I’m dumb and can’t get a template to combine with normal settings, or it doesn’t function like that). Plus that would need an additional automation to switch the lights back to auto control.

Sorry to disturb you again but i am trying to create an automation that starts the adaptive lighting over some of my lights at certain time, but still don’t know how to create it as i see the switches are already ‘on’ so, how to make the lights turn on with that switch?

Adaptive lighting itself does not turn lights on or off. You have to do that either via physical switch, motion control, script or automation. Adaptive lighting (when enabled/turned on) only controls the brightness, color or sleep mode of a light that is already on. You control the AL switch modes (on/off) either manually via a UI panel or via automations. Let’s say you want to automate the adaptive lighting control for brightness settings of bedroom lights and disable it from adjusting the brightness of the light(s) during the day but enable it at night:
Automation 1

alias: Adaptive Lighting - Disable Bedroom
description: ''
trigger:
  - platform: state
    entity_id: sun.sun
    to: above_horizon
condition: []
action:
  - service: switch.turn_off
    data: {}
    entity_id: switch.adaptive_lighting_adapt_brightness_bedroom
mode: single

Automation 2

alias: Adaptive Lighting - Enable Bedroom
description: ''
trigger:
  - platform: state
    entity_id: sun.sun
    to: below_horizon
condition: []
action:
  - service: switch.turn_on
    data: {}
    entity_id: switch.adaptive_lighting_adapt_brightness_bedroom
mode: single

You would do the same for color.
For sleep mode, create an input_boolean.sleep_mode. When you enable that boolean, the sleep mode settings of adaptive lighting are enabled. To disable AL sleep mode, turn the boolean off. If you do not want sleep mode for another AL group of lights, turn off that AL switch:

alias: Adaptive Lighting - Disable Office Sleep Mode
description: ''
trigger:
  - platform: state
    entity_id: sun.sun
    to: below_horizon
    for: '00:03:00'
condition: []
action:
  - service: switch.turn_off
    data: {}
    entity_id: switch.adaptive_lighting_sleep_mode_office
mode: single

I hope that helps!

1 Like

I have this automation for sleep mode:

alias: 'Adaptive lighting: toggle ''sleep mode'''
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.sleep_mode
  - platform: homeassistant
    event: start
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.sleep_mode
            state: 'on'
        sequence:
          - service: switch.turn_on
            data: {}
            entity_id:
              - switch.adaptive_lighting_sleep_mode_bathroom
              - switch.adaptive_lighting_sleep_mode_bedroom
              - switch.adaptive_lighting_sleep_mode_office
      - conditions:
          - condition: state
            entity_id: input_boolean.sleep_mode
            state: 'off'
        sequence:
          - service: switch.turn_off
            data: {}
            entity_id:
              - switch.adaptive_lighting_sleep_mode_bathroom
              - switch.adaptive_lighting_sleep_mode_bedroom
              - switch.adaptive_lighting_sleep_mode_office
    default: []
mode: single
variables:
  sleep_mode: '{{ states(''input_boolean.sleep_mode'') }}'

You can even combine the two automations for the bedroom, like I described here:

:slight_smile:

Yes, most certainly! I do not have those first three automations.
I just quickly created them to illustrate to @maurizio53 what’s possible…

2 Likes

Nobody ever answered this?

See the PR at https://github.com/home-assistant/core/pull/40626

That was what I was initially referring to. It was previously posted as incoming for HA 0.118 but didn’t happen. Guessing 0.119 but it’s not stated from what I can see, hence I asked.

The PR was just approved so hopefully we’ll see it in 0.119.
I am already using it and it’s working fine for me…

[## Note: anyone that wants to try this out, add https://github.com/basnijholt/adaptive-lighting to your custom repos in HACS and install it! Please report here if you find any bugs :bug: Read the docs here](https://github.com/home-assistant/core/pull/40626)

Since 0.119 has been skipped, any sign of it in 1.0 beta?

I don’t know. I’m using it via https://github.com/basnijholt/adaptive-lighting

From what I can see here it is currently categorized as ‘Incoming’ in the ‘New Integrations’ pipeline:

So probably 1.0.0 non-beta? Just go ahead and install it! It’s working fine for me!!

I had a weird issue with the Lovelace UI in 1.0.0b0 which I fumbled through and then it disappeared/cleared up in 0b1 (the …, edit menus were strange). I was afraid it was an issue with the custom-ui add-in I have loaded but as I said 0b1 cleared it up. No issues with the AL integration…

@dbrunt Great add-on. Is there any way to set the sunrise time dynamically? I get up at a different time each day. I have an automation that turns on my lights based on my phone’s alarm. I’d like to adjust the sunrise time based on my phone’s alarm as well.

No, you can only hard code your own sunrise time in the integration.
To achieve what you want, the integration would have to allow you to input a templated time from another entity into the field…

Is there any reason the sunrise_time and similar values couldn’t be stored in the switch entity rather than the component? Then they could be set by script

I’ve posted a feature request to permit templating the desired sunrise/sunset time entry.
Example:

{{ as_timestamp(states.sensor.vog_l04_next_alarm.state)|timestamp_custom ('%H:%M:%S')  }}

You’d have to invoke the attention of the author @basnijholt