šŸ’” 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

Hello, I have a problem with this integration, I donā€™t know how to set it up. I have an RGB bulb, so I forced the RGB control. The light bulb changes color and brightness, but never to a minimum of ā€œ0%ā€ and does not start from ā€œ0%ā€. No matter what I try, it will never fade. What am I doing wrong? The bulb is a GLEDOPTO 12W RGB CCT Zigbee 3.0 bulb E26 E27 Pro. Please help.

After a bit of testing I have a suspicion the lighting behaviour is related to the change from home assistant using mireds to accepting kelvin.

I wrote a simple script to turn off adaptive lighting, turn on the light setting the levels I wanted and then turned adaptive lighting back on. I activate this with my switch automation, which passes through the variables desired for that room to the script.

- alias: Set up variables for _AL_Switch brightness
  variables:
    _albrightness: '{{ state_attr(_AL_switch,''brightness_pct'') | default(''1'')}}'                
- service: switch.turn_off
  data:
    entity_id: "{{ _AL_switch }}"
- service: light.turn_on
  data:
    brightness_pct: "{{ _brightness_sleep | default('1') }}"
    color_temp: "{{ _color_temp_sleep | default('500') }}"
    transition: "{{ _transition_on | default('0') }}"
  target:
    entity_id: "{{ _target_entity }}"
- service: switch.turn_on
  data:
    entity_id: "{{ _AL_switch }}"

Using anything other than mireds caused a transition effect of turning on to the last known state before changing color to the desired color after the transition period finished.

Setting my light switch automations to call the script when sleep mode is enabled has it working well. It turns on at 1% brightness and with 500 mireds. I have one hue bulb that flashed me with white light last night, so ymmv, but Iā€™ve used this for 2 weeks without any others misbehaving.

I attempted to extrapolate this and use maths to obtain a mired value from adaptive lighting, but ran into some errors that just werenā€™t worth it for me to try trouble shoot - instead I have an overly complicated script that could very very easily be optimised by someone who is better at coding than I am. It checks against the time of day and turns it on at preconfigured levels IF the lightā€™s last_changed state is > than 3600 seconds.

Edit: actually now that I tested it while home during the day, it does seem that telling the lights to come on at a mired of 153 doesnā€™t avoid a transition from flashing mired 500 before transitioning to mired 153. So this might not actually be the reason for the behaviour. Regardless of color though, it definitely fixes the issue with brightness coming on at 100% and dimming down to xyz%, so Iā€™m still happy with the work around.

Those Gledopto bulbs are RGB-CCT, so this component will work better if you donā€™t force RGB mode. The ā€œCCTā€ means correlated color temperature, which is what Adaptive Lighting uses to set color temperature using the bulbā€™s warm white and cool white LEDs that are present in addition to the RGB LEDs.

I have Adaptive Lighting running using those same Gledopto bulbs, and here is the integration setup that works for me:

prefer_rgb_color: FALSE
initial_transition: 5
sleep_transition: 5
Transition when applying a change to the lights: 45
interval: 90
min_brightness: 50%
max_brightness: 100%
min_color_temp: 2200
max_color_temp: 5500
sleep_brightness: 1%
sleep_rgb_or_color_temp: RGB
sleep_rgb_color: [a nice warm orange]
[sunrise and sunset settings are all defaults, no overrides]
only_once: FALSE
take_over_control: FALSE
detect_non_ha_changes: FALSE
separate_turn_on_commands: FALSE
send_split_delay: FALSE
adapt_delay: 2

These settings have worked well for me, but there is a downside: it will take the full transition time (45 seconds) for the lights to come to full brightness when turned on, and also to fully turn off when turned off. I set this long transition time because without it, I would notice each transition occurring (as a sort of perceptible ā€œblinkā€) during the day as the temperature/brightness automatically changes.

Good luck!

Unsure if you are still looking for an answer but I just tackled this the other day lol. I have four rooms that have dumb switches but smart bulbs and was experiencing exactly what you described. I used the following automation to achieve my desired result:

- id: '6c3a74c553b94f29afb5c492792d1235'
  alias: Guest Room Lights Adaptive Lighting
  description: ''
  trigger:
  - entity_id: light.guest_lights
    platform: state
    to: 'on'
    from: unavailable
    for: '00:00:15'
  condition: []
  action:
  - service: adaptive_lighting.apply
    data:
      entity_id: switch.adaptive_lighting_guest_lights
      lights: light.guest_lights
      transition: 30

