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

I am having this same problem. Did you ever find a solution?

Thanks - appreciate the help.

So starting monitor with the -r flag does not make it automatically scan at regular intervals? Something else needs to trigger it? This is what I’m not understanding I think.

I tried another Pi restart and once again it appears to be working (I haven’t changed anything and now my phone is being picked up arriving / departing).

As things are, I would say it is not responding to my arrival particularly quickly. I’m usually well inside the house and definitely in BT range for up to a minute or 2 before I’m picked up.

Is that normal?

Is there a way I can improve this?

Phone is Samsung Galaxy Note 8 Android 9 if there are settings that need to be changed.

I’m trying to understand a few things here. I’d appreciate some clarity…

I have four devices configured in the static section of the configuration. From what I’ve read, if all four devices are “present”, then issuing an arrival scan won’t do anything, since they are all accounted for. Is that correct?

I thought the mqtt.publish topics were case sensitive. However, in the examples I’ve seen, people are using the lower case (arrival / depart). But, when I ‘execute sudo bash monitor.sh -V’ it shows the topics as monitor/device/DEPART etc. Does case matter?

I don’t understand the correlation between the service and the script. If I have monitor running as a service, what happens if I execute the script? Is there a way to tell that the service is running properly? Does it have any logging options?

I’m not seeing -r as a valid option, but my version of monitor is slightly old. The scan behaviour though is in the docs I’ve linked to, and I summarised it above :wink:

The problem is that scans won’t happen until something triggers it. Personally I use a sensor on the front door (as discussed by others way up in this thread) to trigger arrival and departure scans. That way if it didn’t pick us up on the approach (one node is by the front, covering the approach), it’ll pick us up then.

I’m interested in the rssi feature of monitor, but I have a few questions. I’m new to the concept of RSSI, so I’m trying to understand…

I would presume that monitor would triangulate a physical position (room) with a device by rssi levels. Is that how this works? According the the guide, I’m to run the script with the -c option to pair my phone with a node. Do I do that for each device and each node? How does Home Assistant know what rssi values match what room?

You may also enjoy this thread

Hi everyone, I tried this out a long time ago with several Pi-W and had it all functional but because I made mistakes with configuration it sort of messed up my 2,4 WiFi spectrum. I’m wanting to give this another try again, there was documentation on how not to mess up and was wondering if anyone has any hints on how to avoid it again :slight_smile:

EDIT: Looks like the problem still exists, and it’s not a Monitor problem, I realize that. I was hoping to put the W’s to good use!!! I suppose I can use the regular Pi I have.

Been using monitor for several years but for some time now it just started to be very unreliable and in the mqtt logs I see this.
Connecting and then disconnecting right after. Sometimes I’ve tried an run a “sudo bash monitor.sh -tad -u” and then it connects and updates the current status of my phone, but then disconnects. But sometimes works a couple of days after that anyway but last days it’s been totally off. Any idea how to troubleshoot/solve?

Imgur

Is anyone using RSSI for room detection, I can pair with my phone but then when I start monitor again I cant see any RSSI values and the bluetooth menu on my phone says not connected? Not sure if this is a silly question but can I use room assistant and monitor on the same pi?

Hi,
After a hiatus from this project I thought I’d try again.

I have 2 devices, an apple watch and a fitbit Ace 2

Running this I can see the fitbit device:

sudo hcitool lescan
AA:AA:AA:AA:AA:AA Ace 2

The Mac for my watch is DD:DD:DD:DD:DD:DD (found in its settings)

I have successfully added DD… to the known_static_addresses, and the confidence rises and falls with it’s presence. Fabulous

When adding AA to known_static_addresses I see this output (but no change in the topic)

===================================================

              *** BETA/DEV BRANCH ***

===================================================
> starting monitor.sh (v. 0.2.200)...
> removing web request caches
> warning: monitor.service not installed. Install service? (y/n)
n
> AA:AA:AA:AA:AA:AA confidence topic: monitor/pi/fitbit (has not previously connected to hci0)
> DD:DD:DD:DD:DD:DD confidence topic: monitor/pi/apple_watch (has not previously connected to hci0)
[-] 0.2.200 21-08-2020 07:11:50 pm [CMD-MQTT]	monitor/pi/fitbit { ... confidence : 0 ... }
[-] 0.2.200 21-08-2020 07:11:56 pm [CMD-MQTT]	monitor/pi/apple_watch { ... confidence : 100 ... }
[-] 0.2.200 21-08-2020 07:11:57 pm [CMD-NAME]	DD:DD:DD:DD:DD:DD Ace 2  Unknown
[-] 0.2.200 21-08-2020 07:11:58 pm [CMD-NAME]	AA:AA:AA:AA:AA:AA Apple Watch  Apple Inc
[-] 0.2.200 21-08-2020 07:12:30 pm [CMD-NAME]	DD:DD:DD:DD:DD:DD Ace 2  Unknown

When adding AA to known_beacon_addresses I see this output (but no change in the topic)

===================================================

              *** BETA/DEV BRANCH ***

===================================================
> starting monitor.sh (v. 0.2.200)...
> removing web request caches
> warning: monitor.service not installed. Install service? (y/n)
n
> DD:DD:DD:DD:DD:DD confidence topic: monitor/officebt/phill_watch (has not previously connected to hci0)
> known beacon: AA:AA:AA:AA:AA:AA publishes to: monitor/pi/fitbit
[-] 0.2.200 21-08-2020 07:14:16 pm [CMD-MQTT]	monitor/pi/apple_watch { ... confidence : 100 ... }
...
[-] 0.2.200 21-08-2020 07:19:40 pm [CMD-MQTT]	monitor/pi/apple_watch { ... confidence : 100 ... }
[-] 0.2.200 21-08-2020 07:19:42 pm [CMD-NAME]	DD:DD:DD:DD:DD:DD Phillip’s Apple Watch  Apple Inc
[-] 0.2.200 21-08-2020 07:19:43 pm [CMD-MQTT]	monitor/pi/apple_watch { ... confidence : 100 ... }
[-] 0.2.200 21-08-2020 07:19:44 pm [CMD-NAME]	DD:DD:DD:DD:DD:DD Apple Watch  Apple Inc
[-] 0.2.200 21-08-2020 07:20:09 pm [CMD-RSSI]	PUBL AA:AA:AA:AA:AA:AA RSSI: -73 dBm (initial reading | 127 dBm)

Any ideas?

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?