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

Awesome, pleased to hear you’re not forgetting about Android users :+1:. Will be keeping a close eye on this.

Hey that was a great find FYI !!!

I can simulate an apple beacon which also means I can now do this

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

for all the android users, you may want to give it a try
Thanks again @rwilco
FYI dont forget to go into settings and turn on “Broadcast Resilience”

1 Like

I have found another app that might shed some light on the Android situation, nRF Connect. Under Device Information there’s a section for Bluetooth low energy that list the phone capabilities. The item “Periodic advertisement supported” on my phone says “NO”. I’d be interested to hear from others if this is indeed an indicator if the phone will work out of the box with @andrewjfreyers excellent monitor service.

Yeah my oneplus 3 says the same thing. I wonder how accurate this app is

Mine says supported. I wonder how to turn on?

Edit: Seems like I got mine working.
LG ThinQ G7 android phone.
Settings -> Connected Devices -> File Sharing -> File Sharing ON.
Subtext for the option is "allow nearby devices to find your phone anytime via BLE to send you files

Sent an advertisement and was picked up by Monitor right away.

2 Likes

Excellent tip. I’ll add this to the FAQ.

Update on master & beta - 0.1.973

New feature:

• mqtt aliases - if you prefer to use something like “andrew’s phone” as the last topic path component for your mqtt confidence messages, see this FAQ.

1 Like

Mine does not pickup the mqtt_aliases

64:A2:F9:B5:69:73 Mattes OnePlus 6T
60:AF:6D:75:18:86 Asas Galaxy S6
00:1E:B2:3A:FB:5D LG TV

Mqtt output

kitchen/btmonitor_kitchen/64:A2:F9:B5:69:73 {"id":"64:A2:F9:B5:69:73","confidence":"0","name":"Matte ","manufacturer":"OnePlus Technology Shenzhen Co Ltd","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 10:27:37 GMT+0000 (GMT)","version":"0.1.973"}
kitchen/btmonitor_kitchen/60:AF:6D:75:18:86 {"id":"60:AF:6D:75:18:86","confidence":"0","name":"Asa ","manufacturer":"Samsung Electronics CoLtd","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 10:27:55 GMT+0000 (GMT)","version":"0.1.973"}
kitchen/btmonitor_kitchen/00:1E:B2:3A:FB:5D {"id":"00:1E:B2:3A:FB:5D","confidence":"0","name":"TV ","manufacturer":"LG innotek","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 10:28:08 GMT+0000 (GMT)","version":"0.1.973"}
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/00:1E:B2:3A:FB:5D {"id":"00:1E:B2:3A:FB:5D","confidence":"100","name":"TV ","manufacturer":"LG innotek","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 10:31:12 GMT+0000 (GMT)","version":"0.1.973"}
kitchen/btmonitor_kitchen/status offline
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/64:A2:F9:B5:69:73 {"id":"64:A2:F9:B5:69:73","confidence":"0","name":"Matte ","manufacturer":"OnePlus Technology Shenzhen Co Ltd","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 10:33:33 GMT+0000 (GMT)","version":"0.1.973"}
kitchen/btmonitor_kitchen/64:A2:F9:B5:69:73/rssi -99
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/60:AF:6D:75:18:86 {"id":"60:AF:6D:75:18:86","confidence":"0","name":"Asa ","manufacturer":"Samsung Electronics CoLtd","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 10:33:44 GMT+0000 (GMT)","version":"0.1.973"}
kitchen/btmonitor_kitchen/60:AF:6D:75:18:86/rssi -99
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/00:1E:B2:3A:FB:5D {"id":"00:1E:B2:3A:FB:5D","confidence":"100","name":"TV ","manufacturer":"LG innotek","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 10:33:49 GMT+0000 (GMT)","version":"0.1.973"}
1 Like

What does the monitor log say?

@mcfrojd - I fixed a small bug that presented if/when there was a blank line in the mqtt_aliases file. Please update to 0.1.974.

Thanks for the report!

Updated but still same…

Mqtt log in hassio

