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

Hi, no. But this was solved by actually setting up the -tad parameters as suggested everywhere :slight_smile:

Hello @andrewjfreyer,

Thanks for this.

I used the ~/echo as you suggested. With a single system it works great.

When I added another system, for some reasons it seems a loop is created in the system as the response of one, seems to be fed into another and it continues.

I can only stop it when I restart my system, and for now I had to reduce my system to one, as I use the echo for reliability.

Please can you look into this?

Kind regards

2 Likes

Hello:

Iā€™m running hass.io in a VM (no bluetooth adapter). Will this solution work for me?

I was thinking of buying x number of Pi Zeros and spreading them throughout my home. Iā€™m assuming the Piā€™s bluetooth will scan my iphones and send messages over WiFi to the hass.io VM? Is this correct?

Are there any special considerations that I need to consider?

Thx.

Yes. You install an MQTT broker (in your case, try the add-on) and point both Home Assistant and the installs of monitor at that broker.

The only special consideration is to take the time to read the docs :wink:

1 Like

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.