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

No, it’s the inverse. Note that the bluetooth hardware reports a negative value. The closer the RSSI is to zero, the closer you are to the BT hardware. The farther you are away, the “more negative” your number will be.

Really appreciate your time on this…I am not observing that. If you look at the attached screenshot.

  • The ‘top’ of the graph between midnight and 8am, is when I am in the bedroom which is one floor above the Monitor node.
  • 8am-9am is in kitchen…about 5m away.
  • After that I am in the study, within 3 feet of the Monitor.
  • That blip at 10am is when I moved our car.
  • At 11am is when I was in the garage, 10+m away.
  • From 11:30am - 12:30 I was back in study on a conference call.

So for me I get -99 when closer to the Monitor and towards 0 when further away. Is there a setting somewhere I got wrong?

As I wrote in the docs, RSSI is not a very reliable measure of distance. The reverse is also true - your distance to a monitor node is not a good predictor of RSSI. There are certainly some bugs to work out, but your -99s on the graph show when monitor cannot read an RSSI from your phone, whether you’re physically near or not.

Ok, understood. I’ll think I will add a PIR to the RPi in that room instead and use that for presence.

Hi, I installed the script on pi w zero with dietpi . Initially it works but after an hour or two I have no update on home assistant. What could be?
If a do a reboot it works again

There are a few open issues that may relate to this. I’m working them through trying to debug.

So i have been running monitor for a week now and its a hit and miss for me.
Setup:
Hassio on ubuntu server host
Pi Zero W with rasbian buster lite with Monitor installed trough the github installation page.

Run Monitor with sudo bash monitor.sh -tad -u and it picks up the devices i added to: known_static_addresses. Use HA device tracker route and get a nice tracker in HA to use with my automations.

So technically its working perfectly… Until i reboot my HA host… Now it looks like my automation cant trigger the mqtt arrive/depart message I got running in an automation used with my front-door sensor.

Automation:

  - alias: Monitor - Door Scan
    trigger:
    - platform: state
      entity_id: binary_sensor.xiaomi_door_sensor_1
      to: 'on'
    action:
      - service: mqtt.publish
        data:
          topic: monitor/scan/arrive
      - delay:
          seconds: 120
      - service: mqtt.publish
        data:
          topic: monitor/scan/depart

Devtools - mqtt and doing a manual monitor/scan/arrive or monitor/scan/depart doesn’t work neither.

Only way i can fix it is running the sudo bash monitor.sh -tad -u command on the pi zero again.

Any tips to fix this? I want it to scan when the front door opens and when HA restarts.

caaa is at {"id":"FC:58:RA:1B:28:B4","confidence":"0","last_seen":"1583500481","retained":"false","timestamp":"Fri Mar 06 2020 13:15:57 GMT+0000 (GMT)","version":"0.2.200"}

Just a query about the device_tracker preference, seems a bit odd to me, doesn’t seem to be working? Have I possibly given the config file the wrong topic?

asdasdas

I have installed Monitor on a RPi3, it is pushing messages to my MQTT broker which i have setup in a docker, however it appears that home assistant is not discovering the devices and adding them into the system. anyone run into this or have any suggestions?

I don’t believe monitor supports mqtt discovery. You will have to add them manually.

You can try my app @greenspace10 Home (Monitor) Presence App V2

awesome i will give it a try this evening! thanks!

Trying to get this setup with Home Assistant. From the monitor side (Raspberry Pi 4) it seems to always report a confidence of 0. Even though my phone has Bluetooth turned on and is within a few meters of the RPi. Any idea’s?

[+] 0.2.200 08-03-2020 08:43:34 PM [CMD-INFO]	**** started arrival scan [x1 max rep] **** 
[+] 0.2.200 08-03-2020 08:43:35 PM [CMD-SCAN]	(No. 1) xx:xx:xx:xx:xx:xx arrival? 
[+] 0.2.200 08-03-2020 08:43:40 PM [CMD-MQTT]	monitor/pimon1/alias
 {
    "id":"xx:xx:xx:xx:xx:xx",
    "confidence":"0",
    "name":"alias ",
    "manufacturer":"SAMSUNG ELECTROMECHANICSTHAILAND",
    "type":"KNOWN_MAC",
    "retained":"false",
    "timestamp":"Sun Mar 08 2020 20:43:40 GMT+0100 (CET)",
    "version":"0.2.200"
 }

Any update on this? I have monitor.sh running on a RPi 3B (buster), 3B+ (stretch) and 4B (stretch). Monitor stops working on all three in less than an hour. I am using monitor version 0.200. I have been running with the verbose flag, but not seeing any errors. The output of monitor just stops updating.

No update, as I can’t duplicate the behavior on my end. When you say “stops updating” do mean that monitor stops providing MQTT output no matter what happens? If you are expecting monitor to periodically send the same status, I’ll note that’s not intended behavior of the script.

Just wanted to quickly check if this works with Apple devices that randomize the BT macs?

It does with mine, at least if you pair the phone. I did that for RSSI reporting, not that I actually use that :man_shrugging:

I have been running monitor.sh from the command line with following command:

sudo bash monitor.sh -V

The output from that command stops in under an hour. I expected to see log messages for arrive and departure scans periodically, but eventually the output stop and my phone status no longer changes.

Thanks
Chris.

Have you tried monitoring the broker side of things? Sending verbose logs may be causing the issue inadvertently.

I tried using it via systemd with the default options and it has worked for over 24 hours. My issue seems to be with the verbose flag. Thanks for the suggestion. The only thing I see now is:

./support/btle: line 399: printf: write error: Broken pipe

However, it still seems to work even with this error.

Chris.

1 Like