Automation for door and motion sensor - help wanted

Hello,

I have the following setup:

  1. Front door opening sensor (binary) - fires when door is opened
  2. Motion sensor on the inside of the front door (binary) - fires when there is movement in the area inside of the door
  3. Presence detection via Wifi AP - operates with some delay until the phone connects to the AP

Now I want to set up an automation that sends an alarm message if, within the time window of 60 seconds, all of these 3 conditions become true at least once:

  1. Door sensor changes from closed to open
  2. Motion sensor changes from clear to detected
  3. Predefined person is not detected as present within this time window (not even once)

I can of course set up each of these 3 as a trigger or condition, but unable to figure out how to combine them as I wrote above i.e. look for the changes within a time window to allow for the presence detector to update (if the case).

Thank you for the help!

Trigger:

  • Motion sensor detects motion

Conditions:

  • OR
    1. Door is open
    2. AND
      1. Door is closed
      2. NOT
        1. Door has been closed for one minute

Actions:

  • Delay one minute
  • Condition NOT
    1. Condition Person is home
  • Sound alarm

That’s probably the simplest, but least ideal, approach.

I’d probably have it with a wait_template with a timeout of 60 seconds of the person being home, and only continuing if the timeout is reached. That’s more involved but will behave better for this.

Thanks, getting there, 2 questions:

  1. The condition 2/2/1 (Door has been closed for one minute) - this means that when evaluating this criteria, it will wait for 60 seconds here, no?
  2. I see what you mean with the wait_templates, but I don’t seem to find how to negate i.e. wait for 60 secs looking at the presence, if it turns on, stop waiting and do one thing, if 60 secs elapse without it turning on, execute an action

No, conditions are a check if the condition is already true.

The example there has you covered :wink:

1 Like