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

Tried following the (kinda hard to follow) guide… but was stopped at this message which I get every time the script tries to publish anything to MQTT (which I can do manually)

[-] 0.2.150 27-04-2019 12:43:05 am [CMD-POST]   monitor/mon/40:98:AD:1C:44:D4
*** Error in `/usr/bin/mosquitto_pub': munmap_chunk(): invalid pointer: 0x7e94a7d7 ***
./support/mqtt: line 184: 17099 Aborted                 ( $mosquitto_pub_path -I 
"$mqtt_publisher_identity" $should_retain $mqtt_version_append $mqtt_ca_file_append -L 
"$mqtt_url$topic" -m "$message" 2>&1 )

I have the same error as Davst after following the guide and installing Monitor on Pi Zero W yesterday. When I was trying Monitor a few weeks ago on Pi 3, I didn’t have this issue.
Also, when I publish arrive scan, it won’t trigger the scan, though depart scan triggers. - Works if a known device is not home.

*** Error in `/usr/bin/mosquitto_pub': free(): invalid pointer: 0xbe99c87e ***
./support/mqtt: riadok 149: 12333 Aborted               ( $mosquitto_pub_path -I "$mqtt_publisher_identity" $mqtt_version_append $mqtt_ca_file_append -L "$mqtt_url$topic" -m "$message" 2>&1 )
1 Like

Might have solved this by reverting bakc to the commit on march 14th. everything after that seems to be broken.

git checkout 05500a8eb354a2db7302117124977490af5eaa4b

should help you as well.

2 Likes

yes, please open an issue on github and we will start working through this now.

Hi Andrew,

Just got back to this. it run for about an hour.

Here what I got - last few lines. I edited the Mac addresses with xx for security reasons.

`**************** ARRIVE/REJECT FILTER DEBUG **********************

btmon packet:

> HCI Event: LE Meta Event (0x3e) plen 40 [hci0] 31.201475

  LE Advertising Report (0x02)

    Num reports: 1

    Event type: Scannable undirected - ADV_SCAN_IND (0x02)

    Address type: Random (0x01)

    Address: 47:DF:13:F2:70:xx (Resolvable)

    Data length: 28

    16-bit Service UUIDs (complete): 1 entry

      Google (0xfe9f)

    Service Data (UUID 0xfe9f): 0000000000000000000000000000000000000000

    RSSI: -78 dBm (0xb2)

flag pass: only (.*)

mfcg pass: only (.*)

flag fail: not (none)

mfcg fail: not (none)

pdu filter: only (adv_ind|adv_scan_ind|adv_nonconn_ind|scan_rsp)

blacklist: false

type: RAND

mac: 47:DF:13:F2:70:xx

name: ???

pdu: ADV_SCAN_IND

type: ???

oem: Google

rssi: -78 dBm

flags: ???

hex: 0000000000000000000000000000000000000000

resolvable: RESOLVABLE

man: Google

time: 1556379589

***************** ARRIVE/REJECT FILTER DEBUG **********************

btmon packet:

> HCI Event: LE Meta Event (0x3e) plen 43 [hci0] 31.774109

  LE Advertising Report (0x02)

    Num reports: 1

    Event type: Connectable undirected - ADV_IND (0x00)

    Address type: Random (0x01)

    Address: 18:B4:30:64:36:xx (Non-Resolvable)

    Data length: 31

    128-bit Service UUIDs (complete): 1 entry

      Vendor specific (d2d3f8ef-9c99-4d9c-a2b3-91c85d44326c)

    Company: not assigned (46104)

      Data: 3064362202e9dd5a85

    RSSI: -79 dBm (0xb1)

flag pass: only (.*)

mfcg pass: only (.*)

flag fail: not (none)

mfcg fail: not (none)

pdu filter: only (adv_ind|adv_scan_ind|adv_nonconn_ind|scan_rsp)

blacklist: false

type: RAND

mac: 18:B4:30:64:36:xx

name: ???

pdu: ADV_IND

type: ???

oem: ???

rssi: -79 dBm

flags: ???

hex: d2d3f8ef-9c99-4d9c-a2b3-91c85d44326c

resolvable: NON_RESOLVABLE

man: not assigned

time: 1556379589

***************** ARRIVE/REJECT FILTER DEBUG **********************

btmon packet:

> HCI Event: LE Meta Event (0x3e) plen 43 [hci0] 31.800848

  LE Advertising Report (0x02)

    Num reports: 1

    Event type: Non connectable undirected - ADV_NONCONN_IND (0x03)

    Address type: Random (0x01)

    Address: 2B:78:60:8B:96:xx (Non-Resolvable)

    Data length: 31

    Company: Microsoft (6)

      Data: 010920025d78731da978db571c2a4e57414b50c9b556a83ae04bf7

    RSSI: -89 dBm (0xa7)

flag pass: only (.*)

mfcg pass: only (.*)

flag fail: not (none)

mfcg fail: not (none)

pdu filter: only (adv_ind|adv_scan_ind|adv_nonconn_ind|scan_rsp)

blacklist: false

type: RAND

mac: 2B:78:60:8B:96:xx

name: ???

pdu: ADV_NONCONN_IND

type: ???

oem: ???

rssi: -89 dBm

flags: ???

hex: 010920025d78731da978db571c2a4e57414b50c9b556a83ae04bf7

resolvable: NON_RESOLVABLE

man: Microsoft

time: 1556379589

monitor.sh: line 951: 0b00: value too great for base (error token is “0b00”)

pi@raspberrypi:~/monitor $`

1 Like

Thanks. I’ll investigate.

Although these logs don’t tell me a huge amount (unfortunately; thanks for providing them nonetheless), I think I have a reasonable explanation for the behavior you’re seeing. So, I made an adjustment in the beta branch and ran through these BTLE packets - each of these seems to pass just fine.

Please update to beta and let me know if you’re still experiencing continuing issues.

Thanks Andrew will update and advise. :grinning:

@andrewjfreyer Notable… I also was installing things on a RPi Model 3. Seems that might be a factor that me and @Tony321 have in common.

I reverted back to commit 05500a8eb354a2db7302117124977490af5eaa4b which solved things.

1 Like

thanks for the report. i have a spare 3 for testing.

So… both my Apple Watch and my girlfriends Withings Steel HR keep a solid 0% confidence… is there any way to track watches?

connect your AW to a bluetooth headphone so that they advertise. the HR monitor should probably be a beacon, so use the -b flag

@andrewjfreyer Doubt it is, unless beacons are 2-way. it handles notifications and such:

BT Pairing fixed the apple watch… beacons did nothing for the Steel HR though.

1 Like

have you run via command line with the -b flag? can you DM your verbose/flag debug logs?

Beacons can definitely be two-way (and/or trigger or facilitate a more traditional BT connection), but the point is more to the fact that the Withings watch likely does everything it can to save battery power.

Yeah that’s likely. Shame… she’ll have to keep her phone with her =)

1 Like

Hi Andrew,

I updated to the latest 0.2.186. and it still stopping.

I run it a few of times.

Last line now just says “Exited”. :frowning:

1 Like

@vin, @davst @Tony321 Best solution until mosquitto is updated is to revert to mosquitto 1.5.xx per here:

EDIT - fixed in mosquitto 1.6.2+

[REMOVED]

Will try.

Thanks Andrew.

1 Like

Can you shoot me a DM with a new set of logs so we can work through the stopping?