Closed hurricup closed 2 years ago
Could be a reception issue. Do you have a SSD connected to your HA machine?
Nope. It's just some micro-computer with Amlogic S905W
This one (not sure if they have description in english) https://jhome.ru/catalog/controllers/253/?oid=300#props
I doubt that reception issue could be solved with simple HA restart. This feels like something with wrong with scanning.
I guess it was a message when I restarted HA that HCIdump thread
could not exit in 10 secs or smth. Not sure if this is related.
You could try to enable debugging at debug level and see what happens if it fails.
Ok, will see if this happen again. Do you mean debug for ble_monitor or ha as well?
So far so good, but have something in the logs:
2021-11-09 14:11:36 ERROR (Thread-9) [custom_components.ble_monitor] HCIdump thread: Runtime error while sending scan request on hci0: Event loop stopped before Future completed.. Resetting Bluetooth adapter F0:A3:B2:46:F0:4B and trying again.
2021-11-09 14:11:37 ERROR (Thread-9) [root] Uncaught thread exception
Traceback (most recent call last):
File "/config/custom_components/ble_monitor/__init__.py", line 598, in run
self._event_loop.run_until_complete(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 640, in run_until_complete
raise RuntimeError('Event loop stopped before Future completed.')
RuntimeError: Event loop stopped before Future completed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
self.run()
File "/config/custom_components/ble_monitor/__init__.py", line 608, in run
reset_bluetooth(hci)
File "/config/custom_components/ble_monitor/bt_helpers.py", line 159, in reset_bluetooth
bluetoothctl_select(mac)
File "/config/custom_components/ble_monitor/bt_helpers.py", line 95, in bluetoothctl_select
command = subprocess.run(["bluetoothctl", "select", mac], stderr=subprocess.PIPE, check=True)
File "/usr/local/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['bluetoothctl', 'select', 'F0:A3:B2:46:F0:4B']' died with <Signals.SIGABRT: 6>.
This means that at some point, making a HCIdump has failed and it tries to reset you Bluetooth. During this reset, it fails to run the command bluetoothctl select F0:A3:B2:46:F0:4B
. Can you run this command manually, just to see if something is missing on your system?
Well:
ricup@jethub-j80:~/home-assistant$ docker-compose run homeassistant bluetoothctl select F0:A3:B2:46:F0:4B
dbus[1]: arguments to dbus_connection_get_object_path_data() were incorrect, assertion "connection != NULL" failed in file dbus-connection.c line 5905.
This is normally a bug in some application using the D-Bus library.
D-Bus not compiled with backtrace support so unable to print a backtrace
but. when HA is running with ble_monitor i can't even do scanning:
hurricup@jethub-j80:~/home-assistant$ docker-compose run homeassistant hcitool lescan
Enable scan failed: I/O error
hurricup@jethub-j80:~/home-assistant$ sudo hcitool lescan
Enable scan failed: Input/output error
But if I shut down docker-compose with HA - scan is working.
My theory (based on 0 knowledge on how this works, actually):
Feels like ble_monitor
or smth else (don't have other components related to HCI) holds something exclusively and don't allow others to use it.
And if my assumption is right, and bluetoothctl select
fails for the same reason, probably there is some kind of race? Like resource was not released yet and ble_monitor
tries to obtain it again.
I can run bluetoothctl select
at the same time BLE monitor is running, but that's on Home Assistant Os or on Home Assistant Supervised. I use the Terminal & SSH add-on to run these commands, which makes sure that the command runs on the same user as the HA user, I guess.
I'm not familiar with docker-compose, to be honest. How did you install HA?
I'm working with docker-compose and HA is in docker container. btw, I remembered that I also have some usb CO2 monitor and some custom script watching it. probably it is its fault. I'll check later.
Running two Bluetooth programs is likely to cause problems. You might be able to solve it by using two dongles. In BLE monitor, you can choose which one to use with BLE monitor in the options.
Looks like this is some local issue with controller hanging or smth.
Setup: The most recent version of HA and
ble_monitor
.What happened: Today morning just stopped collecting all information from 2 of xiaomi sensors.
Server restart helped (via HA ui - restart)
There is nothing in ha logs. I've reduced logs severity to info after this, may be will help if happen again. Is there anything I can do to investigate this next time?