You are not logged in.

#1 2024-08-14 16:40:56

ttshaw1
Member
Registered: 2020-04-12
Posts: 47

[Solved] Bluetooth issue in Home Assistant - Passive BLE Monitor

I have a Govee H5182 bluetooth meat thermometer that I'm trying to remotely monitor using the Passive BLE Monitor Integration addon to Home Assistant. I'm trying to get it working and think there might be a permissions problem with my bluetooth adapter. I’m using Home Assistant installed from the Arch Linux repository, HACS installed through the AUR, and Passive BLE Monitor Integration installed from the HACS store.

Checking the log, I have the

[custom_components.ble_monitor] HCIdump thread: Something wrong - interface hci0 not ready, and will be skipped for current scan period.

error message, which the Passive BLE Monitor Integration FAQ says is from Python not having the necessary permissions (https://custom-components.github.io/ble … ion-issues). But I’ve checked that

 sudo getcap `readlink -f \`which python3\`` 

returns

 /usr/bin/python3.12 cap_net_admin,cap_net_raw=eip 

which looks like it has the right permissions according to their recommendation.

In my HA log, following those messages is the a few minutes of scans with 0 advertisements. Then I turn on my computer’s UI “search for Bluetooth connections” and the log sees tons of things to connect to until I turn that off. So, it seems good that Home Assistant did start looking for advertisements and was able to see traffic from the adapter, but seems bad that I got the notorious error message and had minutes of 0 advertisements.

The Arch wiki page for Home Assistant discusses a Bluetooth integration problem related to dbus. I never got the error message described there and I already had dbus-broker installed, so I’m not sure it’s relevant. I did try the alternative solution there as well, but got an error

 Failed to execute /usr/bin/python: Operation not permitted 

in my journal when trying to start the service with the DynamicUser=false override.

I'm wondering if the install method through Arch does something weird that the Passive BLE people aren't expecting that's making their usual Python permissions fix not work. For example, the Home Assistant service is running python in a virtual environment in /var/lib/hass/.venv; when I cd in and getcap on that copy of python, it looks like it's still a symlink pointing to my /usr/bin/python which does have the correct permissions. But maybe when the service runs it does something complex and creates a new version of the binary without the right permissions.

Anyone have any ideas what I can do to troubleshoot this further?

Last edited by ttshaw1 (2024-08-15 02:03:17)

Offline

#2 2024-08-15 02:02:47

ttshaw1
Member
Registered: 2020-04-12
Posts: 47

Re: [Solved] Bluetooth issue in Home Assistant - Passive BLE Monitor

Got it, the last post here https://bbs.archlinux.org/viewtopic.php?id=279268 had the fix. Needed a service override file to give the relevant permissions for BLE

/etc/systemd/system/home-assistant.service.d/override.conf

[Service]
AmbientCapabilities=CAP_NET_RAW
CapabilityBoundingSet=CAP_NET_RAW

Trying to make a static hass user and setting DynamicUser=false broke things for me, but I was already using dbus-broker, so that wasn't a problem.

Offline

Board footer

Powered by FluxBB