Presence is a bit more complicated since I set the bar high: multi-location - so we’re not dealing with two circles, we’re dealing with many. I am thinking so far at a way to setup “places” independent of devices (phones). That’s because most locations are common to several people in the house. So you’d create home with location and radius (I’ll default that to 100ft) and I’ll also add another circle automatically that’s 500ft on top of that. Then one of the locations is “HOME” - the one where the hub is - not sure if I can pick up the hub’s location, but I think it’s better if you set it up in the same place as the others. But one place is the main one and will determine the value of “presence”. Presence is set to ‘present’ when you enter the small circle and set to ‘not present’ when you exit the larger circle. Then, the DTH will provide:
- presence = present/not present (main place only)
- arrivingAt = placeName/empty (set to the name of the place that the user is approaching - when the user enters the larger circle, until he enters the smaller circle)
- leavingFrom = placeName/empty (set to the name of the place that the user is departing - when the user exits the smaller circle until the user exits the larger circle)
- distance = calculated distance from HOME (main place)
- presentAt = name of the place the user is at - this is set to a place name when the user enters the smaller circle and set to empty when the user exits the larger circle
- closestPlace = name of the place closest to the current user location
- altitude = current latitude of the user - this will be an option - you can enable it or not
- longitude = current longitude of the user - this will be an option - you can enable it or not
- altitude = current altitude of the user - this will be an option - you can enable it or not
- floor = current floor of the user, IF KNOWN - this will be an option - you can enable it or not
also thinking of either some departing / approaching attributes that use a custom set radius (say 3 miles), or a way to use distanceTo and somehow provide which place. Still figuring things out.
Note that some features may not work with some devices - iOS allows subscriptions to “significant location changes” which means that the app can track the user and the Presence sensor can therefore provide an approximate location of the user. The location is “approximate” because iOS only reports location once in a while as to conserve battery power. This works even if the app is terminated, which is awesome. Also, owing to privacy, this feature will be optional (user needs to enable it on a device basis) and I do not know if that option exists for Android - I’ll find out when I get there.
I am currently figuring out ways to do user registration / login. Once that’s done, a user can then set up to 10 places - each place has a set of coordinates and a radius (will default to 100ft/30m). Places are common to all locations and instances in the account. Then, when the user opens the dashboard in the mobile app, he can register that device as a presence sensor - then the user chooses a name associated to that device for each of the locations he has (and if a location has multiple instances, he’ll need to choose which instance to use) - at that point, he’s set. Presence sensors will be created for each hub(location) and the instance that owns the devices should be able to automatically select them (no need to visit the Available devices).
That’s the plan, at least.