Adaptive Lightning Settings

I’ve been frustrated by the same issue, and seeing your post here yesterday reminded me to look into fixing it again. I came across this automation and it’s pretty much solved the problem!

I had to make one modification, because I have some adaptive lighting instances that adapt only brightness, so I added a check to make sure adapt_color was on before publishing the color updates. Here’s my version of the script in full:

alias: Maintain Adaptive Lighting Color Temperature
description: >-
  Primes the color temperature of lights that are controlled by adaptive
  lighting

  and are currently off
triggers:
  - trigger: time_pattern
    minutes: /5
conditions: []
actions:
  - repeat:
      for_each: |-
        {{integration_entities("adaptive_lighting")|
          select("match","^switch\.adaptive_lighting_.*")|
          reject("match","^switch\.adaptive_lighting_adapt_.*")|
          reject("match","^switch\.adaptive_lighting_sleep_mode_.*")|
          list}}
      sequence:
        - variables:
            adaptive_lighting: "{{repeat.item}}"
            adaptive_lighting_lights: |-
              {{expand(state_attr(repeat.item,"configuration").lights)|
                selectattr("state", "==", "off")| map(attribute="entity_id")|
                list}}
        - if:
            - condition: template
              value_template: >-
                {{
                states(adaptive_lighting|replace('adaptive_lighting','adaptive_lighting_adapt_color'))
                == 'on' }}
          then:
            - repeat:
                for_each: "{{adaptive_lighting_lights}}"
                sequence:
                  - if:
                      - condition: template
                        value_template: "{{repeat.item in mqtt_entities}}"
                    then:
                      - action: mqtt.publish
                        data_template:
                          topic: >-
                            zigbee2mqtt/{{state_attr(repeat.item,
                            "friendly_name")}}/set
                          payload: |-
                            {
                              "color_options": {
                                "execute_if_off": "true"
                              }
                            }
                      - delay:
                          hours: 0
                          minutes: 0
                          seconds: 0
                          milliseconds: 100
                      - action: mqtt.publish
                        data_template:
                          topic: >-
                            zigbee2mqtt/{{state_attr(repeat.item,
                            "friendly_name")}}/set
                          payload: |-
                            {
                              "color_temp": {{state_attr(adaptive_lighting, "color_temp_mired")}},
                              "transition": 0
                            }
mode: single
variables:
  mqtt_entities: "{{integration_entities(\"mqtt\")}}"

Note: my AL is pointed at some zigbee groups in addiditon to individual lights. I don’t believe this automation will set execute_if_off for the members of the group, and I don’t know if that matters – I had already set it for each individual light in each group. If you have zigbee groups adapted by AL and this automation doesn’t work, I’d try setting execute_if_off to true for each individual light and see if that fixes the problem.