Node Red - Home Alarm Arm reminder if no one home

My home alarm is setup in Node Red.

I have Xiaomi door sensors and PIR’s and pushbullet notifications all is good and happy.

However I would like the alarm to be a little bit smarter.

About 60% of the time when the house is left either my wife or me forgets to set the alarm.

What I want to do it make Node Red once there has been no movement on any PIR and the doors have been closed for 30mins and the alarm is not armed then to send message via push bullet to ask if we want to arm the alarm.

The small hurdle for me is the left part of the Flow how would you setup the if no on for 30mins and alarm not active then?

I would feed in the off payload of the door and pir sensors into a delay node set for 30 mins.
Then after that, check state is away and check state of alarm.

The delay node will reset every time it gets a new payload so after the last door or pir sensor turns off the 30 minutes will restart.

EDIT:
Example:

I like it. I will implement and post back results.

Use a Trigger node. You’ll find it under the Function group. Set it so that each pulse RESETS the timer with the Payload equals True. First one starts the 30 minute timer… it could only time for 5 seconds or 29 minutes and 30 seconds… the next True that hits it will reset that timer and it’ll start all over again. I use a trigger to autolock my front door 3 minutes after it was last opened and to reset motion sensor timers for turning lights off. Feed in as many inputs as you need to the trigger node.

This is what I got so far.

  1. PIR’s Sensors when change state to OFF they fire message to Reset delay timer.
  2. Once delay passes out message I have door count entity which I made for the alarm. If no doors are open then it checks window open count if that is == 0 then it passes message to the alarm entity. Else if either are open then it feeds back to the 30min timer.
  3. Once alarm entity gets message sends message to a switch which checks if alarm is in disarm state.
  4. If alarm is in disarm state then notify is triggered sending message to our phones via pushbullet. Else if the alarm is in any other state eg armed then don’t do anything.

I can see I am going to need some more rules. To check if we are home. Coz what if are watching the TV and not moving and the doors are closed?

If that works for you then cool! Have you tested it out yet?
Just add a Current State node before your Call Service for the notification so check if you are at home or not.