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

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.

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…

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

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

1 Like

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

@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.

1 Like

Pity pi 0 only comes with 2.4 ghz

This could be a solution

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:

2 Likes

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.

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:

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.

1 Like

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

I will give it a shot then, thanks @andrewjfreyer

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

I am using a similar script, and have it setup to trigger on state change of my Garage or Front door,

- alias: Monitor MQTT Departure
  trigger:
  - entity_id: binary_sensor.door_window_sensor_158d00027b3daa
    from: 'off'
    platform: state
    to: 'on'
  - entity_id: binary_sensor.door_window_sensor_158d000239432d
    from: 'off'
    platform: state
    to: 'on'
  action:
  - data: {}
    service: script.mqtt_depart

cool thank you… obviously really. what about the script please? does it contain “service: mqtt.publish”

As Ben’s doesn’t appear to? or maybe I am having an old man minute?

Nope that’s all you need, mine is the same, just different timings :smiley:

1 Like

so how does it cancel the depart script before it runs please?

Sorry you lost me there, cancel the depart script before it runs ?

You want the depart script to run when you open the door. If you are going away, it will detect your phone as not here, if you just open the door to greet someone, you will still be there, so the depart script wont return a 0 value.