I’ve moving from ST I’m new to this, but I belive this will do what I expect
Goal: If the harmony is on and the sun goes down, set my evening TV lighting
additionally if the sun is already down when I turn on the harmony, do the same.
Two automations
- alias: TV Lighting after sunset if TV is turned on
trigger:
- platform: sun
event: sunset
condition:
- condition: state
entity_id: remote.living_room_harmony_hub
state: 'on'
action:
- service: script.turn_on
entity_id: script.kitchen_tv_lights_hue_scene
- service: script.turn_on
entity_id: script.living_room_tv_lights_hue_scene
- alias: TV Lighting after sunset if TV was already on
trigger:
- platform: state
entity_id: remote.living_room_harmony_hub
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
- service: script.turn_on
entity_id: script.kitchen_tv_lights_hue_scene
- service: script.turn_on
entity_id: script.living_room_tv_lights_hue_scene
You could combine your automations into one.
Haven’t fully tested the one below but with some minor tinkering your should be able to use it.
- alias: TV Lighting after sunset if TV is turned on
trigger:
- platform: sun
event: sunset
- platform: state
entity_id: remote.living_room_harmony_hub
from: 'off'
to: 'on'
condition:
condition: or
conditions:
- condition: state
entity_id: remote.living_room_harmony_hub
state: 'on'
- condition: sun
after: sunset
action:
- service: script.turn_on
entity_id: script.kitchen_tv_lights_hue_scene
- service: script.turn_on
entity_id: script.living_room_tv_lights_hue_scene
Whenever one of the triggers fires, your automation is executed.
The conditions can be a bit tricky when combining automations but with either clever use of condition: or most shortcomings can be overcome