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

Googling (did you?) tells me that bluetooth has crashed. Although rebooting should hardly ever be the answer on linux, give it a try.

1 Like

I did google it and saw the same thing. Rebooting didnā€™t help so I thought Iā€™d asked here

So Iā€™m new to Monitor and getting it up and working on Hassio.

Iā€™m mainly interested in using arrive/depart scans triggered by motion sensor at front door.

The arrive scan seems to be working well both from the hassio script (below) and the Hassio MQTT developer tool (Hassio add-on). But the depart scan oddly only seems to work from the Hassio MQTT developer tool.

Am I being thick? Is their something wrong with my departure script below? Could someone help point me to a way to troubleshoot?

In my script.yaml

#----------------------------------------------------------------------------------------------------------------------
#  Monitor
#----------------------------------------------------------------------------------------------------------------------
arrival_scan:
  alias: Arrival Scan
  sequence:
    - condition: template
      value_template: "{{is_state('binary_sensor.mqtt_bingbong_home', 'off')}}" 
    - service: 'mqtt.publish'
      data: 
        topic: monitor/scan/arrive
    - delay: 00:00:15
    - condition: template
      value_template: "{{is_state('binary_sensor.mqtt_bingbong_home', 'off')}}" 
    - service: 'mqtt.publish'
      data: 
        topic: monitor/scan/arrive
    - delay: 00:00:15
    - condition: template
      value_template: "{{is_state('binary_sensor.mqtt_bingbong_home', 'off')}}" 
    - service: 'mqtt.publish'
      data: 
        topic: monitor/scan/arrive
      
departure_scan:
  alias: Departure Scan
  sequence:
    - condition: template
      value_template: "{{is_state('binary_sensor.mqtt_bingbong_home', 'on')}}" 
    - service: 'mqtt.publish'
      data: 
        topic: monitor/scan/depart
    - condition: template
      value_template: "{{is_state('binary_sensor.mqtt_bingbong_home', 'on')}}" 
    - delay: 00:00:60
    - service: 'mqtt.publish'
      data: 
        topic: monitor/scan/depart
    - condition: template
      value_template: "{{is_state('binary_sensor.mqtt_bingbong_home', 'on')}}" 
    - delay: 00:00:60
    - service: 'mqtt.publish'
      data: 
        topic: monitor/scan/depart
    - condition: template
      value_template: "{{is_state('binary_sensor.mqtt_bingbong_home', 'on')}}" 
    - delay: 00:00:60
    - service: 'mqtt.publish'
      data: 
        topic: monitor/scan/depart

EDIT: Yep, Iā€™m thick:) Canā€™t have 60 seconds!! All good nowā€¦ Iā€™ll leave the post up for mild amusement of othersā€¦

2 Likes

I think thatā€™s happened to me before and my SD card ended up being corrupt. Try to save your configs and completely reformat. (Yeah a little inconvenient)

1 Like

Thanks Iā€™ll give it a try

Well why didnā€™t you say you had tried rebooting? I guess I should have been able to use my crystal ball to know this, but it died from overuse when I have to guess what people have tried because they donā€™t say.

2 Likes

This is clearly unnecessary I didnā€™t ask for your direct help it was a general question.
Iā€™ll take note to provide more information to ensure Iā€™m not insulted again.

1 Like

You insult everyone here by not posting clearly. I suggest you read this

I have Montior setup for my phones and it works great. However i cannot get Montior to find my new Fitbit Inspire HR. I have no clue on how to find my Fitbits bluetooth macadress. Can anyonte help?

Hi! Iā€™m trying to do the same thing. Did you ever get it to work?

I never got this to work, fwiw :frowning:

I have not tackled this type of presence detection since I rather want a solution that works for a broad range of use cases. Therefore I am aiming for Android/iOS and BT Tags.

How do you install ok hassio environment , because its dockerized?? And after a reboot ,anything you install o doit its gone? Iā€™m wrong

On Hass.io you need to install software using add-ons

1 Like

Your question isnā€™t so clear to me, if you clarify I may be able to help.

Maybe I didnā€™t explain this quite right too thoughā€¦

I use the Hassio addon/integration for MQTT. The set up for that is a little confusing despite the documentation. If you Google hard youā€™ll find threads that will help. Let me know if you need help/get stuck.

I had a bit of a hard time setting up Monitor despite the quite good instructions. I got it up and running on a Pi Zero after various minor trouble shooting attempts that mostly relate to my inexperience with command line (like I didnā€™t know when you paste passwords you canā€™t see them etc etc).

My detction times arenā€™t satisfactory at the moment, so Iā€™m in the process of fine tuningā€¦

@Fredamn76 @VilleL - I used the Bluetooth Mac Finder app for Android to find my Fitbit MACs.

Iā€™ve been using this for a while now and it works really well but I do have issues when it just stops working. From the logs it appears it can no longer access bluetooth and Iā€™m wondering if I need different hardware. Iā€™m currently running it on pi zero w nodes, maybe if I switched to something better (pi 3?) it wouldā€™t stop working? Itā€™s not common but every month or so one of them stops reporting and I have to physical reboot it to fix the issue. Any tips?

Iā€™m using Monitor on a RPi 3B+, but I also have noticed that Bluetooth sometimes becomes unresponsive. When this happens, the presence status will be become ā€œunavailableā€ instead of ā€œhomeā€ or ā€œnot_homeā€.

I use an automation that checks every 30 mins whether the status of my phone is unavailable, and sends a MQTT restart command to Monitor:

- id: '0000000000003'
  alias: Check Monitor service every half hour
  initial_state: 'on'
  trigger:
    platform: time_pattern
    minutes: '/30'
    seconds: 00
  condition:
  - condition: state
    entity_id: 'sensor.presence_iphonex'
    state: 'unavailable'
  action:
  - service: mqtt.publish
    data:
      topic: "monitor/scan/restart"

I also set crontab in the RPi to reboot it every day at 4AM.

Not the RPi running home assistant I hope!

I run HA in a separate VM instance :grinning: