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

I’m having a similar situation to something I experienced in a past beta.
My iBeacon tag is found by both MAC and UUID addresses; however, it only publishes UUID when confidence goes down.

Make sure to set source type to bluetooth :slight_smile:

2 Likes

That’s nice, but what about when you have multiple monitor? If the room are near it will say home to all of them

I also hope someone makes it easy to have room detection, since having different rssi values the component could say in which room the phone/beacon is based on the highest rssi value (I am trying to do it myself, but so far its a mess, I am not good enough in templating/programming)

In my (standard) settings I receive either 0 or 100 in the confidence value, the only variable level is rssi. Do I have to set some settings to have a variable confidence level?

I will try to use these, to avoid having Unknown state after restart. Still trying to figure out all the implication of such command, I have more simple/newb linux question, how do I run automatically the above command, so that is performed after each restart/reboot of the pi ?

@andrewjfreyer I setup the new variable PREF_DEVICE_TRACKER_REPORT but I’m finding that the individual sensors are reporting correctly Home or Away while the person: (2 device_tracks per each person) is actually reporting home and not_home. Not sure if this is something wrong with the new person feature or monitor?

52

Make sure all your sensors are on the latest version, do a git pull to be sure. Else, I’m guessing this is a display issue since monitor does not capitalize “Home” and does not send a status of “Away” as of the most recent version.

Yes, I only have 1 monitor running and it’s on version 0.2.022

Top 4 sensors are the MQTT ones from monitor and they look fine (Home and Away), it’s when I create the person that it looks incorrectly :thinking:

1 Like

Seems like the Confidence idea is better. Using device_tracker and person as soon as one of those devices doesn’t respond will turn your person to away. Rolling back to Confidence for now :smiley:

well technically you just need to run it once. I do -d to go to the default configs when I update and -u will update the service file. So technically I only need -x and -tdr. But when I call a restart it automatically uses -x and -tdr as that is what -u writes to the systemctl file.

type this in the terminal

cd ~
cd monitor

you should now be in the monitor directory

run this once (type in terminal)

sudo bash monitor.sh -u -d -tdr -x

This should write to the service file. to confirm this. go back to the terminal and type this

nano /etc/systemd/system/monitor.service

you should see something like this

[Unit]
Description=Monitor Service
After=network.target

[Service]
User=root
ExecStart=/bin/bash /home/pi/monitor/monitor.sh -tdr -x &
WorkingDirectory=/home/pi/monitor
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target network.target

once you restart the settings should stay the same. if they DONT than type this.

sudo systemctl enable monitor.service

3 Likes

Great thanks a lot. Updated all my 4 pi!!
Now I should never get confidence “Unknown” value i suppose.
Now need to understand why the value is only 0% or 100% (never in between) , or is this how it should be?

1 Like

@andrewjfreyer great component!

Have you thought of doing a monitor server? Now I have 4 monitor instance, probably planning to put more (like 6-7 in total) will start to be tough to keep everything updated, and adding known devices is time consuming and easy to make errors. Would be cool to have a monitor server on a host and then monitor client on each listening device

1 Like

@andrewjfreyer great work!

Was wondering how to delete a pairing between iPhone and a raspberry pi.

monitor.sh -c

I realize right now I don’t need RSSI (or want to deal with RSSI threshold tuning in behavior_preferences just yet) over just confidence values. Is it as simple as going into iPhone / Bluetooth and choosing “Forget this device”? Or is there anything else I need to do on the pi-zero-w side?

Thanks!

1 Like

Confidence will fall very fast, and won’t be visible in this time scale. You can see the fall in confidence in the monitor log.

Yes, I’ve considered this. Have to be careful not to add to installation complexity, but I have a few ideas.

I’ll write instructions for forgetting a device into the Readme this weekend. Thanks for pointing out that this isn’t clear!

Here’s one method. Open an ssh session and type:

bluetoothctl

To remove a device, type:

remove aa:bb:cc:dd:ee:ff

2 Likes

I am noticing when there are scans that my WiFi smart light switches drop their WiFi for a second and reconnect. Has anyone else seen this?

Known issue with interference caused by the bt/wifi radios on the raspberry pi zero. If the interference is intolerable, a bluetooth dongle or wifi dongle can help.

Thanks… So a WiFi donggle will work as well? How will that work with monitor as it won’t see BT macs? Would it instead see WiFi macs?

The issue appears to be mostly when WIFI and bluetooth are operated together, so a wifi dongle or a bluetooth dongle has been helpful to other users.