kitchen/btmonitor_kitchen/64:A2:F9:B5:69:73 {"id":"64:A2:F9:B5:69:73","confidence":"100","name":"Matte ","manufacturer":"OnePlus Technology Shenzhen Co Ltd","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 21:49:15 GMT+0000 (GMT)","version":"0.1.973"}
kitchen/btmonitor_kitchen/60:AF:6D:75:18:86 {"id":"60:AF:6D:75:18:86","confidence":"100","name":"Asa ","manufacturer":"Samsung Electronics CoLtd","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 22:18:28 GMT+0000 (GMT)","version":"0.1.973"}
kitchen/btmonitor_kitchen/00:1E:B2:3A:FB:5D {"id":"00:1E:B2:3A:FB:5D","confidence":"100","name":"TV ","manufacturer":"LG innotek","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 21:56:52 GMT+0000 (GMT)","version":"0.1.973"}
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/64:A2:F9:B5:69:73 {"id":"64:A2:F9:B5:69:73","confidence":"100","name":"Matte ","manufacturer":"OnePlus Technology Shenzhen Co Ltd","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 22:26:20 GMT+0000 (GMT)","version":"0.1.974"}
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/60:AF:6D:75:18:86 {"id":"60:AF:6D:75:18:86","confidence":"100","name":"Asa ","manufacturer":"Samsung Electronics CoLtd","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 22:26:30 GMT+0000 (GMT)","version":"0.1.974"}
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/00:1E:B2:3A:FB:5D {"id":"00:1E:B2:3A:FB:5D","confidence":"100","name":"TV ","manufacturer":"LG innotek","type":"KNOWN_MAC","retained":"true","timestamp":"Thu Feb 07 2019 22:26:50 GMT+0000 (GMT)","version":"0.1.974"}
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/64:A2:F9:B5:69:73 {"id":"64:A2:F9:B5:69:73","confidence":"100","name":"Matte ","manufacturer":"OnePlus Technology Shenzhen Co Ltd","type":"KNOWN_MAC","retained":"false","timestamp":"Thu Feb 07 2019 22:27:31 GMT+0000 (GMT)","version":"0.1.974"}
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/60:AF:6D:75:18:86 {"id":"60:AF:6D:75:18:86","confidence":"0","name":"Asa ","manufacturer":"Samsung Electronics CoLtd","type":"KNOWN_MAC","retained":"false","timestamp":"Thu Feb 07 2019 22:27:39 GMT+0000 (GMT)","version":"0.1.974"}
kitchen/btmonitor_kitchen/60:AF:6D:75:18:86/rssi -99
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/00:1E:B2:3A:FB:5D {"id":"00:1E:B2:3A:FB:5D","confidence":"100","name":"TV ","manufacturer":"LG innotek","type":"KNOWN_MAC","retained":"false","timestamp":"Thu Feb 07 2019 22:27:51 GMT+0000 (GMT)","version":"0.1.974"}
kitchen/btmonitor_kitchen/status online
kitchen/btmonitor_kitchen/00:1E:B2:3A:FB:5D {"id":"00:1E:B2:3A:FB:5D","confidence":"100","name":"TV ","manufacturer":"LG innotek","type":"KNOWN_MAC","retained":"false","timestamp":"Thu Feb 07 2019 22:28:25 GMT+0000 (GMT)","version":"0.1.974"}

Output when running sudo bash monitor.sh in the monitor pi

====================== DEBUG ======================
starting monitor.sh (v. 0.1.974)...
> removing web request caches
> removing public name cache
> preference: using default mqtt protocol version
> preference: minimum time between the same type of scan = 15
> preference: regex filter for flags to accept = .*
> preference: regex filter for flags to reject = NONE
> preference: regex filter for manufacturers to accept = .*
> preference: regex filter for manufacturers to reject = NONE
> preference: maximum sequential arrive scan attempts = 1
> preference: maximum sequential depart scan attempts = 2
> preference: selected HCI device = hci0
> mqtt trigger: kitchen/scan/ARRIVE
> mqtt trigger: kitchen/scan/DEPART
> 64:A2:F9:B5:69:73 publishes to: kitchen/btmonitor_kitchen/mattes_oneplus_6t_ (has previously connected to hci0)
> 60:AF:6D:75:18:86 publishes to: kitchen/btmonitor_kitchen/asas_galaxy_s6_ (has not previously connected to hci0)
> 00:1E:B2:3A:FB:5D publishes to: kitchen/btmonitor_kitchen/lg_tv (has not previously connected to hci0)
================== BEGIN LOGGING ==================
0.1.974 10:27:28 pm [CMD-RAND]  [passed filter] data: 68:6C:5D:13:16:3A pdu: ADV_SCAN_IND rssi: -70 dBm flags: none man: unknown delay: 0
0.1.974 10:27:28 pm [CMD-INFO]  **** started arrival scan. [x1 max rep] ****
0.1.974 10:27:29 pm [CMD-RSSI]  PUBL D0:03:4B:50:6B:E4 RSSI: -69 dBm (stationary)
0.1.974 10:27:29 pm [CMD-SCAN]  (No. 1) 64:A2:F9:B5:69:73 arrival?
0.1.974 10:27:29 pm [CMD-RAND]  [passed filter] data: 42:B4:0A:17:0C:DF pdu: ADV_IND rssi: -71 dBm flags: 0x02 man: unknown delay: 1
kitchen/btmonitor_kitchen/64:A2:F9:B5:69:73
 {
    "id":"64:A2:F9:B5:69:73",
    "confidence":"100",
    "name":"Matte ",
    "manufacturer":"OnePlus Technology Shenzhen Co Ltd",
    "type":"KNOWN_MAC",
    "retained":"false",
    "timestamp":"Thu Feb 07 2019 22:27:31 GMT+0000 (GMT)",
    "version":"0.1.974"
 }
