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

how often is the sensor.home_occupancy_confidence supposed to update? every time there’s a mqtt pusH?

also it doesn’t seem to be picking up my iphone7+ even though its right next to the rasberry pi :frowning: confidence level is still showing 0 and sometimes 18…

Is there any way of using the rssi data published to he MQTT topics to give some idea of distance from each of the detectors? I understand it would probably be a pretty low confidence in terms of distance, but may be useful to feed into the “confidence” %?

1 Like

That was the master branch. I wasn’t aware there was a beta branch so I’ve switched to that and it seems to be working well now.

1 Like

How would I configure a sensor in HA to monitor the heartbeats? Will be a simple be useful monitor to know if I’ve not received a heartbeat from either of the detectors over a period of time…

1 Like

is it possible to change the confidence level? my phone is 20 feet away and still shows 100…% any chance this can be lowered depending on how far away it is?

1 Like

For beacons, yes. For other devices, I’m working on a solution in the beta branch.

1 Like

No, confidence is a mark of the binary “home” or “away” decision.

I’m working on a solution for RSSI for known devices.

1 Like

can we change this to a higher number like 60?
this is when it first starts:

preference: beacon rssi change required for reporting = 10

Fantastic! Thank you for your work on this!

I finally got this to work with my own mqtt server, seems to be an issue with username/password since i had to leave it blank…, anyways

can you explain how this sensor works?

- platform: min_max
  name: "Home Occupancy Confidence of 00:00:00:00:00:00"
  type: max
  round_digits: 0
  entity_ids:
    - sensor.media_room (does not exist in home assistant)

I changed the entity_id’s to sensor.media_room, but where does the information pull for sensor.media_room if i don’t have one?

so…you have to create the template sensor first!
the name you give it is the name you will put here.

Did you create a platform: mqtt sensor like mentioned in the guide?

Yes, i have this successfully reporting 100
but ther is no sensor.media_room??

  - platform: mqtt
    name: "Media Room Presence"
    state_topic: "monitor/media_room/9C:E6:5E:0B:4B:C9"
    value_template: "{{ value_json.confidence }}"
    unit_of_measurement: '%'

You sensor is named “Media Room Presence” so guess what you have to put as entity_id :wink:

sensor.media_room_presence

so the underscore names it automatically?

If you want to check the entity name look in the dev-state page.

1 Like

I don’t understand what you are saying but as I said you named the sensor “Media Room Presence” yourself.
See this https://i.imgur.com/n8b0HGT.png

So that means you need to put here as well:

- platform: min_max
  name: "Home Occupancy Confidence of 00:00:00:00:00:00"
  type: max
  round_digits: 0
  entity_ids:
    - sensor.media_room_presence

i got it, thank you! i just didn’t realize that became the name of the new sensor :wink:

now if only you could modify the sensistivity level of the bluetooth on the pi w’s instead of 30’ it would be nice if it was 10…

My monitor has started to sometimes have this HCI error, same as this (https://github.com/andrewjfreyer/monitor/issues/25) but it’s not all the time. I don’t know if it has to do with this but the raspberry also disconnects from my Mosquitto broker after a short while. Making the whole home/away not working for me. I tried to do bash monitor.sh - E and all seems fine there, finding my phone etc. But still 0% in my Home assistant. What can I do to solve this?

Edit: I did some research in the long long thread here and found out that it could be solved with pairing to a bluetooth device first. Now everything it’s working just perfect :slight_smile:

Question: I suspect that arrive triggers aren’t actually starting an arrive scan. When I trigger a scan from HA or directly through MQTT I can see this popping up in the logs:

mqtt trigger arrive {monitor/scan arrive

yet it doesn’t fire of a scan, I can’t see the message

**** Started arrival scan. [x2 max rep] ****

This does work consistently with the depart trigger, just not with arrive. Am I missing something? Or could it be that I don’t send the right MQTT message (which seems unlikely, but who knows)? I’ve tried this with both “-t” on and off with same results. Any help is much appreciated!

I think when all your devices are home, there is no need for an arrive scan.