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

I only trigger depart scans. Arrive scans are all triggered by advertisements.

Thanks for the answers !

Iā€™m have follow up regarding your answer to (2) and (5). I admit that sometimes I observe ~10 seconds lag in my solution that keeps scanning constantly with hcitool cc <bdaddr>; hcitool auth <bdaddr>. I must check whether triggering these scans on ā€œrandom advertisementā€ from a phone will help here.
What Iā€™m looking for is reliable and secure arrival detection that should be more less instant (up to 2 seconds). The additional delays or using just a single BT device for scanning multiple MACs arenā€™t likely to be instant. Out of curiosity - given all the machinery you have arenā€™t you annoyed with the need to pull out the phone from the pocket to ACK the notification to open the door ? For me this defeats the purpose - my wife would not approve :slight_smile:

Do you have any good pointers to read regarding interference, error detection and other good stuff that youā€™ve brought up ?

The actionable notification hits my watch as Iā€™m walking up to the front door, so itā€™s not a big deal. Iā€™d rather know that the door opens only in response to an action. Iā€™d hate to have an HA update or a power outage or some other thing cause my doors to unexpectedly unlock.

As an aside, I think itā€™s interesting that youā€™re concerned with mac spoofing, but not concerned about your door unlocking due to an unforeseen circumstance! :slight_smile:

1 Like

@andrewjfreyer, thanks for looking into this - itā€™s really puzzling me why the Nut 3 mini and Apple Watch 4 isnā€™t handled correctly. Let me know if you need me to test anything.

Given that HA can already unlock my front door Iā€™m not sure whether having explicit trigger based on BT presence detection introduces that many new potential door unlocks. Obviously spurious BT detection is a new thing, but the other stuff youā€™ve mentioned is present regardless whether door is auto unlocked based on BT presence.
Due to that Iā€™ve employed additional security measures:

  • notification re. door unlock and lock getting stuck using 2 notification channels (hangouts and automate)
  • auto door locking after short timeout (assuming door has not been opened) that works even under power outage

Iā€™m curious whether you have particular unforeseen circumstances in mind. In general I think that having reliable system, reliable monitoring and notification mechanism is a generic solution to these concerns, however HA does not really provide it yet, hence custom solutions need to be employed.

1 Like

I wonder if I stop attempting to track iTags and ONLY try to track mine and my wifeā€™s iPhones the bluetooth interference might drop significantly. I was using iTags as a backup for if an iPhone battery went flatā€¦but if thatā€™s not compatible with my 2.4Ghz environment maybe iPhone only will work for me.

1 Like

I am also getting these, after a bit of testing it seems like it only happens when a run with a flag, such as -g. However the script keeps running and after a bit it reports again.
I would be happy to provide logs and more info to andrew for debugging if possible.
Edit: I spoke too soon, monitor goes offline after a while. Will try to run without flags to see if that helps.

Beacons do not trigger scanning at all unless you have phones or other devices in your known static addresses file. If anything, using iTags only will reduce interference further.

Hey @andrewjfreyer so after a few days testing, it seems that with three MACā€™s added in, and when two of them arenā€™t here, I am back to experiencing wifi interference again :frowning: It nowhere near as much as with Presence, but itā€™s is there

kitchen%20tablet

This tablet is directly under my access point, but also directly in the middle of the two Piā€™s coverage, not sure if that makes a difference. When I only had my MAC added, it was connected for almost 24 hours straight.

Any suggestions to help reducing interference for when two or more devices are away ? I am currently just running both Piā€™s with default settings as advised.

Many thanks in advance.

2 Likes

Itā€™s a funny one, this. Some networks (like mine and yours) seem to be massively affected by the Piā€™s scanning and others donā€™t notice any difference at all.

Door sensors to trigger depart scans is the best way to decrease the frequency of scans. For arrive scans, Iā€™m still investigating ways to decrease scan timing.

3 Likes

Thank you for the reply sir, I saw someoneā€™s script above somewhere that had some timers, and depart scanā€™s setup in it, will investigate into it. I guess I will have to change some flags on the setup then ? Two Piā€™s one main that will notice the arrivalā€™s, and also the departs, second one to just extend range to back of the garage, and my bedroom.

Hi,
Just an FYI here after some local testing and frustration. The iBeacon reporting only works in 0.1.673 / 0.1.675 (not sure why one of the piā€™s havenā€™t updated) when you use the option b by itself. They get ignored when you try and run meb as the options.

I wrote here last week regarding some unreliable results. I have a small apt but due to thick cement walls the phone sometimes drops to 0% confidence. You asked me if I had a door sensor. Which I donā€™t. But I just realized I got a motion sensors pointing at the hallway door. So could I use that in the same sense and trigger a departure scan only when motion is detected and no time else? And if so, can this be done within Node red with the mqtt node?

Thanks once again!

1 Like

Yes, that can work just fine with either HA or in Node Red.

I think I have this correct setup. Does this seem right?

So if that is correct, next step would be to disable departure other than node red/motion sensor. Do I just set PREF_DEPART_SCAN_INTERVAL= to a really huge number or whats the correct method?

No, thatā€™s not quite right. Unless you have defined your $mqtt_topicpath variable to be rpizero/monitor The topic should be monitor/scan/depart and the payload should be blank (for your purpose).

Then youā€™ll launch monitor with the flag -td.

1 Like

Thanks! Iā€™ve implemented this. I had an issue when ā€˜real lifeā€™ testing in that only one of my instances reported 0% the other instance remained at 100%.

I think this may have been caused by multiple door openings and closings prior to leaving so I put another script in-between the automation and this script which restarts the script incase its already running.

Right now when my door opens I call
Script.cancel
When my door closes
Script.turn_on

I also call
Location/scan/restart

Just in case,. For my own sanity

https://n-o-d-e.net/nano_server.html

3 Likes