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

I’m having trouble seeing any RSSI readings for my iPhone. I’ve paired with monitor and the phone works fine for presence but I can’t see any rssi readings? Whenever I pair it says connected and then shows as disconnected in the Bluetooth menu in my phone?

If I start this script with monitor.sh -tdr -a -b and later I reboot the raspberry pi, does the service automatically start on reboot with these options I last had? (ie. -tdr -a -b)

No, you need to update the service file you create.

hi guys,
I have a little annoyance. My wife has an iPhone I have a Samsung s10. Monitor always detects the iPhone faster than the Samsung, is there anything I can do to speed up the samsung detection?

(Aside from buying an iphone)

Buy a cool android phone with a real android like a Pixel? :crazy_face: :laughing: Sorry, couldn’t resist. :grin:

In what situations do you experience that behaviour? Normally you should run an arrival/departure-scan, triggered for example by a motion sensor or door contact. This should bring up both devices, as soon as they answer the request from monitor.sh. How long it takes the phone to answer this request is entirely dependent on the phone… :wink:

Maybe there is something you can change with your setup, but that would need a little more information to be answered. :slight_smile:

Hello gang! I’ve got monitor installed and running on two PIZWs. These are clean installs per the installation instructions in read.me and updated to latest on all packages. They work well, but the issue I’ve got is each will intermittently stop sending data. If I try to ssh into one that is not sending data, I’m unable to connect, though my router still shows it on the network.

However, the interesting part is that it will send a monitor/[location]/status offline message when it goes offline, so it’s obviously something monitor.sh itself sees. Has anyone seen this before or does anyone know what would trigger the send of the offline payload for the status topic?

Thank you very much for the help!

I’ve had that happen too, which is why I moved off the Raspberry Pi Zero to the Orange Pi Zero LTS. That’s been rock solid.

Thanks for the tip! I ordered one, but until it shows up I’ve been trying to do some troubleshooting, without much luck. I tried to turn off the RSSI monitoring/reporting to see if that makes a difference, but I’m not sure how to do that. I tried running monitor.sh -u to reset the flags, but it’s still reporting RSSI.

Is there a way to remove that functionality after one has already paired with the PiZero? Are logs stored on the unit? It definitely seems to be dying hard (I can’t even ping it) when it goes down, so I don’t have much to go on.

When i looked at the specs for the Orange Pi Zero LTS I couldn’t find Bluetooth. Was it a different Orange Pi that you use?

It has Bluetooth apparently (from some forum threads, part of the WiFi module), but getting it to work is fiddly. I have some CSR Bluetooth dongles from previous tinkering and stuck one of those on a USB extension cable to get it where I wanted.

Hi, I’ve decided to have a go at using monitor for presence detection. I’m configuring monitor with the Monitor-App and slowly trying to understand the various errors that I’m encountering.

It mostly seems to be working ok with the one monitor device I have at the moment, but for some reason it keeps detecting devices that aren’t in my known_static_addresses file, and publishing confidence levels for these via MQTT. (known_static_addresses is populated via Monitor-App)

My three devices in known_static_addresses are:

xx:xx:xx:xx:xx:9E mine
xx:xx:xx:xx:xx:15 wife
xx:xx:xx:xx:xx:53 daughter

Looking at the logs via journalctl -u monitor.service it shows the following for one of the unknown devices (it detects around 10 altogether):

[CMD-PUBL]        xx:xx:xx:xx:xx:40 SHIELD Unknown -100 dBm
[CMD-MQTT]        monitor/hallway/xx:xx:xx:xx:xx:40 { ... confidence : 100 ... }
[CMD-MQTT]        monitor/hallway/xx:xx:xx:xx:xx:40 { ... confidence : 48 ... }
[CMD-MQTT]        monitor/hallway/xx:xx:xx:xx:xx:40 { ... confidence : 43 ... }
[CMD-MQTT]        monitor/hallway/xx:xx:xx:xx:xx:40 { ... confidence : 26 ... }
[CMD-MQTT]        monitor/hallway/xx:xx:xx:xx:xx:40 { ... confidence : 0 ... }
[DEL-PUBL]        PUBL xx:xx:xx:xx:xx:40 expired after 257 seconds
[CMD-MQTT]        monitor/hallway/xx:xx:xx:xx:xx:40 { ... confidence : 0 ... }

My monitor options are:
monitor.sh -tdr -a -b

I suspect it’s the -b beacon option, so i’ll remove that for now and see how it goes.

Thanks.

My script currently crashes with the following message:

monitor.sh: line 955: Xiaomi Inc.: syntax error: invalid arithmetic operator (error token is “.”)

Is this a known issue?

I’m not super familiar with the script, but when it starts via systemd at bootup, does it write out a log to disk? If not, can someone point me to where it’s called so I can try to get it to write out logs to disk? I’d really like to try to help debug this if I can.

Thanks!
-Peter

journalctl is the command you need to get logs from anything running under systemd. For example:

journalctl -n 50 -u monitor

journalctl --since '06:00' -u monitor

man journalctl for more

Hi, all.

I’ve got monitor configured as sevice in a Raspberry Pi 4. In my house there’re 3 phones and a smart band (configured as beacon) and all of them are saved as known_static_addresses and known_static_beacons.

In my home assistant instalation there’s an automation that sends a scan/depart and scan/arrive based on a door sensor state. I’ve noticed that everyday the mosquitto topic number is growing (see image below).

Monitor command arguments:

-x -b -tdr

Result:

MQTT_Explorer_1HBf004GEe

Is that normal? How can I remove MAC addresses that don’t affect me? Any idea?

Thanks in advance.

@andrewjfreyer, I am in need of your’s or somebody else’s help again.

I have a well-working setup with Monitor running on 5 nodes (2xRPi0W, 1xRPi 2, 1xTinkerboard, 1xNUC) running with ‘-tadr -b’. It generally works for iPhones, but I have some oddity on beacons, which are initially detected fine, but never expires.

It’s some cheap RDL51822s, detected as GENERIC_BEACON_PUBLIC, but they stay with confidence=100 even though I remove the battery and wait for hours. I have PREF_BEACON_EXPIRATION=240 and would expect it to expire after 4 mins. Triggering DEPART scans via mqtt doesn’t seem to change anything either.

Any good advice on what to try next ?

Thanks in advance!

Where can I find those scripts? I stopped the service and disabled it. I also removed the folder but somehow my system is trying to activate the service again after rebooting my system.

Probably in /etc/systemd/ - or wherever your distro stores startup scripts :man_shrugging: It could be /etc/init/, or /etc/init.d/, or a number of other locations

1 Like

Thanks. I found it under /etc/systemd/system