Presence of nearby devices using ESP8266

For a few days ago I thought about a different way to track presence, for people(friends in my case) that’s not even on my wifi. By using a ESP8266 in station mode sniffing for nearby smartphones, then posting them to my webserver which hash them and post them to my sql database.

Friend’s smartphones sends mac -> ESP8266 -> Webserver -> inserting( hashed(mac address) ) -> MySQL database.

My plan is to make a component, which loop “known_devices.yaml” and makes a HTTP_GET request with the mac address to the my webserver like: “htttp://”. The server then either returns TRUE or FALSE depending on whether the mac address have been detected within last 5 min or not.

The component then change the state of the device accordingly.

I haven’t make any custom components so fare, and pretty lost where to start, but I do have lots of experience with python. How can I do this using Home Assistant, maybe just as a rough coding example? Could be awesome to make this work, and have yet another method to check for user presence :smile:

If anyone would be interested in the code for the php code run by the webserver and the ESP8266 sniffing code as well as the database table. I’ll happily make a clean version and share it :smile:

1 Like