This object is in archive! 

Create a rule - door is left open

Martin H shared this question 8 years ago
Need Answer

How do I create a rule, if a door is left open (between 10: 00-15: 00) and I want to get the alarm to close it. have a Nexa - magnetic sensor.

Replies (10)

photo
1

Forgot to write that I just want to get an alarm if the door is open for more than 15 minutes between these times ...

photo
1

Try this one, and feel free to ask if you have any questions.

You obviously need to change the sensors and alarm with your devices.

Files: ada.png
photo
1

Thanks

photo
1

Is it working? :)

photo
1

With the example I provide (similar to Marijan) you will be able to get a notification if you OPEN the door between this time frame and left it open for more than 15 seconds. My rule and the other example won't work if you open this door one minute before 10:00 and leave the door open for whatever time. If you need this functionality too, another (more complex) aproach needs to be taken, let me know if you need this and I can provide an example of how I think you could solve this.

photo
1

You could also use a loop that iterates 90 times with a 10 seconds wait in it. This way, you could stop the rule I If the door is being closed within the 15 minutes time span.

DO 90 times

Refresh-all

If door.closed

Stop

End if

Wait 10 secs

End loop

Siren.playSound


EDIT: Sorry, the formatting of the pseudo code disappeared after posting

This would ensure that the alarm will only sound if the door is actually _left open_, not just coincidently open again after 15 minutes.

photo
1

Marius, the solution I posted accounts for your last thought - hence the JOIN command.

And the ELSE clause triggers on ANY changes on the door controller, so as soon as you close the door, the ELSE clause triggers, and the timer/siren stops.

photo
1

Marijan,


That rule won't trigger the sound if you open the door before the time frame. What activates the rule is any event (open/close) hence it will run when you open (before time frame) so the IF/ELSE will go to ELSE and turn OFF the alarm. Then if you leave it open you will never get the alarm since there is no other event on the door sensor.

photo
1

Marijan, I obviously have not understood the join command. If the rule is triggered again while in a 900 sec wait, will it cancel the wait and start from the join command?

photo
photo
1

The solution I was thinking is using a minutely blinker (using scheduler and virtual switch or sensor) to inspect the state of the door, if it's open and within the time frame then WAIT and ACTION. For this you need at least two rules.

photo
1

Thanks.

photo
1

try this, let me know if it works for you

photo
1

Is the second check for door sensor present for particular reason? (eg. unreliable rule engine in Zipato?) Because I use similar rules but without second check as each sensor status change cancels all previous instances of rule, so in fact if rule lasted to 900th second then sensor must have been active. I haven't noticed situations when those rules with trigger on ANY event and JOIN as first action require second check, but maybe I am missing something?

photo
Leave a Comment
 
Attach a file