Area/Room Presence Detection for Mobile Devices using ESP32-based BLE Beacons

Hey
Nope I have an android and waiting for the android app etc.

bummer - appreciate the response :slight_smile:

1 Like

@st0nedB, I’m interested. The thing is my automations rely on Hoobs. Would it work there?

@edugrt The app is not specific to Home Assistant. It works with any MQTT server.

I think this project looks very promising, and could be the ideal way for me to handle presence detection, since I have 4 ESPs laying around :blush: ! Could you maybe write a small tutorial on how to compile the app itself? I’m getting tons of errors in Xcode… :hushed:

Hey, I added that as a feature request issue to the git. I think the better way would be to go with altstore (issue #10). That should make self-compiling obsolete.

1 Like

very nice project!
the best would be to be able to integrate Find3 into ESPHOME.
and then find the way to flash micropython inside a Chinese ble tracker (like the one posted in the photo above)

Awsome work, and project.
Want to share my two cents getting started. Perhaps it will help someone if they are stuck :slight_smile:
It was fairly simple to build the code in xcode, I bumped the swift to v.5 and build towards iOS 14.4 on my Iphone 11 Pro. Everything still works. I also added my info like UUID, MQTT settings in there for the ease, so didn’t have to type it in while testing the app.
I ran the training as the guide instructed and easily exported JSON to my email.
Setting up python/pipenv was for some reason difficult on my mac. I decided to give it a go on windows instead and it works fine there. I later found out it was because of path issues switching from terminal -> zfs plus the python version was too new. (3.9) So I am going back to re-visit setup on mac after what I learned from Windows.
Here is the steps that worked for me on windows…

  • I installed python-3.7.9-amd64.exe and remember to tick “add to path” in the installation GUI.

  • Open CMD, and type “pip install pipenv” if the pip command is not found, there might still be some path issues. Can always be added to environment variables / path manually as well.

  • Once python / pipenv is installed, you can browse to the folder where you extracted the machine-learning-python folder. Place the exported JSON files in the folder. Delete the Pipfile.lock. (i’ve had too) and run the command “pipenv install Pipfile” it will create a new lock file and install all the dependencies you need.

  • If the above is successful, you will be able to run “pipenv shell” that will open the new environment with all the dependencies loaded. Run the script roomsModelMaker.py with the --num-beacon (must have more than 1 beacon or will fail!) and the --http -port 80 (or what ever you want) like this. “roomsModelMaker.py --num-beacon --http --port 80”

  • If everything is successful it will create a rooms_coreml.mlmodel file in the folder and open the HTTP client on the port you specified. Test in a browser that you can reach it http://: e.g http://192.168.1.2:80

  • Open the app and enter setting - model and point the phone to the address in the above step including the full filename, hit set and import. The app will inform if the import is successful and you will now be able to test walking in and out of the rooms. :slight_smile:

Summery: So what was key was the right python version (tensorflow supports up to 3.8) and then the pipenv and script worked great. I also only started with one room / beacon which caused the script to fail. But after adding two beacons / rooms, the script ran through with out any issues.

I now look forward to see the events come in home assistant and play around with displaying status on cards in dashboard, and setup automations. If someone has some cool setup running or great ideas please share them. :smiley:

@TripleJ Nice work and thanks for the feedback! Adding stuff like UUID, MQTT, in before building is something that I haven‘t considered yet, but its a great idea if you know what you are doing. It certainly saves you some time during the setup.

Would you mind if I added your instructions/steps here on the Git repo, so others can follow more easily? You could also create a merge request, if that’s what you prefer. Credit where credit is due, so if you want me to mention your name or some pseudonym, let me know (feel free to PM).

Regarding the HA stuff, I currently just use the MQTT Sensors to trigger automations and switch off lights when nobody is in the rooms. Its pretty standard stuff with some templating and a really ugly if…elseif…elseif…else-statement for each room to check if there is someone in the room. If anybody is interested in code, let me know. :smiley:

Hey @st0nedB
Of course just take what you can use and put on the Git repo no problem.
Regarding HA stuff, it would be cool to have some examples of the MQTT sensor and the messages coming in from the App. I have used HA for quite a while but haven’t dealt much with things running on the MQTT, so your examples / code are most appreciated. Can also PM me and share.
Thanks. :slightly_smiling_face:

Nice project! I’m also interested in this project, because solutions like room assistant and the esp32 mqtt room presence projects requires many of these singleboard devices on my WiFi network which may slow down and impacted my WiFi network.

Unfortunately the Home Assistant app is also unable to handle my dedicated iBeacons in the right way for room presence, because it sends the GPS coordinates for the configured iBeacon zones to my Hass instead of the iBeacon details itself (RSSI, UUID, major, minor…), which makes it hard for room detection if you already use GPS tracking for the home zone.

I don’t have a Mac, so I will wait for the release in the App Store, hopefully soon :slight_smile:

Hi, unfortunately that isn’t very likely. Apple does not allow waking up an app into the background based on movement of the device. To work power efficient, the app uses a mechanism (explained in some of my posts above) that, very likely, does not conform to Apples rules. Hence it is very unlikely to get it published in the official App Store.
I am open to publish it by other means, e.g. using Altstore. If you or somebody else wants to help with that, please let me know in the corresponding Github issue.

Just tested the Altstore version, works great :slight_smile:

1 Like

I need some help with this topic and I followed this youtube
I followed the instruction but can’t find the mac of my cellular on the terminal, I used the app, and I can see my Bluetooth mac address on my phone settings but I can’t see it on the terminal nor the app, any ideas?