new to the wait_template I was wondering if this would suffice (and is even allowed to add a for: to the wait_template, since it is not mentioned in the docs ) or that Id need some other form of delay, or even timeout:
idea: when getting up in the night, switch on the bed outlet powering the floor lights. Motion sensor sees movement, and when movement has stopped for 2 minutes, turn off the outlet again.
the checker error out, and will only accept in the form of:
- condition: template
value_template: >
{{as_timestamp(now()) | int -
as_timestamp(states.sensor.master_bedroom_motion_sensor.last_changed))
| default(0) | int > 120 }}
The way I understood the documentation, the timeout is to be used, catering the situation if nothing happens (read it takes longer than anything specified in the wait_template).
That might have the same effect, but clearly is something else. Again, as far as I understand it…
in a regular trigger we’d use the for: statement, but that isn’t allowed I think.
I am not really sure, how you can do this in a single automation using the wait template (i am not even sure if this can be done), but if you cant figure it out, then you can split your automation into two parts:
One to turn on the light and one to turn it off if the motion is off for two minutes ( using the “for” statement in the trigger)
which works half way. It does switch off after 1 minute, but when movement is sensed within that 1 minute delay, it doesn’t retrigger the wait template. Which is what I would have hoped for with my original wait_template…
can this be done?
separate post for clarity’s sake.
Although a bit of a hassle, an too bad the wait_template can’t be written as in the OP, this is working just fine now.
Had to puzzle a bit to have the sensor show the correct state in the frontend and react to the correct delay_off, and, not unimportantly, have the automation use the correct state, but here it is… finally.
for completenes sake the automation (I’ll leave the tested but not successful tries in there for reference):