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

I’ve followed the instructions but am getting an error with the bluetooth status

I also get that error, but it is working fine anyway!

Same here, I get the error but works fine.

ok thats good, I still get unknown for my mqtt sensors. Is there a variable to set mqtt server port?

It’s just a one-liner in /etc/init.d/ like this:

`sudo bash /path/presence.sh &

I’ll post the actual one I use if this isn’t clear enough. You’ll have to update defaults

Shouldn’t be an issue, especially since the Bluetooth drivers were updated.

You can edit the mqtt_publish function to specify a port.

looking at my broker messages and I can’t see one from the BLE tracker which explains the ‘unknown’ state I’m getting for my sensors.

1 Like

The next version has much better BTLE tracking.

3 Likes

Tease! C’mon - share the love.

:slight_smile:

I run your script, on rasberry pi zero with BLE beacon scanning. The script was blocking after a while (couple hours maybe). I changed “timeout --signal SIGINT” for “timeout --signal 9”… and it’s look smoother…

The confidence is not implement for BLE beacon ?
I got a some false negative, but few second later, the beacon is detect… with the confidence mechanism, it would be much better, and accurate. I will try to fork the script, and implement it… if someone did it on it own, raise your hand. :man_technologist::raised_back_of_hand:

1 Like

Thank you for the great script.

I have a problem with my iphone.
The confidence stays at 0 until i’m doing a bleutooth search, then its 100. A minute later its going down to until it hits 0.

anybody?

Hmm. That’s odd unless you’re turning your bluetooth on and off on your phone. Do you have an older iPhone?

Can you insert zero W into the SD card after you install the boot successfully, unable to enter the configuration WiFi? Connect the monitor and see that the interface has been cycling.:困:

Zero w connects the display screen to see infinite loop start.

What OS are you using to create the SD Card, we’ll then be able to give you the right pointers to carry out steps 4 & 5 in the instructions

Its a iPhone 7, Monday I gonna test it with a iPhone SE.

Hy Andrew, can you check a look. I rewrite your script in Python, with a yaml config.
It’s raw, no documentation is ready yet, and somes bits is hardcoded… but it’s a first step.
I implement confidence with BLE, and use “-9” signal instead SIGINT for the timeout. I will tested it in the next days.

4 Likes

Thanks again for sharing. This is one of the best sharing so far. Please forgive my question again:
My hassio = IP: 192.168.120.2,
Mqtt host 192.168.120.2, username: mqtt password mqtt, port: 1883
Pi zero w = IP 192.168.120.232.
Step 10: Steps: nano mqtt_preferences
What do I need to fill in? The following is my fill,
Mqtt_address=“192.168.120.2”
Mqtt_user=“MQTT”
Mqtt_password = “MQTT”
Mqtt_topicpath = “Location”
Mqtt_room = “kitchen88”
Is it correct? ?

Step 11:

Nano owner_devices

And added my iphone bluetooth address

78:9F:70:82:74:1E
save,
Is it correct?

Finally in homeassistant, sensors.yaml

Hi, I found that I probably installed successfully, thanks.
Now set up a mobile phone Bluetooth mac address, found that away from home = 0%, at home 100%, but at home I turn off the mobile phone Bluetooth and found homeassistant still shows at home 100%, will not become 0%, has been maintained.
Does this mean that the mqtt sensor responds very slowly?
It is much slower than the mqtt pir body sensor.