I have made an automation as below, this seems to work fine when watching TV it will not turn of light. Is there a way that It checks after awhile again and if tv is off it will turn off my lights?
- alias: "Lampa: Släck på kväll"
hide_entity: True
trigger:
platform: time
hours: 22
minutes: 50
seconds: 0
condition:
- condition: and
conditions:
- condition: state
entity_id: media_player.vardagsrum_tv
state: 'off'
action:
service: switch.turn_off
entity_id: group.All_home, switch.entre_hall, group.No_home
Not that I am aware of as they have separate triggers.
The way you have your automation written now it will only work if you turn off your TV at 22:50. At no other time will it work. If you want it to only turn off the lights after a certain time, use the time function but with the after option. [ also you don’t need to use the and function in your conditions if you don’t have more than one condition]
- alias: "Lampa: Släck på kväll TV OFF version"
hide_entity: True
trigger:
platform: state
- condition: state
entity_id: media_player.vardagsrum_tv
state: 'off'
condition:
condition: time
after: '22:50:00'
action:
service: switch.turn_off
entity_id: group.All_home, switch.entre_hall, group.No_home