Event loop stopped before Future completed
See original GitHub issueHello,
I think this is linked to https://github.com/custom-components/ble_monitor/issues/167, but since I upgraded to Home Assistant OS 5.12 yesterday, I have trouble with my bluetooth temperature sensors. I don’t see any other event that could have cause an issue, before that it was working perfectly well for months.
Now I can see this error multiple times in the logs:
**ERROR (Thread-3) [custom_components.ble_monitor] HCIdump thread: Runtime error while stop scan request on hci0: Event loop stopped before Future completed.**
By reading the previous issue, I didn’t really get what was the solution.
Additional info: I am running “pure” HassOS on RPI 4B, so I don’t have access to root or to the linux behind or to commands like hcitool, the only command that seems to work is bluetoothctl, with which I already tried to re-enable everything and repair all devices without success. Another info, I use an external dongle (I identified its mac address by plugging it/unplugging it and by seing the output of bluetoothctl list command, and I set the external one as default controller with bluetoothctl)
Config:
ble_monitor:
decimals: 1
period: 60
log_spikes: False
use_median: False
active_scan: False
hci_interface:
- 1
- 0
batt_entities: True
discovery: False
restore_state: False
report_unknown: False
devices:
- mac: 'xxx'
name: 'xxx'
temperature_unit: C
Thanks for the help !
Issue Analytics
- State:
- Created 3 years ago
- Comments:126
I’ve finally found out the root cause… it was permission issues for python…
When home assistant installed in
pyenv
the output of the commandwhich python3
looks like/home/homeassistant/.pyenv/shims/python3
but this is not the real link to actualpython3
interpreter. The actual binary placed in the folder like/home/homeassistant/.pyenv/versions/3.9.9/bin/python3.9
(it might slightly differ depending on the installed python version). So to grant root access to python it’s required to runsetcap
command with correct path, i.e.setcap 'cap_net_raw,cap_net_admin+eip' /home/homeassistant/.pyenv/versions/3.9.9/bin/python3.9
Did you check the FAQ? The FAQ gives some tips how to solve this (in most cases)
https://custom-components.github.io/ble_monitor/faq#i-get-a-runtimeerror-event-loop-stopped-before-future-completed