I recently heard from a fellow forum member who is using geofencing with his HA setup. Maybe because I am retired and I don't get out much (except to walk the pretend dog) I haven't figured out how to exploit this great new technology for my setup. Any ideas on how to exploit this newer HA tool.... would be greatly welcome.
Since you asked... I have some pretty insane expectations for geofencing inside the home.
I've had this dream of adding an
accurate means of per-room occupancy detection and people counting for some time now. The idea is for the HA computer to track where multiple occupants are in the house at all times. If a person enters a room occupied by 0 people, the lights magically turn on to light their way and, provided the room they exited now has 0 occupants, the lights turn off behind them. If music is playing on the overhead speakers in the room they exited, it is switched to the room they enter, and the same goes for voice guidance. If a room is empty for an hour and the TV is still on, automatically shut that thing off. If someone spends some time at the far end of the bathroom and exits the room without flushing the toilet, flush it automatically. If it's late and people are asleep (pressure pads in the beds), lights come on at a dimmer level and voice feedback is kept at a minimum. If all occupants exit all rooms and do not reenter for a timeout period, the last occupant to leave is sent a text message and asked if the house should be locked up. If the user clicks the "Yes" link, the exterior doors are locked and the security system armed. The possibilities are nearly endless.
As far as actually scripting all this mess, I have the necessary framework figured out. The real question has been how to implement the means of detection. I've researched and theorized with lots of options, including BTLE keyfobs, infrared transmitters, infrared beams, motion detectors, and ultrasonic sensors. And I'd finally settled on a solution that involves using four
VL53L0X time-of-flight sensors (two on each side because the cone of sensitivity is fairly narrow) plus one Arduino board per doorway. The two sensors would be mounted next to each other on the ceiling just in front of each side of the doorway. The idea is that a person walking through any doorway would be detected first on one side and then the other. The software can use this to determine the direction of travel and adjust the occupancy count for each room accordingly, then take actions based on the numbers. The time-of-flight sensor can also detect distance, so pets, small children, and the door itself opening and closing can be ignored or handled differently. The Arduino would handle all the data coming from the sensors, identify events and condense them to one piece of data (e.g. "zone a-->b, height 5'8""), and send it to the HA computer via RS232 or Ethernet, and the HA computer would adjust the counts and take actions. I've read enough spec sheets and played with the scripts enough to put together a plan to make this work. After enough begging,
Adafruit even updated their library for us to handle multiple sensors at once. The only problem I hadn't figured out was how to figure out
which person was
where. That would allow each person to have different preferences. The other issue is that if the logic misses just a single room transition, it would be dealing with inaccurate data for every move unless there are other sensors in the rooms providing enough information to trigger the logic to invalidate the counts and correct the numbers. This was also going to require a huge amount of effort -- installing, wiring, coding, tweaking, head-banging -- on my part, so I'd been putting it off until other projects are out of the way and I can truly devote the time.
But now, I'm again
rethinking the whole thing because...
[cue trumpet fanfare]Superaccurate GPS Chips Coming to Smartphones in 2018Broadcom has a GPS sensor out that supposedly reports its location with an accuracy of 30 cm (11.8 inches). With virtually everyone carrying smartphones now, I ought to be able to leverage this tech, at least for the house's typical occupants, to solve
all of the above problems with
very little effort and expense. I imagine I would have to write a smartphone app to get location updates securely to my web server/HA computer without going through a third-party service, but if I can do that, map the latitude/longitude coordinates in all the rooms, and the GPS signals are able permeate the roof and ceiling without issue,
the rest should be a breeze, and with no additional hardware needed (other than updated smartphones, which happens on a regular basis anyway).
Good thing it's a single-story house, or I'd need to track the phone's z-axis (elevation) also!