💡 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

At what time does transition_until_sleep cross over and begin brightening again?
Is it midnight (00:00:00) or nadir (darkest moment of the night where sun is in the lowest position) aka solar_midnight? Currently, my nadir is “2023-08-07T08:19:05.100Z” which for PDT is 01:19:05.100…

If not manually setting any sunset/sunrise times, it is solar midnight (so in between sunset and sunrise basically).

I made this app to help visualize some of the settings
adaptive-lighting
https://basnijholt.github.io/adaptive-lighting/

4 Likes

Thanks, I assumed it would probably be solar midnight.
And lovely app btw!
:+1: :+1:

1 Like

One small hiccup or maybe it’s a design choice but if I enable Sleep Mode, the setting to choose color_temp over rgb_color has no effect…the graph just displays the rgb_color so at first it was all red (255,0,0). A little confusing but just a little! I looked up Kelvin to RGB via this table and put in the RGB equivalent and saw what I was expecting…

Thanks for reporting that! This is a bug in my app code (not in the AL integration).

I have fixed this issue in Fix sleep_mode + sleep_rgb_or_color_temp == "color_temp" in webapp by basnijholt ¡ Pull Request #740 ¡ basnijholt/adaptive-lighting ¡ GitHub.

1 Like

Hi @basnijholt , I’m not sure if this is a bug or intended behaviour so wanted to ask you before posting a bug request on GitHub.

In my living room I have:

  • 4 lights controlled in 1 adaptive light switch
  • 2 lights on a set brightness color

When I get home I have an automation with a ‘turn on light’ call for all lights, and before 1.19.0 the 4 lights would get controlled by Adaptive Lighting and the 2 would turn on with the previous fixed value.

After updating to 1.19.0 the 2 lights also turn on with the color/brightness of Adaptive Lighting. It looks like Adaptive Lighting starts adjusting all the lights that are turned on, even if they are not part of the switch.

I couldn’t figure out what was causing this as I did not change any of my automations. I figured it must be one of the new features introduced in the update, and after looking trough the new settings I found ‘multi_light_intercept’. After turning off this checkbox everything works as before the update. I was wondering, is this an intended feature of the multi_light_intercept?

Kind regards,
Martijn

Hi Martijn,

Thanks a lot for reporting that. This is actually not the intended behavior. I would really appreciate if you could turn on debug logging, reproduce the problem, and share them in an issue on Issues ¡ basnijholt/adaptive-lighting ¡ GitHub

When you say “all lights”, do you mean you use ‘entity_id: all’?

Thanks for your response! I’m going to do my best to fill in a detailed bug report.

When I say all lights I mean all the lights I use in my living room. I used to call a service ‘light_on’ for area ‘woonkamer’. When it stopped working i tried to calll the light_on service with just the 6 lamps entities. This however did not make a difference. Hope this answers your question.

Edit: Bug report here: When turning on multiple lights together, Lights that are not part of Adaptive Switch also get Adaptive color ¡ Issue #749 ¡ basnijholt/adaptive-lighting ¡ GitHub
It’s my first time reporting a bug so I tried my best following the template, I hope all the information is in there.

Thanks for the complete report. This has now been fixed in v1.19.1 :tada:

Could someone check if I understand how I should call adaptive_lighting.apply correctly? Currently I do it like this:

  - service: adaptive_lighting.apply
    data:
      turn_on_lights: true
      entity_id: switch.adaptive_lighting_hallway

I assumed that by skipping adapt brightness and adapt colour it would use the defaults set in the integration configuration. Is that correct? Or do I have to specify ‘adapt brightness’ and ‘adapt colour’ in order to adapt those when using apply?

The main reason I’m using apply is so lights turn on with the correct brightness and colour.

With v1.19 the lights will turn on with the correct color and brightness :slightly_smiling_face:

1 Like

Looking at the new options, are the options separate_turn_on_commands and intercept mutually exclusive?
I have separate_turn_on_commands turned on for my Ikea Tradfri lights, so I assume I should keep intercept off for those?

For send_split_delay is there a recommended amount to use?

I assume intercept works for light.toggle as well as light.turn_on?

They are not mutually exclusive, however, good thinking. With separate_turn_on_commands, only the brightness will immediately be adapted, and then afterwards the color will be set.

1 Like

Please excuse me if this is the wrong place to ask.

Just installed adaptive Lighting 1.19.1 and have configured 4 Adaptive Lighting entries. One of these is my hallway lights which consists of two lights (enbrighten dimmer switches) grouped in z2m. The hallway lights are controlled by an automation that turns on the light when motion is detected and when cleared turns off the lights.

Since the installation I have noticed that when the automation is triggered that no matter the time the lights are always turning on at 100% brightness. In the automation I am just calling the light.turn on service. I have turned off the switch for color in AL.

Am I missing something here?

Check the adaptive lighting manual control entity when the lights are on. Perhaps AL thinks you are manually controlling them because you are turning them on via an automation. If the entity has your lights listed then try turning off ‘take over control’ in the options.

