New Virtual Sensor Apps -- M of N Presence

smartapp_presence

(pahrohfit) #1

I was playing with some of the presence sensor setups, and ran into a few shortcomings, so I wrote two new ones. This is my first at anything javaish (learned it/groovy over the weekend enough to do this), so pardon the ugly look. Both provide for full alerting and are fully functioning. I have some code cleanup to do still, but any feedback would be great.

M of N Presence - GitHub

There are 2 apps:

"MofN Presence"
This is a remake of some virtual presence sensors I found for using multiple devices to set a single device status. You can select the physical sensors you have, define the virtual sensor to manage (must first provide this via the IDE), and then select the number of sensors from that grouping must be showing ‘present’ in order for the virtual sensor to match.

Example – Everyone in the family has a sensor (phone or token), only turn on (or off) the lights when enough people are home at once.

I’m planning on adding an option to make this only show presence when multiple items change state to not-present, then come back (in any time frame). For instance, when I leave with my phone and my motorcycle, close the garage, and when I come back with at least one of them, open it (due to poor zigbee connectivity to a remote garage), but don’t do so if I only left with my phone (as the bike key token will always be present).

“MofN Assured Presence"
Same as the 'Presence” app, only this requires the M devices to change state to 'present" in a user defined time window (arrive within a user defined time frame in relation to each other).

Example – I have a phone sensor, and a vehicle sensor. Only open my garage door when both arrive at the same time (I’m out on my motorcycle vs I went to the store in my car).