"Door open for too long" trigger

I would like to use my multipurpose sensor as a trigger, but only if open for a set amount of time. Ultimately, I want to have it trigger a task if the door is left open for over 60s. Any ideas?

@Ian_Kimmel, you can add a delay in the rule flow to check the door’s contact status 60 seconds later, and do whatever you need in the following flow. See below for example that I set door open as the trigger, and send me an notification if it remains open 60 second later. This is not perfect because the status changed during the 60 seconds is not considered in this rule, but at least get your started somewhere.

I am going to add a feature request in my list to add “Status changed and remained over x period” as trigger condition. :slight_smile:

1 Like

Thanks for the reply!

That’s great news, I currently use the AutoCast tasker plugin as well, and have it set to broadcast a message to my Google home. That way if us or the kids leave the door open and the heat is getting out, it will let us know!

1 Like

Are you trying to accomplish this in Tasker (Android) or the SharpTools.io Rule Engine (web).

James was referring to the SharpTools.io Rule Engine and that’s what his screenshot is from. If you’d like to do this in Tasker, you’d need to build some logic similar to what James noted. Basically set a timer when the event is triggered in Tasker and then check at the end of the timer of the door was still open.

If you wanted to get fancy in Tasker, you could set a Tasker variable with the time the door changed to open and then clear it if the door goes closed. That way when you check 60 seconds later you could do a comparison on the time and make sure you were in the same 'event window’s and the door hadn’t been closed in between.

Edit: that being said, if the goal is primarily notifications then SharpTools Rule Engine makes easy work of doing that as James showed! I’ve moved a number of my Tasker tasks to Rule Engine as it’s easier to maintain and manage.

Sometimes I’ll even use the Pushbullet notifications from SharpTools.io Rule Engine to trigger tasks in Tasker giving me the best of both worlds. :grinning:

1 Like

That seems like a good Tasker approach. I will probably set up a set of queries, the first query will check the state of the sensor and assign it to variable1. A second query 60 seconds later will assign the state to variable2. If state=open trigger above task… If 1=2 then trigger broadcast on Google home

1 Like

Sounds like you are on the right path! :+1:

One thing to keep in mind is that the approach you mentioned will be checking if the door is open at time A and at time B. Meaning it’s not checking if the door opened at Time A and stayed open until Time B.

In practice it’s not a big deal, but it does mean that you could have a timeline like the following:

 Start    Open   Closed     Open
 /         /        /        /   

Even if the door is closed in between the two queries, the system sees the value as ‘still open’.

If you decide that this is a concern, the alternative would be to use events via the Thing State event plugin.

When the first open event is received, record the event and start a timer/task… if you get a closed event in between, cancel the timer/task and clear the event. That way when you check things at the end of the timer, it should only consider sensors that were continuously open.

@Ian_Kimmel, we have rolled out the "Day of Week” option and "State stays…” as trigger and condition in Rule Engine in beta last week. I know you were using Tasker and AutoCast for your setup, but let me know if you are interested in joining the beta group and trying out the new features in SharpTools.io. :slight_smile:

For people who references this post in the future, this “State stays …” feature in Rule Engine has been released to production today, and more information can be found in the announcement.