How to determine when someone has returned


(Jason) #1

I’m working on my first SmartApp which will be performing some actions if someone returns after everyone was away. I only want the actions to trigger if it is the first person returning, not if others are already present. I’m having trouble figuring out how to determine if the presence event is for the first person returning versus an additional person returning when the house is already occupied. Any ideas on how to accomplish this?


(Barry) #2

If you are using the Hello Home actions, the first person home should trigger the house to switch from Away to Home mode - therefore, you could just monitor the location events, checking for the transition to “Home”.

Alternately, if you want to monitor presence yourself, set a state.variable to “away” when the last person leaves, and then check that whenever you see a “present” presence event. On the first presence, set the variable to “home” and do your stuff.

but monitoring Location is simpler…