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

I’m migrating my HA to docker, anyone made docker image and docker-compose config they can share?

Sorry deleted my own post…

EDIT: Sharing…
Created Ubuntu Core image in Docker hub with the following:
Core, Nano, Git, Bluez, Bluez-hcidump, moquitto, mosquitto-clients, iputils-ping

Docker compose

ubuntu:
    container_name: ubuntu
    image: "vtanid/image:ubuntu-core-lts"
    hostname: ubuntu
    restart: always
    volumes:
      - /opt/ubuntu/home:/home
      - /opt/ubuntu/data:/data
      - /run/dbus:/run/dbus:ro
    privileged: true
    network_mode: host
    cap_add:
     - NET_ADMIN
    stdin_open: true 
    tty: true

Since there is no systemctl in the container.

I’m getting the following when publishing monitor/scan/restart

monitor.sh: line 1207: systemctl: command not found
Terminated

What todo, what to do??? Any ideas??

I feel like I’m going mad! :smiley:
Could have sworn when I first started using Monitor it wasn’t possible to add iPhones as they randomised bluetooth MAC addresses? But I’ve been hearing/seeing that it IS possible? Furthermore I just added my iphone’s MAC to known_static_addresses and it showed up just fine?
What gives?! Did I just misunderstand years ago?

If you pair the phone with the raspberry, you’ll get the correct mac address.

Yes, you misunderstand. There are two different types of randomization to be concerned with re: bluetooth. First, the hardware mac and the BTLE/BT5 addresses in beacon packets. The first used to be sequential with wifi mac, so it was trivial to discover and track bluetooth devices that had connected to a known Wifi network. That’s gone now, but your hardware mac stays the same (and needs to for backward compatibility).

For btle advertisements, your address is randomized. That’s not what monitor uses, so this randomization doesn’t matter anyway.

Hi Andrew,
I have two Wi-Fi adapter on my dell USFF, would it be possible to specify which one to be used by the monitor script?

I’m having issues with one of my rpi zero w where the cpu stagnate to 100% for a few hours. The device has gone bad??

I’ve purchased 3 of these and have installed identical packages which is just the monitor and some sensors to monitor their temp, disk usage, etc. The other 2 are running fine, it’s just this one that is giving me issue. I have tried a new card and installed the bulleyes OS. My previous one are still running the Buster OS. Any suggestions on how to troubleshoot this further??

I’ve been using Monitor for a number of years with no issues but recently it has been absolutely killing my 2.4GHz wifi networks. Nothing changed in terms of placement or hardware.

It’s the oddest thing.

I’m running it on two Pi Zero W’s running Buster. Does anyone know if something changed recently with bluetooth libraries that is somehow increasing the power of the active bluetooth scans?

In my HA setup, I don’t have any bluetooth dongles and instead am using the bluetooth proxy with ESPHome on a number of ESP32 devices around my home. Is there a way to run monitor and have it work with that proxy rather than a physical BT dongle?

I hate to be this guy, but could somebody give me a simple walkthrough on how to set up the triggers based on another event? I have monitor running right now and it works just fine, but I want it to only run a scan once the front door is opened/closed. This is my first time working with MQTT and I’m pretty intimidated by it.

For example:

trigger:
  - platform: state
    entity_id: binary_sensor.front_door_contact
    to: 'off'
action:
  - service: mqtt.publish
    data:
      topic: monitor/scan/arrive
      payload: ''

My own setup uses the states of various sensors to determine whether to do an arrival or departure scan. You can see the automation, the script that calls, and the other two scripts that one calls on my Github.

Hi!

pretty reliable script, thanks for it (I have to restart the service regullary tough…).
But I am pretty new to HA and have a question.
I would like to have an entity with the rooms of a monitored device in it.
For example, otto (me) could be detected in the office and in the kitchen at the same time. Now I would like to have an entity witch (eg) “office, kitchen” in it. Using fhem I have a similar techique and turn off the heating in basement when I am not there for example.
Does anyone know how this could work and maybe give me some hints?
Best regards and thanks in advance,
Otto

Looking to use Uptima Kuma to monitor, well, Monitor - anyone know if there’s a way to get a heartbeat? I think -m has been removed?

If you send an echo message to a nodes topic, the node will reply with ok if it is online. I send that message every minute. I created another mqtt sensor to listen for the nodes reply that will time out after 3 minutes. If it times out, the system attempted to reboot the node with a shell command.

To add i’d say the majority of the times a node is down, for me, it’s been a connection issue with the WiFi. Since i balanced my ap’s and made a couple of other adjustments it’s extremely rare for a node to go offline.