Hello!
Trying to get this automation to work, what i want is that if the tv is on after 23 the light will keep beeing turned on until i turn off the tv then i want the automation to wait for 10 minutes then turn all off.
Automation created in front end:
id: '1600786229998'
alias: Belysning Uppe off 23 Vardag
description: ''
trigger:
- platform: time
at: '23:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- sun
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.samsung_tv_status
state: 'off'
for: '00:10:00'
action:
- scene: scene.5b_uppe_off
mode: single
max: 10
You have your conditions and triggers back to front.
The trigger is the tv turning off.
The condition is that it has to be after 11pm for the actions to occur.
trigger:
- platform: state
entity_id: binary_sensor.samsung_tv_status
to: off
for:
minutes: 10
condition:
condition: time
after: '23:00'
action:
- scene: scene.5b_uppe_off
If you turn off the tv at 21:00 then the automation will turn off the lights at 23:00.
If you turn off the tv at 22:55 then the automation will turn off the lights at 23:05.
If you turn off the tv at 23:00 then the automation will turn off the lights at 23:10.
the importance is:
a, if tv is off, the light will turn off att 11
b, if tv is on under/after 11 the light will stay on until i turn off tv and 10 minutes passes.
c, i want to be able to turn on and off tv until 11 without the lights turns off
Well that’s almost clearer than your original post. No idea what you mean by “under/after 11” though.
Assuming you mean after 11, try this:
trigger:
- platform: time
at: '23:00'
- platform: state
entity_id: binary_sensor.samsung_tv_status
to: off
for:
minutes: 10
condition:
- condition: time
after: '23:00'
- condition: state
entity_id: binary_sensor.samsung_tv_status
state: off
for:
minutes: 10
action:
- scene: scene.5b_uppe_off
This will turn the lights off at 11pm if the tv is off. It will also nearly do your other option. The lights will turn off after 10 minutes if you turn off the tv after 22:50. If that bugs you the easiest way around this is to use two automations:
Automation for 11pm lights off if TV off:
trigger:
- platform: time
at: '23:00'
condition:
- condition: state
entity_id: binary_sensor.samsung_tv_status
state: off
action:
- scene: scene.5b_uppe_off
Automation for lights off after 10 minutes if tv turned off after 11pm:
trigger:
- platform: state
entity_id: binary_sensor.samsung_tv_status
to: off
for:
minutes: 10
condition:
- condition: time
after: '23:10'
action:
- scene: scene.5b_uppe_off