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

Tags: #<Tag:0x00007fd079043cc8> #<Tag:0x00007fd079043980>


how do you get it to display the confident level? mine doesn’t do that when i run monitor.sh


The log stuff I posted was just a cleaned up version of the MQTT messages as they came across. I just connected to and subscribed to # to watch the events.


Got it, I tried configuring the mqtt preferences and nothing is sending across, I used the username/password from inside the https://www.cloudmqtt.com/ portal but nothing is connecting…


Not to hijack this thread but it may help some folks who ran into issues like I did (I don’t have multiple Pi’s to work with which is probably why my use-case didn’t work out.)

I really liked the idea of this tool but unfortunately for me, it didn’t work well with my Tile(s) and smartphones (tiles would always have confidence=0 and my smartphones would always end up at confidence=0 like @MisterWil encountered.)

I ended up extending some work I did using some of the concepts from here and I appreciate the work @andrewjfreyer did here as it taught me a lot about Bluetooth:


Is it somehow possible to change the MQTT clientid? One of my pi zero’s is using a pipe symbol which is fine (e.g. mosqsub|19910-raspberry). But I also use monitor.sh on xbian which is using a slash in its client id (e.g. mosqpub/17508-xbian). The Mosquitto add-on on home assistant does not allow that: “ACL denying access to client with dangerous client id ‘mosqsub/1447-xbian’”.


How reliable are the Raspberry pi zero w. I am currently trying to use 7 ESP32s but they are crashy and pretty much too inconsistent to be used. Would 7 Raspberry Pi zero w (One per room) be stable?


My pi zero is running very stable. No problems at all.


@andrewjfreyer can you please add this to the github page?
Option to publish: monitor/scan/restart

I didn’t know about it but need it in my setup. So putting it in the guide is a good idea.


Just to let everyone know you can also run this on a Vero4k. I have one upstairs so didn’t need to add a new pi there :).


That’s a very cool idea - I have a few old Android boxes kicking around that I converted over to Linux boxes, never occurred to me to use it for such (I was doing other things) and have sat there abandoned for some time. Nice way to re-purpose!


I just got mqtt running and the pi is connected to it, however none of my sensors are showing up…
I’ve rebooted home assistant and cleared the cache, but nothing is working…
this is in my sensors.yaml file

  - platform: mqtt
    state_topic: 'monitor/rasberrypi/E4:E4:AB:80:14:92'
    value_template: '{{ value_json.confidence }}'
    unit_of_measurement: '%'
    name: 'Media Room'

  - platform: min_max
    name: "Home Occupancy Confidence of E4:E4:AB:80:14:92"
    type: max
    round_digits: 0
      - sensor.first_floor

  - platform: mqtt
    state_topic: 'monitor/raspberrypi/status'
    name: 'Media Room Bluetooth Status'

Why can't pi w [monitor] talk to my mqtt hassio addon?

Use mosquitto_sub to test what is actually being received by your mqtt server.


Did you define sensor.first_floor somewhere?
Do you see the sensor.media_room in your entities list?
If not can you try to name it media_room. So: name: ‘Media_Room’

And as nickrout says, see whats being received. Easiest way I use is:
mosquitto_sub -t "#" -u username -P password –v


how do you do that?


If i use this, how does it know which mac address to use?

- alias: Occupancy 
  hide_entity: true
    - platform: numeric_state
      entity_id: sensor.home_occupancy_confidence
      above: 10
    - service: homeassistant.turn_on
        entity_id: input_boolean.occupancy


Nope, i do not see this


Nothing is being sent over :frowning:


Then you possibly don’t have mqtt properly set up in your monitor configuration.


as part of step 7?


I think mqtt in home assistant. Check the mqtt log on in home assistant on the mqtt add-on log.