0.1.974 10:27:33 pm [CMD-SCAN]  (No. 1) 60:AF:6D:75:18:86 arrival?
0.1.974 10:27:36 pm [CMD-RAND]  [passed filter] data: 28:96:D6:11:DA:9B pdu: ADV_NONCONN_IND rssi: -74 dBm flags: 0x1b man: Apple, Inc. delay: 8
kitchen/btmonitor_kitchen/60:AF:6D:75:18:86
 {
    "id":"60:AF:6D:75:18:86",
    "confidence":"0",
    "name":"Asa ",
    "manufacturer":"Samsung Electronics CoLtd",
    "type":"KNOWN_MAC",
    "retained":"false",
    "timestamp":"Thu Feb 07 2019 22:27:39 GMT+0000 (GMT)",
    "version":"0.1.974"
 }
0.1.974 10:27:42 pm [CMD-SCAN]  (No. 1) 00:1E:B2:3A:FB:5D arrival?
kitchen/btmonitor_kitchen/00:1E:B2:3A:FB:5D
 {
    "id":"00:1E:B2:3A:FB:5D",
    "confidence":"100",
    "name":"TV ",
    "manufacturer":"LG innotek",
    "type":"KNOWN_MAC",
    "retained":"false",
    "timestamp":"Thu Feb 07 2019 22:27:51 GMT+0000 (GMT)",
    "version":"0.1.974"
 }
0.1.974 10:27:54 pm [CMD-INFO]  **** Completed arrival scan. ****
0.1.974 10:28:20 pm [CMD-RSSI]  PUBL D0:D2:B0:8B:3E:48 RSSI: -92 dBm (stationary)
0.1.974 10:28:20 pm [CMD-NAME]  64:A2:F9:B5:69:73 Mc6T  OnePlus Technology Shenzhen Co Ltd
0.1.974 10:28:20 pm [CMD-RSSI]  PUBL D0:03:4B:50:6B:E4 RSSI: -70 dBm (stationary)
0.1.974 10:28:21 pm [CMD-NAME]  60:AF:6D:75:18:86 Asa  Samsung Electronics CoLtd
0.1.974 10:28:21 pm [CMD-RAND]  [passed filter] data: 0E:80:F3:62:F1:D7 pdu: ADV_NONCONN_IND rssi: UKN dBm flags: 0x1b man: Apple, Inc. delay: 41
0.1.974 10:28:21 pm [CMD-INFO]  **** started arrival scan. [x1 max rep] ****
0.1.974 10:28:21 pm [CMD-SCAN]  (No. 1) 00:1E:B2:3A:FB:5D arrival?
0.1.974 10:28:25 pm [CMD-NAME]  00:1E:B2:3A:FB:5D 50PS8000-ZA  LG innotek (x2)
kitchen/btmonitor_kitchen/00:1E:B2:3A:FB:5D
 {
    "id":"00:1E:B2:3A:FB:5D",
    "confidence":"100",
    "name":"TV ",
    "manufacturer":"LG innotek",
    "type":"KNOWN_MAC",
    "retained":"false",
    "timestamp":"Thu Feb 07 2019 22:28:25 GMT+0000 (GMT)",
    "version":"0.1.974"
 }
0.1.974 10:28:25 pm [CMD-INFO]  **** Completed arrival scan. ****
0.1.974 10:29:39 pm [CMD-RAND]  [passed filter] data: 5D:81:10:29:D1:70 pdu: SCAN_RSP rssi: -70 dBm flags: none man: unknown delay: 0
0.1.974 10:29:39 pm [CMD-INFO]  **** started arrival scan. [x1 max rep] ****
0.1.974 10:29:39 pm [CMD-SCAN]  (No. 1) 60:AF:6D:75:18:86 arrival?
0.1.974 10:29:41 pm [DEL-RAND]  RAND 0E:80:F3:62:F1:D7 expired after 80 seconds
0.1.974 10:29:41 pm [CMD-INFO]  **** started departure scan. [x2 max rep] ****
0.1.974 10:29:41 pm [CMD-SCAN]  (No. 1) 64:A2:F9:B5:69:73 departure?
0.1.974 10:29:41 pm [CMD-NAME]  60:AF:6D:75:18:86 Galaxy S6 edge  Samsung Electronics CoLtd
kitchen/btmonitor_kitchen/60:AF:6D:75:18:86
 {
    "id":"60:AF:6D:75:18:86",
    "confidence":"100",
    "name":"Asa ",
    "manufacturer":"Samsung Electronics CoLtd",
    "type":"KNOWN_MAC",
    "retained":"false",
    "timestamp":"Thu Feb 07 2019 22:29:41 GMT+0000 (GMT)",
    "version":"0.1.974"
 }
0.1.974 10:29:41 pm [CMD-INFO]  **** Completed arrival scan. ****
0.1.974 10:29:44 pm [CMD-SCAN]  (No. 1) 00:1E:B2:3A:FB:5D departure?
0.1.974 10:29:50 pm [CMD-INFO]  **** Completed departure scan. ****
1 Like

Huh. Not seeing that at all on my end. I’ll continue investigating.

Once again, this was a result of me being stupid and testing/releasing too fast. Sorry! There was an undocumented flag that you had to enable that I have now removed.

Should be working now.

Hello,

I am not sure at all, but can I use Monitor with Hassio, or it’s only for raspbian/home assistant ?

Thanks,

There we go, now its working.

Edit…
I get an extra underscore on 2 devices:
mattes_oneplus_6t_
asas_galaxy_s6_
But not on the last one in the mqtt_aliases file.
(there are no extra spaces at the end of those row’s in the file)

64:A2:F9:B5:69:73 Mattes OnePlus 6T
60:AF:6D:75:18:86 Asas Galaxy S6
00:1E:B2:3A:FB:5D LG TV

mqtt output:

kitchen/btmonitor_kitchen/mattes_oneplus_6t_ {"id":"64:A2:F9:B5:69:73","confidence":"0","name":"Matte ","manufacturer":"Unknown","type":"KNOWN_MAC","retained":"true","timestamp":"Fri Feb 08 2019 12:02:34 GMT+0000 (GMT)","version":"0.1.981"}
kitchen/btmonitor_kitchen/mattes_oneplus_6t_/rssi -99
kitchen/btmonitor_kitchen/asas_galaxy_s6_ {"id":"60:AF:6D:75:18:86","confidence":"0","name":"Asa ","manufacturer":"Samsung Electronics CoLtd","type":"KNOWN_MAC","retained":"true","timestamp":"Fri Feb 08 2019 12:02:58 GMT+0000 (GMT)","version":"0.1.981"}
kitchen/btmonitor_kitchen/asas_galaxy_s6_/rssi -99
kitchen/btmonitor_kitchen/lg_tv {"id":"00:1E:B2:3A:FB:5D","confidence":"0","name":"TV ","manufacturer":"LG innotek","type":"KNOWN_MAC","retained":"true","timestamp":"Fri Feb 08 2019 12:03:07 GMT+0000 (GMT)","version":"0.1.981"}
kitchen/btmonitor_kitchen/lg_tv/rssi -99

You can actually use it with any automation system as it uses MQTT to report its states. I’m using it myself with Hassio, so no problem :slight_smile:

2 Likes

Hmm. Interesting. I’ll investigate

I think there must be some odd whitespace here - I couldn’t duplicate the issue. However, I’ve added a scrubbing line that will prevent leading or trailing underscores.

This might have been my problem:

Should be:

1 Like

Im trying to blacklist some devices which are just generic things around the house/next door that dont need tracking, but am struggling.

Ive edited the address_blacklist file, and when I run monitor I can see

blacklisted device: 4C:65:A8:DC:48:5F
blacklisted device: 18:B4:30:EA:A8:7F

But then Im also getting very regular mqtt notifications on both these mac addresses

monitor/hallway/4C:65:A8:DC:68:5F
 {
    "id":"4C:65:A8:DC:68:5F",
    "confidence":"100",
    "name":"",
    "manufacturer":"Unknown",
    "type":"GENERIC_BEACON_PUBLIC",
    "report_delay":"0",
    "rssi":"-81",
    "flags":"0x06",
    "movement":"stationary",
    "retained":"false",
    "timestamp":"Sat Feb 09 2019 12:05:30 GMT+0000 (GMT)",
    "version":"0.1.985"
 } 

Im unsure what Im doing wrong here??

Running v. 0.1.985

1 Like

Ill check into this. Thanks for the report.

Thank you.
I am new to monitor and mqtt, so it could be something simple. But i think ive covered all angles