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

Will do :grinning:. Thanks for the jump-start.

I has lots of trouble running wireless pi and bluetooth in parallel. Lots of times it was dropping the WLAN signal and had to reconnect to WLAN. I lost a lot of MQTT messages. Only solution was to bring rpi to ethernet connection. The only stable way I found to operate with bluetooth and network in parallel. (used a Raspberry Pi Zero W)

My behavior_preferences file seems to have been corrupted and each PI has a different file.

Is there a location for the entire default behavior_preferences file online I can reference?

These are the filters I’m using right now, they seem to work fine, however when an advertisement shows in the log as failed, it still expires and triggers the departure scan as seen in my last post. Unless I am misunderstanding the logs. thanks

EDIT Actually I’ve looked through the code and it does appear to be the case that RAND advertisements that don’t match the pass filters are still sent to the main loop and will be added to the random device log, eventually triggering a departure.

#ARRIVE TRIGGER FILTER(S)
PREF_PASS_FILTER_ADV_FLAGS_ARRIVE=".*"
PREF_PASS_FILTER_MANUFACTURER_ARRIVE="Apple|Google"

#ARRIVE TRIGGER NEGATIVE FILTER(S)
PREF_FAIL_FILTER_ADV_FLAGS_ARRIVE="NONE"
PREF_FAIL_FILTER_MANUFACTURER_ARRIVE="NONE"

Thank you.

I have read and tried many methods and combinations.

I have a very similar setup to Andrew with one “Master” on the Ground Floor and 2 “Slaves” on the upper floors. I am able to set up depart triggers with door sensors etc.

So, very basic questions

  1. What setting should the “Master” be set on? sudo bash monitor.sh -t???
  2. How should the “Slaves” be configured? sudo bash monitor.sh -t???
  3. Do I need to trigger an Arrival event or do the above settings on the Master look for BT on my phone when they come into range?

I am trying to reduce 2.4 interference with the optimal settings.

Thanks

Hans

EDIT: After reading the above I am pretty sure it should be like this:

Master: sudo bash monitor.sh/ -u -d -x -tdr
Slave: sudo bash monitor.sh/-u -td

Some here might be interested in triggering bluetooth scans on demand (not using Monitor, just Home assistant).

I found surprisingly few posts info about it?

Given that using the build in Bluetooth trackers added five minutes to the startup time on my HA install… I’ll pass :wink:

1 Like

How to stop rssi mesages? I’ve unpaired my device with Rpi but the messages are still being published to MQTT.

I’ve set this up but I’m seeing allot of 0 confidence level when the phone is proximal to the pie running it. I saw similar behaviour with the blue tooth tracker (until I extended the time before showing away option). Monitor is monitoring my Essential phone with Android Pi I think it might be just power saving. Is there something I can tweak to smooth this out. I’m parsing this thread but it is long. I have a feeling something is wrong bc it seems monitor is “shouting out to my phone” but it’s not answering every couple of minutes to save power? The left with the up and down graph is the phone at home not far from the Rpi

Has anyone had any experience with doing that, and if it mitigates the problem of the rPI hanging?

My two cents: I used to schedule node reboots and it brought me a new issue (not monitors fault). But if you schedule your reboots there is a chance that, when rebooted, your phone won’t be detected by monitor (due to it being turned off, out of reach, or a simple transient error). This can be as bad as whatever you have configured to happen. In my case, when my phone wasn’t detected it turned on the alarm system, not a nice way to wake up.

If possible, you could schedule your reboots at times that no one is home.

1 Like

Wait, what :astonished:? What are you running HA on to get 5 min start up time with BT?

Thanks for sharing this whole project, looks really cool.

How accurate would the be for room presence detection? I’m less interested in house-presence detection and more-so in room detection (think within 12ft = present, outside of that is away).

Would this be suited for that?

Pi3 - without it it takes 2 to 3 minutes

Just started using this, it’s very cool.

One thing I’m wondering about is are there any additional RSSI settings available? I’d really like to start using this as room presence detection, which means RSSI would be great. Sometimes when I run the script it reports RSSI, other times it doesn’t I’m not sure why. I’m using a Galaxy Note 9 as a test.

What setup is required to tune it to focus mostly on RSSI values in order to try to create room presence detection?

I tried posting a blank message to monitor/scan/rssi and that worked, I see in the ssh screen of my pi that it has the RSSI value. I don’t see this value posted on MQTT though, unless it’s on a different topic? I also can only get that work once every couple of minutes, is there a timeout of sorts and if so, can you set that in the preferences somewhere?

I’ve been experimenting with monitor for a few days now, and I can easily track our iPads and iPhones. Great work @andrewjfreyer, thank you! Of course this has opened my eyes to a hidden world of bluetooth devices all around me…

I have a handful of devices I can see, but don’t understand. If I ask for beacons with “-b”, I see a couple of devices like this: Described as beacons, and Apple devices, with public addresses, but they don’t respond to NAME requests (I gave this a fake name of unk3 to put it in the known_statics_addresses for now). I think I’ve accounted for all the known Apple devices in the house, so I’m not sure where this is coming from - this one seems to move around based on RSSI (varies between -60 and -90), but we’re not home…? What kind of device might this be?

  {
        "id":"5C:F9:38:D9:C4:09",
        "confidence":"100",
        "name":"unk3 ",
        "manufacturer":"Apple, Inc.",
        "type":"GENERIC_BEACON_PUBLIC",
        "report_delay":"0",
        "rssi":"-87",
        "observed_interval":"-1",
        "flags":"0x1a",
        "movement":"none",
        "oem_data":"not advertised",
        "hex_data":"03da00000000",
        "resolvable":"PUBLIC",
        "retained":"false",
        "timestamp":"Tue Jun 04 2019 12:37:23 GMT-0700 (PDT)",
        "version":"0.2.197"
     }

I know it’s early but I just watched Apple’s 2019 WWDC stream and there’s something in iOS 13 that’s supposed to stop the scanning of Bluetooth. I’m wondering about the impact to Monitor.

I’ll be upgrading my phone to IOS13 today - i’ll check my monitor tonight and report back

2 Likes

Initial testing suggests no difference. I’ll keep and eye out but i have both an IPhone7+ and IPad upgraded and they seem fine. I am getting lots of prompts on the phone for apps to use Bluetooth though

1 Like

Hi, I keep on getting “Unknown”.
[CMD-MQTT] monitor/pihole/juri_mi3 { ... confidence : 0 ... }
[CMD-NAME] CD:2C:00:00:00:00 juri_mi3 Unknown
The dongle I’m using is pretty old, bluetooth 2.0. Might not this be the reason,though. Somebody knows why it’s Unknown? Thanks! nb. yes the mac is modified

Stupid question - how do I get monitor to run with a specific flag permanently? Does it remember the last used flag on reboot etc?