Hello guys!
I’ve a hallway with regular switch and motion sensor. I want to configure it so motion sensor would turn on the lights for 60s while clicking the switch would do so for 5 minutes. However even when timer was started by switch then motion sensor kicks in and reset timer to 60 seconds.
So what I want to achieve is to test remaining time in seconds of a timer in motion sensor automation and if it’s lower than say 60 restart the timer.
Seems ideal case for https://www.home-assistant.io/docs/scripts/conditions/#numeric-state-condition but I’m unable to get it working. I vas trying Developer Tools -> Template editor to fetch remaining time but no avail ( my timer was manually set to 1 hour for debugging, and it shows proper remaining time in UI):
1: {{states.timer.hallway_timer}}
2: {{states.timer.hallway_timer.remaining}}
3: {{states.timer.hallway_timer.finishes_at}}
4: {{states.timer.hallway_timer}}
5: {{state_attr('states.timer.hallway_timer','remaining') }}
6: {{state_attr('states.timer.hallway_timer','duration') }}
7: {{state_attr('states.timer.hallway_timer','finishes_at') }}
8: {{states['timer.hallway_timer'].state == 'idle'}}
result:
1: <template TemplateState(<state timer.hallway_timer=idle; duration=0:01:00, editable=False, friendly_name=Hallway lights time remaining @ 2021-04-01T21:35:46.001739+02:00>)>
2:
3:
4: <template TemplateState(<state timer.hallway_timer=idle; duration=0:01:00, editable=False, friendly_name=Hallway lights time remaining @ 2021-04-01T21:35:46.001739+02:00>)>
5: None
6: None
7: None
8: True
How can I get it working?