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

Cool. Thanks for the tip. I have been checking the filter platform out. Looks handy.

I’m not sure about the raw confidence readings though. They are very volatile now for some reason. They went from being fairly stable yesterday while things were stationary but today they are changing every few seconds and they vary a lot - anywhere from 0 to 100 with jumps of 20-50% at a time - even if the beacons are stationary and near the Pi Zero. Right now I have all the beacons sitting next to each other about 3m from the Pi Zero. Two are reading 100% and the third is reading 0%…

I am now on the beta 0.2.002.

1 Like

Question (1) Can anyone using flags -tdr comment on how long before Monitor notices they’ve arrived home?
Question (2) Is it possible to ask Monitor what option flags it is currently set to use without simply overwriting them?

1 Like

My detection is set for my iPhone and my wife’s iPhone, per this FAQ.. Detection of arrival is within about 2 - 10 seconds after I start up the walk toward my front door.

Default values are shown in the README here.

1 Like

Either, it seems. If you do a quick search, it’s clear that this happens for a number of dongles for other bluetooth projects as well.

If your beacons’ confidence are jumping, consider increasing the beacon expiration value.

@daneboom, If you continue to have 2.4GHz WiFi issues you might want to try a USB WiFi dongle on your Pi Zero W (or a USB wired Ethernet dongle). There is a known issue with the Pi when trying to run the internal Bluetooth AND internal WiFi, they do not play well together and lots of issues can be solved by turning one off.
To turn the internal WiFi off edit “/boot/config.txt” and add the line “dtoverlay=pi3-disable-wifi”.

I recently posted my experiences here, with some follow up below.

It does not make the Pi Zero so neat but may save a lot of pain.
Good luck

3 Likes

Every time I reboot my Home Assistant I have to ssh in to the monitor rpi and run sudo bash monitor.sh to get it rolling again, seems like there’s no connection between them otherwise since I’ve tried to make an automation in node red to run monitor/scan/ARRIVE when HA is started up again. But it seems to not run any arrival scan since I still have “-” in my monitor % sensor until I run the bash command. Also tried doing a monitor/scan/restart and it doesn’t work either.

Make sure you’re on the most recent version, but also try and use the systemctl script. You won’t have to reboot.

Else, you can take @benjimatt’s suggestion and not use the availability topics at all - HA has some trouble with these between reboots.

Thanks - interesting - something like this?

I thought the script automatically created a systemctl script…

1 Like

I created an automation to restart monitor everytime Home Assistant starts so I don’t get the “Unknown” value on the confidence sensors.

# Restart monitor when Hassio starts
- alias: Restart monitor when Hassio starts
  trigger:
    - platform: homeassistant
      event: start
  action:
    - delay: 5
    - service: mqtt.publish
      data:
        topic: monitor/scan/restart
1 Like

The user is presented with a prompt that can be ignored.

I have no personal experience of of that WiFi dongle but it is sold for use with a Pi Zero so it should be fine. Please let me know how you get on.
Thanks

1 Like

I haven’t changed any settings that I’m aware of. I’m going to start fresh install with latest version to see if my issue will go away.

I was doing this, But once I stopped using availibility topics HASS just reads the retained value from the Mqtt server. Well… I also retain my topics lol

Oh nice, care to share how to setup that? Thanks man!

THis is what I use.

sudo bash monitor.sh -u -d -tdr -x

-x retains the topics on the Mqtt server.
I also had to remove the availability topics if you have them set for each sensor.

when sending a monitor/scan/restart i am seeing this and does nothing else

0.2.016 04:02:28 am [CMD-INST] [pass mqtt] service restart requested

If you are running via command line, restarting the service will stop stdout and stderr for a manually started session.

i have this for my HA automation:

  • id: ‘pi11’
    alias: Update MQTT sensors on startup
    initial_state: ‘on’
    trigger:
    • platform: homeassistant
      event: start
      action:
    • service: mqtt.publish
      data:
      topic: monitor/scan/restart
1 Like