[presence] Reliable, Multi-User, Distributed Bluetooth Occupancy/Presence Detection

The one you replied to me about :slight_smile:

Gotcha - thought I had addressed it. Pushing an update to 0.28 now.

@PianSom Should be fixed in 0.4.28 - LWT will post to /topic_path/owner/mqtt_room {"status" : "online"}

Let me know if you have any issues with this update.

Thanks @andrewjfreyer

I am now getting eg

presence/owner/pi0ups {"status":"online"}

on Pi Zero start, and on service re-start. :slight_smile:

However, I do not get any offline status if I stop the presence service, which I was expecting.

Interesting. I’ll see if I can figure out the LWT stuffs in more detail. I’ll open a bug report on git. Thanks for the report!

1 Like

@andrewjfreyer Thank you so much for sharing this.

1 Like

Thanks for this. I have been using it on two Zero Ws for a week or so and works great, especially for keeping tabs on the BLE beacon we have on the cat. The big problem is that Bluetooth on each of the Zeros eventually goes down and when I restart the script I get the error message “Bluetooth interface went down. Restoring now…”. Any idea how to keep the interface up?

1 Like

Hi There,
what about copying the functionality to a ESP32 - will it be possible, cheaper?
MQTT should work her also.

Regards

1 Like

In my testing, it seems that the interface goes down most often when the timeouts on hcitool scans is too low.

Have you tried increasing the name scan timeout or the beacon scan timeout?

Yes, I have considered rewriting the happy bubbles firmware for this. Not cost effective unless you can make similar devices in volume.

I hadn’t seen that project.

Using a ESP32 might have some advantages regarding boot/reboot when power loss or sd card wear.

ESP32 as hardware, and then an appdaemon app to handle the logic…

Yes, using ESPs sounds like a nice idea (but maybe a bit more labor intensive to configure / upgrade). I don’t think, AppDaemon logic is needed, the esp32 can just as well send mqtt.

Lars

I was thinking of doing the setup in Appdaemon, and then have it transfer the settings using MQTT to the ESP32.

The appdaemon app was to do the filtering and weighing instead of the node-red node.

What a difference a chip makes! I was using a König CSBLUEKEY200 dongle and hcitool was not able to find my phone after the screen went off. Now with a Zero W it is trouble free! My phone was reported home all night while I was asleep :slight_smile: I have contributed some code on github to improve integration with the device_tracker through and Appdaemon app.

I just ordered a second Raspi Zero W to extend coverage. Nice work! :+1:

2 Likes

I am using a couple of raspberry pi 1 and 2 with Bluetooth usb dongles which I had dust collecting and the result is magic.

Top respect for a simple yet powerful solution which works very reliable even on old kit.

I have a wish, I would love to take a similar approach but the scenario is a little reverse. At the end of the driveway place a device which will tell me what Bluetooth it ‘see’ that are heading to the house. For example the car might have a Bluetooth enabled stereo, or a driver of passenger may have a phone etc.

From the spy timeline I could determine who the frequent visitors are and identify them as guests or visitors.

Is that possible of just silly

Cheers
Damian

1 Like

I’ll think on it!

Stopped working for me. Hcitool scan no longer returns anything, where lescan still sees BLE devices. This is on two nodes (RPi and a NUC), at least the Pi was initially working.

Any ideas what to check?

Lars

Might be worth adding to the scenario. About 10 years back I buried two cartell.com sensors in the entrance of the drive and they still work flawlessly detecting any transport from a bike to a truck letting me know that someone is approaching. This event could be used to trigger a Bluetooth scan for devices Telling me of family, guests and unknowns.

With some correlation I could then move the unknowns to visitors or guests status for preannouncement.

Have a great weekend
Damian

Nice project! Thanks @andrewjfreyer

Got it all up and running in no time on a PiZeroW thanks to your details instructions, I’ve started to experience the WiFi interference issues when I entered a MAC address incorrectly in the owner_devices config, I’m guessing because the device didn’t exist and the confidence was 0 that it started scanner at short intervals to find it… I noticed the WiFi interference when my Xiaomi GW and a few WiFi Bulbs dropped out - all on 2.4GHZ.

I’ll try and do some more testing tomorrow, it’s getting late and my eyes are square. :slight_smile:

1 Like

@badgerhome yes, this is a known issue that I’ve been working through. First reported by @eBoon, and confirmed by many others. I didn’t notice because most of my network is on 5GHz…

I have a workable solution (I think), but it is a near complete re-write. There’s a lot of testing to do :slight_smile: I hope that I’ll be able to push this in the next week or so.

For the time being, increase all then numbers in the behavior_preferences file to mitigate interference with 2.4GHz

3 Likes