I’m sure I am missing something simple but I have been working on this for the past 2 days and can’t figure it out and I’m not sure it is even possible the way I’m trying to execute this automation.
I am try to change the lights to a different temperature at sunrise and sunset with a condition that checks to see if the input boolean is on for that particular light since I only want to run the automation once per light.
The variable in question is in the condition section of the choose option. I have tried multiple ways of writing the condition with the trigger variable and to no avail.
This is what I have at the moment but it is still not pulling the trigger variable inside the condition.
# Change color temperature of lights when they turn on based on sunrise/sunset
- id: 'sunrise_sunset_lights_turn_on_2'
alias: Color temperature based on sunrise/sunset - Lights turn on 2
description: 'Change color temperature of lights when they turn on based on sunrise/sunset'
mode: single
trigger:
- platform: state
entity_id:
- light.master_bathroom_main_light
- light.master_bedroom_accent_light
- light.north_bedroom_main_light
- light.south_bedroom_main_light
from: 'off'
to: 'on'
condition: []
action:
- choose:
# Sunrise Condition
- conditions:
- condition: sun
after: sunrise
after_offset: '-00:15:00'
before: sunset
before_offset: '-00:15:00'
- "{{ is_state(input_boolean[trigger.state.object_id], 'on') }}"
sequence:
- service: light.turn_on
target:
entity_id: '{{ trigger.entity_id }}'
data:
transition: 60
color_temp: 250
default:
- condition: template
value_template: "{{ is_state(input_boolean[trigger.state.object_id], 'off') }}"
- service: light.turn_on
target:
entity_id: '{{ trigger.entity_id }}'
data:
transition: 60
color_temp: 370
I have this input boolean setup with the same name as the light but with the added _sunrise at the end.
south_bedroom_main_light_sunrise:
name: 'South Bedroom Main Light - Sunrise'
icon: mdi:lightbulb-auto
Any help would be greatly appreciated.