Thank you for your help. Your settings work great. I also wrote to GLEDOPTO about their bulb (GLEDOPTO 12W RGB CCT Zigbee 3.0 E26 E27 Pro). I got a vague answer confirming different brightness depending on RGB on/off mode.
This is confirmed by my observations and control of energy consumption. Itā€™s not bad for today, Iā€™ll do the rest of the functionality in Node-RED.
Thank you again.

Crosspost from the older thread, sorry

hassjay

40m

Iā€™ve just purchased a Hue Play Bar and installed the Adaptive Lighting component to use as a sunrise and sunset simulator.

Iā€™ve set sleep_transition to 300, sleep_brightness to 1%, sleep_rgb_color_or_temp to rgb_color and sleep_rgb_color to Red.

Iā€™ve created a script that checks the light is on and sleep mode is off, then turns sleep mode on, waits 300 seconds (for the light to transition to 1% red) and then turns the light off. This will be called manually when I go to bed.

A second script that check the light is off and sleep mode is on, turns the light on and sleep mode off. This will be called by an automation before Iā€™m due to wake up or manually if I wake up earlier.

Is anyone else doing something similar? I guess Iā€™ve missed some exceptions. What should I look out for? Waiting for the transition before turning the light off feels a bit clunky.

I would love to know how to enable sleep mode for all integrations with 1 simple toggle on the dashboard to force and than also auto turn on based on a time, would be fantastic.

Would also like sleep mode to turn off based on alarm time.

You can do this now:

Hereā€™s my manual override that will let me turn one adaptive light on/off and also the ability to turn all of them on/off:


Forgive the number of instances, I have complex lighting demands.

Hereā€™s some YAML

square: false
columns: 1
type: grid
cards:
  - type: custom:mushroom-title-card
    title: Adaptive Lights
    alignment: center
  - type: vertical-stack
    cards:
      - square: false
        columns: 1
        type: grid
        cards:
          - type: custom:mushroom-entity-card
            entity: switch.adaptive_lighting_day_mode
            name: All
            layout: vertical
            secondary_info: none
            tap_action:
              action: toggle
            hold_action:
              action: more-info
            icon: mdi:theme-light-dark
          - square: false
            columns: 3
            type: grid
            cards:
              - type: custom:mushroom-entity-card
                entity: switch.adaptive_lighting_bar_leaf
                layout: vertical
                name: Bar Leaf
                secondary_info: none
                tap_action:
                  action: toggle
                hold_action:
                  action: more-info
              - type: custom:mushroom-entity-card
                entity: switch.adaptive_lighting_bedroom_2_accent_lights
                layout: vertical
                name: Bedroom 2 Accents
                secondary_info: none
                tap_action:
                  action: toggle
                hold_action:
                  action: more-info
              - type: custom:mushroom-entity-card
                entity: switch.adaptive_lighting_bedroom_2_house_lights
                layout: vertical
                name: Bedroom 2 House
                secondary_info: none
                tap_action:
                  action: toggle
                hold_action:
                  action: more-info
square: false
columns: 1
type: grid
cards:
  - type: custom:mushroom-title-card
    title: Sleep Mode
    alignment: center
  - type: vertical-stack
    cards:
      - square: false
        columns: 1
        type: grid
        cards:
          - type: custom:mushroom-entity-card
            entity: switch.adaptive_lighting_sleep_mode
            name: All
            layout: vertical
            secondary_info: none
            tap_action:
              action: toggle
            hold_action:
              action: more-info
            icon: mdi:theme-light-dark
          - square: false
            columns: 3
            type: grid
            cards:
              - type: custom:mushroom-entity-card
                entity: switch.adaptive_lighting_sleep_mode_bar_leaf
                layout: vertical
                name: Bar Leaf
                secondary_info: none
                tap_action:
                  action: toggle
                hold_action:
                  action: more-info
              - type: custom:mushroom-entity-card
                entity: switch.adaptive_lighting_sleep_mode_bedroom_2_accent_lights
                layout: vertical
                name: Bedroom 2 Accents
                secondary_info: none
                tap_action:
                  action: toggle
                hold_action:
                  action: more-info
              - type: custom:mushroom-entity-card
                entity: switch.adaptive_lighting_sleep_mode_bedroom_2_house_lights
                layout: vertical
                name: Bedroom 2 House
                secondary_info: none
                tap_action:
                  action: toggle
                hold_action:
                  action: more-info

Hereā€™s a script that runs the switcher based on house awake/alarm or whatever you want

alias: House Awake
sequence:
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.adaptive_lighting_sleep_mode
        - switch.living_room_sonos_night_sound
        - switch.do_not_disturb
        - switch.salt_lamp

Hereā€™s the switcher that turns on Sleep mode:

alias: 9:45 Script
sequence:
  - service: switch.turn_on
    data: {}
    target:
      entity_id:
        - switch.adaptive_lighting_sleep_mode
        - switch.do_not_disturb
        - switch.adaptive_lighting_adapt_color_bar_leaf

Whenever automations are turned on/off I have these switches aligned with those so say I turn on the automations, I want the adapters to re-cycle and I have that built in. Opposite is true when I turn off automations, I generally want the adapters in some other forced state (sleep)

Example of whenever automations are turned on/off I make the adapters follow (if I have the automations turned off, I generally donā€™t want anything happening with the lights):

alias: Automation Controls
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.bedroom_automations
      - input_boolean.living_room_automations
      - input_boolean.bedroom_2_automations
      - input_boolean.media_room_automations
      - input_boolean.kitchen_automations
      - input_boolean.dining_room_automations
      - input_boolean.downstairs_bathroom_automations
      - input_boolean.front_entryway_automations
      - input_boolean.garage_entryway_automations
      - input_boolean.garage_automations
      - input_boolean.laundry_room_automations
      - input_boolean.stairway_automations
      - input_boolean.2nd_floor_bathroom_automations
      - input_boolean.all_automations
      - input_boolean.office_automations
      - input_boolean.den_automations
      - input_boolean.ring_announcements
condition: []
action:
  - if:
      - condition: state
        entity_id: input_boolean.bedroom_automations
        state: "off"
    then:
      - service: switch.turn_off
        data: {}
        target:
          entity_id:
            - switch.adaptive_lighting_bedroom_accent_lights
            - switch.adaptive_lighting_bedroom_house_lights
      - service: input_boolean.turn_off
        data: {}
        target:
          entity_id:
            - input_boolean.office_automations
            - input_boolean.bathroom_1_automations
  - if:
      - condition: state
        entity_id: input_boolean.bedroom_automations
        state: "on"
    then:
      - service: ecobee.resume_program
        data:
          entity_id: climate.bedroom_thermostat
          resume_all: false
      - service: input_boolean.turn_off
        data: {}
        target:
          entity_id: input_boolean.nap_time
      - condition: time
        before: "21:45:00"
        after: "08:00:00"
      - service: switch.turn_on
        data: {}
        target:
          entity_id:
            - switch.adaptive_lighting_bedroom_accent_lights
            - switch.adaptive_lighting_bedroom_house_lights
      - service: media_player.media_pause
        data: {}
        target:
          device_id:
            - 898f8a660526adff7267fa8f6c1578fc
            - 9679079d7d92d3901f6fdb9da83f6f97
      - service: script.set_3rd_floor_air_filters_to_auto
        data: {}
      - service: input_boolean.turn_on
        data: {}
        target:
          entity_id:
            - input_boolean.office_automations
            - input_boolean.bathroom_1_automations
      - service: script.canvas_effect_randomizer
        data: {}
      - service: cover.open_cover
        data: {}
        target:
          entity_id:
            - cover.office_blinds
            - cover.office_curtain
            - cover.bathroom_shade
            - cover.bedroom_shades
      - service: fan.turn_off
        data: {}
        target:
          entity_id: fan.bedroom_fan
      - service: light.turn_off
        data: {}
        target:
          entity_id: light.bed_sconces
    else: []

The net of all this is you can do this with simplistic groupings of your adaptive lighting switches:
image

Make a group to aggregate all your sleep mode switches and adaptive lighting switches:



These are the aggregate (all) switches in the very first image

Despite me having such complex lighting demands, itā€™s all automated. I very rarely have to manually override because when I tell alexa to turn off automations, itā€™s subsequently turning off the adapters too. When the automations turn back on, the adapters resume. Between the scheduled/state switching of adaptive lighting throughout the day and then the ad hoc needs (which generally happen to align with my automation states), all my needs are covered but I have the manual overrides within two clicks of me touching my phone.

I just got Home Assistant not to long ago. Iā€™m sure I will use the above in a few months (Probably a week), but right now Iā€™m going for something a little bit more simplistic.

I made a Toggle ā€œSleep Modeā€ ā€“ Input Boolean
This toggle turns on at 11:00pm and off at sunrise.

description: ""
trigger:
  - platform: time
    at: "23:00:00"
    id: Sleep_Mode_On
  - platform: sun
    event: sunrise
    offset: 0
    id: Sleep_Mode_Off
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Sleep_Mode_On
        sequence:
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.sleep_mode
      - conditions:
          - condition: trigger
            id: Sleep_Mode_Off
        sequence:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.sleep_mode
mode: single

I also created a manual button on my dashboard that can be used for manual overrides.
Screenshot 2023-02-12 120422

Now what Iā€™m looking for as of right now, (later, as I understand what Iā€™m doing I will want full control as well), but right now I want to enable sleep mode for all the integrationsā€¦
Screenshot 2023-02-12 120505

So I have

description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - input_boolean.sleep_mode
    from: "off"
    to: "on"
    id: Sleep_Mode.ON
  - platform: state
    entity_id:
      - input_boolean.sleep_mode
    from: "on"
    to: "off"
    id: Sleep_Mode.OFF
condition: []
action: []

Now I need to add the actions to will enable sleep mode in all the adaptive lighting areasā€¦ this Im not sure about.

That would be done by creating a group of switches that contains all your sleep mode switches. It will be easy to build because all you have to do to find them is type ā€˜sleepā€™ when adding all the sleep switches to that group. Then all youā€™re doing is controlling that 1 grouped switch

Ok, so I didnā€™t know about groups. So I have now figured that out, and created a Group of type switch that contains all the sleep switches.

!!! I got it figured out. This is amazing. Thank you :smiley:

1 Like

the way I have it named that way is so I can send the group name to alexa in a meaningful way and be understood. Alexa, turn on sleep mode. Alexa, turn off adaptive lighting. All sheā€™s doing is hitting these aggregated grouped switches.

Genius. So Alexa Controls your home assistant?
Im not that far into it yet lol

Yes, thereā€™s a really solid integration and you can pick and choose the things you want to send. So instead of sending 50 switches that all have adaptive lights in the name, you can just send the 1 aggregated switch name.

Same concept I use for lights. I donā€™t generally send all the bulbs through because I rarely change them independently. I just send the light group names through.

With the input booleans and switch groupings, you can send just about whatever you want to alexa in one way or another. If you name your scripts creatively you can communicate with your scripts via alexa. Alexa, turn on (insert script name) and it will run the script.

Im sure somebody is going to ask why Iā€™m turning off adaptive lighting ad hoc when there are features built in and other automations. The short answer is home assistant restarts. If the lights are on and set a certain way, they are set to stay that way. But when you reboot home assistant, it re-cycles any bulbs that are on. Letā€™s just say I have some tabletop gamers that get very annoyed with me rebooting HA 10 times on a Sunday. The switch allows me to kill adaptive lighting before a reboot and to ensure NO changes are made to lights.

How did you make those cards the way you did? are there addons I would need?

I would say the use case is after I get done doing dumb stuff with the lights, toggling the adaptive lighting off/on sweeps the entire house for lights that are on and then re-adapts them.

The hidden benefit being you can reset all the lights in the house to what theyā€™re ā€˜supposed to beā€™ at that time of day. Its useful for if you turned off adaptive lighting at noon, but then at 5 pm you notice theyā€™re all daylight, toggling the adaptive light switch off and on will reset the lights (which is effectively a day mode).

You ever have problem with the adaptive Takeover?

I have all Lutron Casseta switches and Iā€™m just not fully understanding how it makes the decision that someone else is in control?

Sometimes regardless it keeps me in control, even if I turn the lights off and on, and sometimes it takes control after I have dimmed them.

Also this is now working flawlessy :), Thanks.

check your settings:

you can make them only adapt once.

I have what you have, but what I have is the behaviour is not consistantā€¦
Like sometimes Ill manually change the brightness and it stays, but then ill turn them off and back on and sometimes it will take control, and sometimes it wont.

Ok I think I made a big bobo. I was adapting the brightness.
I assume this means that the brightness that the light was at is the new 100% brightness? A really cool feature if thatā€™s the case, but really messed me up lol.

I think its all working good nowā€¦

1 Like