#Checking state for X amount of time after an automation triggers

1 messages · Page 1 of 1 (latest)

brave elbow
#

Hello here,
I've been trying to make an automation that triggers with a sensor detecting a motion but then if another motion sensor is not detecting anything within given time frame since the trigger it will send a notification.

I am trying to not use templates for this since I am not yet that familiar with making of those but so far it seems like there is no way to trigger a countdown that will check for state changes and give certain output whether the change happens or not within that time frame.

The closest to this is the "Wait for a trigger" building block, but that one only waits for trigger to happen to continue and if it does not happen I cannot really get any output of it, or can I?

#

Ok, I think I actually figured out the solution. Basically I create a delay that last for X seconds I want the testing period to last followed by "if" condition that checks if there was no occupancy for last X second.

brave elbow
#

Ok, that is not how the duration function really works. I thought that the duration checks whether it has been occupied in given time frame and then give true or false, but instead it just wait for that time until it is unoccupied again.

brave elbow
#

Checking state for X amount of time after a automation trigger

#

Checking state for X amount of time after an automation triggers

grave sequoia
#

You can use a wait for trigger. Give it a trigger id and a timeout - after the wait you can do an if trigger = id - change happened, else change didn't happen

untold minnow
raw merlin
#

If you need to use the wait variable, you’ll be using templates. Since templates are going to be unavoidable, might I suggest creating a simple template sensor instead? This way you don’t need any templates in your automation nor do you need to use any type of “wait” function.

template:
  - binary_sensor:
      - name: Motion Sensor With Delayed Off
        state: "{{ is_state('binary_sensor.my_motion_sensor', 'on') }}"
        delay_off:
          seconds: 60

Then your automation triggers on the second motion sensor that you mention in the description, and in the conditions section you check if the state of your new template sensor is on

brave elbow