Skip to content

mcanteri/home-assistant-bluetooth-LE-watchdog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

Since Home Assistant 2022.08 version, this watchdog is no more useful.

home-assistant-bluetooth-LE-watchdog

A workaround about the buggy bluetooth LE implementation running on Home Assistant. With this watchdog, you can use both BL type combined with the ping presence to have a stable presence status of each person. Usually when BLE discovery stop running is because the process doesn't end and remain stuck, so the daemon try to resolve the issue.

Pre requisites:

  • the script bluetoothLE-watchdog.sh is intended for who are running Home Assistant Supervised.

Tested configuration:

Home Assistant currently tested version | core-2021.9.7 (and following versions till the latest)
installation_type | Home Assistant Supervised
dev | false
hassio | true
docker | true
user | root
virtualenv | false
python_version | 3.9.7
os_name | Linux
os_version | 5.10.63-v7+
arch | armv7l

The script ble-watchdog-copy-and-run-in-container.sh is a partial work for injecting the watchdog into the container, for other kind of HA installation, but actually I don't know if with HASSIO is possible to have access to docker on command line, so don't use it! Suggestion and help are welcome to improve the workaround.

How to run it
It needs root privileges to try to resolve the issue (run hciconfig reset)
Copy the script bluetoothLE-watchdog.sh on your machine, i.e. in folder /root/bin/, and then run it as root sending it in background, like:

bluetoothLE-watchdog.sh &

You can have an idea of what is happening in the log file, under /tmp ;-)

When it fits your need, it is better to run it at boot time, so for that purpose just do:

crontab -e
@reboot /the/path/of/bluetoothLE-watchdog.sh

My Hardware configuration is as follow:


hci1:   Type: Primary  Bus: UART
BD Address: B8:27:EB:79:B9:EA ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING INQUIRY
RX bytes:5581357 acl:1 sco:0 events:57292 errors:0
TX bytes:248337 acl:2 sco:0 commands:19244 errors:0

hci0: Type: Primary Bus: USB
BD Address: 00:1A:7D:DA:71:13 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING
RX bytes:64374261 acl:0 sco:0 events:1946876 errors:0
TX bytes:46069 acl:0 sco:0 commands:5106 errors:0

with two BT, the one integrated into RPi 3b+ and a USB dongle, both less than 5.1 bt version. The id 0 is configured for ble use and the id 1 for normal bt, as I use both modules in my config:


# For bluetooth
device_tracker:
- platform: bluetooth_tracker
device_id: 1
interval_seconds: 60
consider_home: 240
new_device_defaults:
track_new_devices: false
- platform: bluetooth_le_tracker
interval_seconds: 60
consider_home: 240
new_device_defaults:
track_new_devices: false

In this way the scan of normal BT will not occur on the same device of the ble version and it helps run the trackers a bit better.

About

A workaround about the buggy bluetooth LE implementation running on Home Assistant.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages