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

What are you using -v for? try -b or -r for periodic scanning or -tad for triggered scans. use -u to set the new flags.

-r and -tdr are 2 separate flags -r or -b will scan continuously.

-r and -tdr are 2 separate flags -r or -b will scan continuously.

I understand that they are different flags. I was trying to confirm my use of the -tdr flag was doing what I thought it meant (scan for arrivals as normal and departure scans on trigger only). From reading the other comments the -r -td flags donā€™t work together. I had everything running perfectly in the past on a much older version of Monitor, when I replaced the SD card in the Pi ,it seemed to have broken my setup so I wanted to make sure I was using the correct flags. Then I can move on the trouble shooting something else. Thanks.

-b scans on any new ble advertisement. This would essentially be scan for arrivals only. Then -tdr will only make a departure scan when called. The r in -tdr is only needed if you have more than one node, as it relays the depart scan.

Thanks. Iā€™ll test with the -b flag.

@Mikefila I was using the -V to monitor the output of monitor. While running that the detection was working and when I stoped and started the service I would get no reading. Ive just set monitor to -r, will test to see if it keeps working. Thank you

Hi to all! First of all I want to say Thank you to developer of this awesome project. And I have a question. I have it installed on my Raspberry Pi 4, where Home Assistant is installed. Is that ok, that after starting ā€œmonitor.shā€ CPU load increases to 50-70% compared to 5-10% without it? I havenā€™t made any special confirmation, just added MQTT parameters to mqtt_preferences and two MAC addresses of my phones to known_static_addresses file. Thanks in advance!

Are you using the addon store version or did you install the script manually?

Installed manually from andrewjfreyerā€™s repository, using his instructions. Just cloned repo, start monitor script. It created config files, and I modify them to write MQTT settings and my MAC addresses. Thatā€™s all. I just didnā€™t made any sensors in HA, because I saw high CPU load and wanna fix it first

Is the bluetooth or wifi radio being used by anything? Monitor needs overall control of the module. If you ran just monitor and stopped HA is the cpu usage still high?

Are you running a supervised install of HA? You could try the add-on.

1 Like

No, I donā€™t use any Bluetooth things. Rpi is connected via Ethernet. Iā€™ll try to run it with Home Assistant stopped.

Iā€™m running HA Supervised. And I tried this addon also. Same behavior here

UPD: it works ok without Home Assistant, seems the problem is in it

Had this working perfectly for around a year now and mostly donā€™t even need to think about it! However every now and then one of my pi zeros stops reporting and need to be restarted. Pi is still online, seems monitor just crashes. Is there anyway of setting up a sensor in HA to check if the script is still running periodically so I can send myself a notification to restart it if it stops reporting? Thanks in advance

I noticed this too. I thought it was because of the updates I am doing for the pi zero, but that is not the case. I was thinking doing a reboot of the pi zero once a week via cron may help.

Iā€™m restarting monitor.sh every night. :slight_smile:

automation:
  - alias: 'Restart monitor.sh every night at 04:01am'
    id: 'Restart monitor.sh every night at 04:01am'
    initial_state: 'on'
    trigger:
      - platform: time
        at: "04:01:00"
    action:
      - service: mqtt.publish
        data:
          topic: dahoam/scan/restart
          payload: ''
2 Likes

If you publish monitor/echo all nodes will respond back ok. I use node red and publish that every minute then I listen for the response. Itā€™s sent to a sensor and I can see it on my dash.

I also have automations set so that if a node doesnt respond, it reboots that pi. You can use ssh and a shell command to reboot the pi if you exchange keys.

Thanks for the responses! I didnā€™t know you could essentially ping the nodes to see if they responded and I also didnā€™t know you could restart monitor over mqtt! Iā€™m going to try and implement the echo sensors and then restart the script over mqtt. Thanks again!

Can someone explain what is PREF_PASS_FILTER_ADV_FLAGS_ARRIVE? Does it work hand in hand with PREF_MINIMUM_TIME_BETWEEN_SCANS?

Is it possible to use Apple Airtag with monitor?

Did you ever solve your problem? I am seeing the same that after leaving I get three decaying confidence peaks that go back to over 90% and make me reappear home even after I left for a while.

Anyone has an idea why my confidence is coming back from the dead when I am gone for a while. I have two nodes (one close to the door running with -tr -x , one further away running with -tad -x). PREF_DEPART_SCAN_ATTEMPTS=7 if set lower I see more confidence revives

image

Thanks

IDK 7 seems like a lot. I use just one arrival and one depart scan. I had problems with this in general then I started using a monitor helper script that managed the nodes. It worked as expected then using 2 scan/depart calls.

Iā€™ve since rebuilt that script in node red. I was really able to pin down the exact times I needed to scan and now Iā€™m down to one. You really shouldnā€™t need to scan so many times.