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

Are you running the master branch or the beta?

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!