Presence sensor smartapp


(Adam) #1

So here’s what I’m trying to do. I’m combing over the Groovy code for the Bon Voyage smartapp, and I’d like to alter it to do this:

Check if presence sensors are away - if so:
Arm Alarm and listen for sensors to return
If they return, disarm the alarm (only once… not continue disarming it as long as the sensor is present)

Else
If 1 or more sensors are home:
Do nothing but wait and listen for them to leave, then arm the alarm.

The only problem is I don’t want to return home, have the alarm disarm, then have it stay disarmed as long as the presence sensors are present. I’d like to be able to manually arm the alarm (Alarm stay for instance) and not have the app revert the state back to disarmed. I came up with an old school code way of doing this, but it was one that coding teachers would frown on. I’m looking for a more graceful way of doing it.


(Bob) #2

This can easily be accomplished with Rule Machine. If you needs assistance setting up the logic, ask here:


(Adam) #3

Great, thanks!