If you created the group in Z2M, and you use the grouped light entity in your automation, make sure you also use that entity in AL configuration as light.

So if you have:

light.hall_1
light.hall_2

And you created the group in Z2M giving you light.hall_group, then make sure you use light.hall_group in your automation and in AL, not the individual lights.

It was listed when the automation turned on the lights. I have unchecked “take over control” and will see what happens. Thank you for the guidance.

This is exactly how I have the lights setup in z2m. :slight_smile:

Hello guys,

I have this addon and works very well but I have a smal doubt.

I have a zigbee lights, and all are allways with power and I have a automation to turn on or off but they have allways power.

When I turn on they take a 2-3 seconds to change color or brightness. Its normal?
Because if their have power all time is not supose update their settings during the day
Even when turned off, they are always powered. They are only turned off by automation

Thanks all

Thanks, this was a powerful addition! Have you considered adding the same functionality for the color temperature changes?

In my use case it would smooth the transition for “evening mode” in which I’m changing the switch settings at a fixed time for warmer color and lower brightness. Currently I’m able to get smooth transition for the brightness but not for the color temperature which seems to change at lower rate at the beginning and more rapidly at the end. With the below code I’m able to start the transition at the same time as the brightness but the transition isn’t linear.

It would be awesome if you could add the same options for color temperature (linear and tanh modes and option to control the transition time).

For reference part of my “evening mode” transition (untested code):

- name: "Example entity" # switch.example_entity
  lights:
    - light.group_example_entity
  min_brightness: 70 # change for evening
  max_brightness: 100
  sleep_brightness: 30
  # below settings are common for all
  min_color_temp: 4000 # change for evening
  max_color_temp: 5500 # change for evening
  brightness_mode: "linear"
  brightness_mode_time_dark: 0
  brightness_mode_time_light: 3600 # change for evening
  # sunset_time: # change for evening
  max_sunset_time: "21:00:00" # change for evening
  adapt_delay: 1
  adapt_only_on_bare_turn_on: true
  autoreset_control_seconds: 3600
  include_config_in_attributes: true

variables:
  v_initial_transition_default: >-
    {{ state_attr(state_attr('sensor.adaptive_lighting_switches_all',
    'list')[-1], 'configuration')['initial_transition']|int }}
  v_initial_transition: 60
  v_min_color_temp_evening: 1500
  v_sunrise_time_evening: "18:00:00"
  v_sunset_time_evening: "23:00:00"
  v_brightness_mode_time_light_evening: 7200
  v_al_switches: "{{ state_attr('sensor.adaptive_lighting_switches_all', 'list') }}"
sequence:
  - service: adaptive_lighting.change_switch_settings
    data:
      use_defaults: configuration
      initial_transition: "{{ v_initial_transition }}"
      entity_id: "{{ v_al_switches }}"
    alias: Increase initial_transition time
  - repeat:
      for_each: "{{ v_al_switches }}"
      sequence:
        - service: adaptive_lighting.change_switch_settings
          data:
            entity_id: "{{ repeat.item }}"
            sunrise_time: "{{ v_sunrise_time_evening }}"
            sunset_time: "{{ v_sunset_time_evening }}"
            max_sunset_time: "{{ v_sunset_time_evening }}"
            brightness_mode_time_light: "{{ v_brightness_mode_time_light_evening }}"
            min_color_temp: "{{ v_min_color_temp_evening }}"
            max_color_temp: >-
              {% if state_attr(repeat.item, 'color_temp_kelvin') <
              state_attr(repeat.item, 'configuration')['max_color_temp'] and
              is_state('input_boolean.adaptive_lighting_evening_mode_automation_helper',
              'on') %}{{ state_attr(repeat.item,
              'configuration')['max_color_temp'] }}{% else %}{{
              state_attr(repeat.item, 'color_temp_kelvin') }}{% endif %}
            min_brightness: >-
              {% if state_attr(repeat.item,
              'configuration')['min_brightness'] >= 50 %}{{
              state_attr(repeat.item, 'configuration')['min_brightness'] -
              20 }}{% else %}{{ state_attr(repeat.item,
              'configuration')['min_brightness'] }}{% endif %}
            max_brightness: >-
              {% if state_attr(repeat.item, 'brightness_pct')|round(0) <
              state_attr(repeat.item, 'configuration')['max_brightness'] and
              is_state('input_boolean.adaptive_lighting_evening_mode_automation_helper',
              'on') %}{{ state_attr(repeat.item,
              'configuration')['max_brightness'] }}{% else %}{{
              state_attr(repeat.item, 'brightness_pct')|round(0) }}{% endif
              %}
  - delay: "{{ v_initial_transition + 10 }}"
  - service: adaptive_lighting.change_switch_settings
    data:
      initial_transition: "{{ v_initial_transition_default }}"
      entity_id: "{{ v_al_switches }}"
    alias: Default initial_transition time