Is it possible to know the remaining time when using the Condition or Platform “state” together with time clause “for”, for instance:
- alias: "Decoration time to off PIR"
trigger:
platform: state
entity_id: group.indoors_motion
to: 'off'
for:
minutes: 20
condition:
- condition: time
after: '22:30:00'
action:
- service: switch.turn_off
entity_id: group.decoration
My ambition is to show the remaining time before decoration lights turn off whenever the PIR sensor gets triggered.
I don’t believe it’s possible, but you have ways to achieve this:
separate automation that triggers on group.indoors_motion turning off, sets a counter to 20 and calls a script that will decrease the counter by 1. The script then calls a separate script that waits 1 min and calls the 1st script (a script can’t call itself
track in an input boolean whether you’re in count down mode. have a automation that triggers on group.indoors_motion turning off, sets the counter th 20 and sets input boolean to on, a 2nd automation that runs every min and decrease the counter with condition that input_boolean is on and counter is not 0