Hi all. I’m very new to the HA environment and am trying to learn how automations work in this environment.
What I’d like to happen is that when my kid goes to bed the living room lights dim, and go back to full brightness when its day time.
The automations and scenes work fine, but only if the lights are being switched on from off. What I’d like is them to change to the appropriate brightness setting even if they’re already on before 7pm bed time. Is this possible? I’ve put my code below.
alias: Living room lights daytime
description: ""
trigger:
- platform: state
entity_id:
- light.ikea_of_sweden_tradfribulbe14wscandleopal470lm_light_2
- light.ikea_of_sweden_tradfribulbe14wscandleopal470lm_light
to: "on"
condition: []
action:
- if:
- condition: time
after: "19:00:00"
before: "06:00:00"
weekday:
- sun
- sat
- fri
- thu
- wed
- tue
- mon
then:
- type: turn_on
device_id: 12dee9c57d3d83601db5cc322e4e2909
entity_id: switch.ikea_of_sweden_tradfri_control_outlet_switch
domain: switch
- type: turn_on
device_id: 622c63408e2d7b8349f0ef0c9a73f900
entity_id: light.lounge_lamp
domain: light
brightness_pct: 50
- type: turn_on
device_id: 4f977717c370ccf9846a28d5f3fca633
entity_id: light.ikea_of_sweden_tradfri_bulb_e27_cws_806lm_light
domain: light
brightness_pct: 50
- type: turn_on
device_id: e54c2c9da61b0523a0beaf20b0457dd7
entity_id: light.ikea_of_sweden_tradfribulbe14wscandleopal470lm_light_2
domain: light
brightness_pct: 50
- type: turn_on
device_id: 84ba8a5404ffa5be7125933e064ac199
entity_id: light.ikea_of_sweden_tradfribulbe14wscandleopal470lm_light
domain: light
brightness_pct: 50
else:
- type: turn_off
device_id: 622c63408e2d7b8349f0ef0c9a73f900
entity_id: light.lounge_lamp
domain: light
- type: turn_off
device_id: 12dee9c57d3d83601db5cc322e4e2909
entity_id: switch.ikea_of_sweden_tradfri_control_outlet_switch
domain: switch
- type: turn_off
device_id: 4f977717c370ccf9846a28d5f3fca633
entity_id: light.ikea_of_sweden_tradfri_bulb_e27_cws_806lm_light
domain: light
- type: turn_on
device_id: e54c2c9da61b0523a0beaf20b0457dd7
entity_id: light.ikea_of_sweden_tradfribulbe14wscandleopal470lm_light_2
domain: light
brightness_pct: 100
- type: turn_on
device_id: 84ba8a5404ffa5be7125933e064ac199
entity_id: light.ikea_of_sweden_tradfribulbe14wscandleopal470lm_light
domain: light
brightness_pct: 100
- if:
- condition: or
conditions:
- condition: sun
after: sunset
after_offset: "-00:30:00"
- condition: sun
before: sunrise
before_offset: "00:30:00"
then:
- type: turn_on
device_id: ead662157ac41f93ae4fe4855ec90cac
entity_id: light.hallway
domain: light
brightness_pct: 50
else:
- type: turn_off
device_id: ead662157ac41f93ae4fe4855ec90cac
entity_id: light.hallway
domain: light
mode: single