[Monitor] Reliable, Multi-User, Distributed BT Occupancy/Presence Detection

mqtt
automation
Tags: #<Tag:0x00007f480b5d3f68> #<Tag:0x00007f480b5d3658>

#587

The developer made a lot of effort to program it in such a way that the wifi interference is reduced drastically for such kind of an application


#588

This is an awesome project, but unfortunately doesn’t work for me. For whatever reason, it creates a ton of interference like an older Bluetooth tracker project did with Raspberry Pi Zero W’s. Its mostly noticeable on my Harmony remote hubs. Using the basic remote control they give you, anything that is IP controlled is extremely laggy. For example, watching Roku, navigation gets delayed by a few seconds at a time. If I shutdown the RPi running this script (which is in the basement directly below the area I’m in), response time immediately gets better. Previously, I had one RPi in my detached garage and had similar degraded performance for two Ring cameras located out there. There is really no other good setup for this in my house to make this work and avoid the interference. I really do appreciate the hard work put into this project though.

EDIT: Just for clarification, I loaded a fresh version of Raspian Lite and installed this script per the instructions provided on the GitHub page. I placed it at least 15 feet from any wifi device too, facing out toward my driveway. Running an Ubiquiti EdgeRouter4 with 3 different UAP’s (1 on each of the house and 1 in the garage).


#589

im using a onePlus 3 and my phone has worked with this project without having to pair anything


#590

really? I have a harmony hub and I am currently using 2 Pi’s and my remote seems to work just fine.

What settings are you using? Maybe there are too many bluetooth advertisements around you. I things @andrewjfreyer added a way to blacklist some macs that may be in your environment that do not need to be detected.


#591

Basically default settings other than MQTT server and a few phones in the known devices file. I had the same exact issue before with another python script that did the same thing (not nearly as involved though). I can ‘sudo systemctl stop monitor’ and see my responsiveness come back immediately on my Harmony. I have another that is within eye sight (downstairs, fairly close to the RPi) and when I run monitor (or equivalent), I can even see the light going green to red to green etc. as if its losing wifi temporarily. I have a lot of Google Homes, 3 phones (1 per person), and some laptops and tablets. I wouldn’t say I’m an out of ordinary use case. I live in a single family home on 1/2 acre in a somewhat private street. House was built in the 60’s, so older, but no metal walls or anything crazy. My Unifi wifi is all upstairs away from the RPi’s as well. Its very reproducible in my house, but could be related to the environment.


#592

This thread (yes it is long!) has a number of other people saying the wifi interference is a real problem, others say not so much. It is hard to discern any pattern, but I haven’t paid as much attention as some others have. A read of the whole thread might prove useful. It’s a bit of a slog though.


#593

Is there anything you think that could be making a difference? Could it be the rpi zero malfunctioning? Mine on default settings doesn’t seem to catch any random advertisements…


#594

Has anyone just for the test tried other hardware? Rpi3 or something. Perhaps the chip on pi zero is low quality, it is a very low priced device


#595

yep I tried an RPI3, on wifi 2.4g network dies, change to LAN, it is back. I have the same problem is using hassio on a rpi3 and BT tracker… so it isn’t just Monitor that causes this issue


#596

No this is a hardware problem. Would be interesting if someone could test with another brand SBC


#597

@yuran, @markR’s answer is correct - this is not an issue limited to monitor, or to any particular Bluetooth hardware. The spectrum used by 2.4Ghz Wi-Fi overlaps the spectrum used by Bluetooth v2.1. As a result, Bluetooth interferes with 2.4GHz Wi-Fi and vice versa. We notice Wi-Fi slowdowns because the data rate of Wi-Fi is substantially higher, meaning Wi-Fi’s tolerance to noise is much lower.

The interference caused by monitor, presence, and other similar scripts (like BT Tracker) is related to repeated Bluetooth name requests. These special requests do not require pairing, which is a huge advantage for these scripts. But, this “feature” also means that a specified channel of communication (i.e., a specific allocation of 2.4GHz spectrum) is not previously negotiated between the Bluetooth hardware making the request and the target of the request. As a result, the hardware making the request has to iteratively scan different channels. In short, name requests take a large bandwidth.


TL;DR - Bluetooth interference will be caused by any bluetooth hardware because bluetooth and Wi-Fi spectrum overlap. To entirely mitigate the interference issue, reduce the frequency of name scans or switch to 5GHz Wi-Fi. Switching bluetooth hardware will not make a difference.


#598

Pity pi 0 only comes with 2.4 ghz


#599

This could be a solution


#600

Nice reply Andrew thanks. This is exactly the reason why I am buying another 5 port hub to cable a RPi3 and zero instead of wifi, so I can use the BT tracker, then use eventstream to the main HA host.

This way I can trigger Monitor to do arrival scans… I hope :smiley:

I did see much more interference running bluetooth tracker than I ever saw with Monitor alone, just a pity my phones don’t appear to advertise… (I know old ground) :slight_smile:


#601

be interested to hear your results. I have a spare Pi3 now I have moved over to Docker, so might have a play around with that wired instead of the two ZeroW’s I have at the moment.


#602

I just had a wired mini usb dongle arrive for a pi zero as well. I have BT on the NUC passed through to the HA in a docker, which works perfectly as well… until it just stops after an few hours… might be Linux Mint, so need to investigate that as well… this never ends :slight_smile:


#603

I am thinking of tracking my Garmin smart watch’s BT for presence detection instead of relying on my phone. Should this approach work with monitor or is monitor only meant for iOS/Android/Beacon devices?

I am currently using monitor with an iPhone X and a Sony Android which is working well for both but I prefer using a watch since it is always on me while the phone might not.


#604

Should work fine if Garmin hasn’t done anything strange with their bluetooth implementation.


#605

I will give it a shot then, thanks @andrewjfreyer


#606

with your depart script, how are you calling it please?

and how are you cancelling the depart script before it runs? :slight_smile:
can you post the action of the automation?

Cheers
Mark