Closed trenoduro closed 2 years ago
I have the same issue.
I am running hassio from docker with the container raspberrypi3-homeassistant. When home assistant run the hcitool stop working and I get the same error message.
Here home assistant is running:
Here home assistant is not running --> I just stop docker container and retry hcitool : No issue with hcitool
I have the same issue.
I am running hassio from docker with the container raspberrypi3-homeassistant. When home assistant run the hcitool stop working and I get the same error message.
Here home assistant is running:
Here home assistant is not running --> I just stop docker container and retry hcitool : No issue with hcitool
This is normal behavior, probably because HA was performing a scan at the same time. To verify this you just have to spam that command with the container running and chances are you will catch a timeframe where HA is not performing a BT scan sooner or later.
I have the same issue. I am running hassio from docker with the container raspberrypi3-homeassistant. When home assistant run the hcitool stop working and I get the same error message. Here home assistant is running: Here home assistant is not running --> I just stop docker container and retry hcitool : No issue with hcitool
This is normal behavior, probably because HA was performing a scan at the same time. To verify this you just have to spam that command with the container running and chances are you will catch a timeframe where HA is not performing a BT scan sooner or later.
I tryed to spam it for some time but I always get this message.
All the BT sensors that I used doesn't show response for several days also. They all stop responding at the same time (mi_flora and Xiaomi Temperature and Humidity Sensor ).
That is why I think the problem comes from HA.
Also when hcitool show the error message, bluetoothctl is working.
Having this same issue on an Intel NUC 8.
Apparently hcitool
is deprecated and there is a new API?
https://stackoverflow.com/questions/65315379/hcitool-lescan-does-not-work-on-bluetooth-version-5
in container:
/config # hciconfig
hci0: Type: Primary Bus: USB
BD Address: 38:BA:F8:2B:5E:75 ACL MTU: 1021:4 SCO MTU: 96:6
UP RUNNING
RX bytes:53502 acl:0 sco:0 events:6612 errors:0
TX bytes:729452 acl:0 sco:0 commands:6434 errors:0
/config # hcitool lescan
Set scan parameters failed: I/O error
On host (hass is running in a container)
$ sudo rfkill list all
0: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
$ sudo hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: 38:BA:F8:2B:5E:75 ACL MTU: 1021:4 SCO MTU: 96:6
UP RUNNING
RX bytes:51450 acl:0 sco:0 events:6469 errors:0
TX bytes:725446 acl:0 sco:0 commands:6295 errors:0
Features: 0xbf 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH SNIFF
Link mode: SLAVE ACCEPT
Name: 'arx'
Class: 0x0c0104
Service Classes: Rendering, Capturing
Device Class: Computer, Desktop workstation
HCI Version: 5.1 (0xa) Revision: 0x100
LMP Version: 5.1 (0xa) Subversion: 0x100
Manufacturer: Intel Corp. (2)
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Issue still remaing with 2021.7 (supervised docker) Neither BLE tracker or BT can work correctly. Running wth internal BT (nuc8) and USB dongle does have same behavior
2021-07-09 22:21:35 ERROR (SyncWorker_7) [pygatt.backends.gatttool.gatttool] Unexpected error when scanning: Invalid device: Network is down
2021-07-09 22:21:35 ERROR (SyncWorker_7) [homeassistant.components.bluetooth_le_tracker.device_tracker] Error during Bluetooth LE scan: Unexpected error when scanning: Invalid device: Network is down
2021-07-09 22:22:34 ERROR (MainThread) [homeassistant.components.bluetooth_tracker.device_tracker] Error looking up Bluetooth device
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 289, in _gethcisock
sock = _bt.hci_open_dev (device_id)
_bluetooth.error: no available bluetoot devices
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 162, in perform_bluetooth_update
friendly_name = await hass.async_add_executor_job(lookup_name, mac)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 122, in lookup_name
return bluetooth.lookup_name(mac, timeout=5) # type: ignore[no-any-return]
File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 61, in lookup_name
sock = _gethcisock ()
File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 291, in _gethcisock
raise BluetoothError ("error accessing bluetooth device")
bluetooth.btcommon.BluetoothError: error accessing bluetooth device2021-07-09 22:21:35 ERROR (SyncWorker_7) [pygatt.backends.gatttool.gatttool] Unexpected error when scanning: Invalid device: Network is down
2021-07-09 22:21:35 ERROR (SyncWorker_7) [homeassistant.components.bluetooth_le_tracker.device_tracker] Error during Bluetooth LE scan: Unexpected error when scanning: Invalid device: Network is down
2021-07-09 22:22:34 ERROR (MainThread) [homeassistant.components.bluetooth_tracker.device_tracker] Error looking up Bluetooth device
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 289, in _gethcisock
sock = _bt.hci_open_dev (device_id)
_bluetooth.error: no available bluetoot devices
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 162, in perform_bluetooth_update
friendly_name = await hass.async_add_executor_job(lookup_name, mac)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 122, in lookup_name
return bluetooth.lookup_name(mac, timeout=5) # type: ignore[no-any-return]
File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 61, in lookup_name
sock = _gethcisock ()
File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 291, in _gethcisock
raise BluetoothError ("error accessing bluetooth device")
bluetooth.btcommon.BluetoothError: error accessing bluetooth device
2021-07-09 22:23:34 ERROR (MainThread) [homeassistant.components.bluetooth_tracker.device_tracker] Error looking up Bluetooth device
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 289, in _gethcisock
sock = _bt.hci_open_dev (device_id)
_bluetooth.error: no available bluetoot devices
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 162, in perform_bluetooth_update
friendly_name = await hass.async_add_executor_job(lookup_name, mac)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 122, in lookup_name
return bluetooth.lookup_name(mac, timeout=5) # type: ignore[no-any-return]
File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 61, in lookup_name
sock = _gethcisock ()
File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 291, in _gethcisock
raise BluetoothError ("error accessing bluetooth device")
bluetooth.btcommon.BluetoothError: error accessing bluetooth device
root@homeassistant:~# hcitool dev
Devices:
hci1 00:1A:7D:DA:XX:XX
hci0 94:E6:F7:7A:XX:XX
Still unavailable on most recent homeassistant/intel-nuc-homeassistant image, too.
I've even tried exposing /lib/modules to the container so the btusb module can be loaded, as well as the device node for the bluetooth USB device, but that doesn't seem to make it any happier.
This is on a NUC10i7FNH
I'm not so advanced as you guys, but I'm having this issue which I believe is related on an intel nuc, 6th gen celeron, running supervisor 2021.11.3
Logger: pygatt.backends.gatttool.gatttool Source: /usr/local/lib/python3.9/site-packages/pygatt/backends/gatttool/gatttool.py:352 First occurred: 10:41:49 (155 occurrences) Last logged: 21:46:59
Unexpected error when scanning: Set scan parameters failed: I/O error
I'm not so advanced as you guys, but I'm having this issue which I believe is related on an intel nuc, 6th gen celeron, running supervisor 2021.11.3
Logger: pygatt.backends.gatttool.gatttool Source: /usr/local/lib/python3.9/site-packages/pygatt/backends/gatttool/gatttool.py:352 First occurred: 10:41:49 (155 occurrences) Last logged: 21:46:59
Unexpected error when scanning: Set scan parameters failed: I/O error
I have exactly the same error running on RPi3B+ container. Did you find a way to fix it?
I’ve just tried the BLE device tracker (on my NUC copy) with a Bluetooth 4.0 adapter (tp-link Nano USB - UB4A) and it give exactly the same “Set scan parameters failed: I/O error“ error.
I'm sorry if I "jump in" here, but I want to leave my thoughts. I'm using HA Container on a Debian 11. It's running on some weird "Z83" Mini-PC ("NUC-Like" appearence), with a supposedly Bluetooth 4.1 Chip soldered to the Motherboard. But I have tested also with a TP-Link 'UB400' (not a 'UB4A' - I do not know what exaclty the differences are) - though my findings are the same. I have a UB5A on my normal PC, but I have not tested with that (as it doesn't work - see below) (and also it's in normal use)
I've used pydbus in the past, and looking at it again, i think this would be rather simple. If the DBus gets used, and if iv'e read the interface specification correctly, BLE and 'normal' (non-BLE) bluetooth_tracker must/can use the same DBus-Client(?)-Object within HA.
Things I've gathered:
optional(?):
hcitool lescan
)
org.bluez.Adapter1
void SetDiscoveryFilter(dict filter)
(eg Transport
. Pattern
) for performance/accuracy?must:
org.bluez.AdvertisementMonitorManager1
void RegisterMonitor(object application)
First of all, the core functionality for bluez over dbus seems easy. However: i cannot get to the the AdvertisementMonitorManager1
interface (or other Monitor). It is marked with [experimental]
in the docs, but adding the --experimental
to my bluetooth.service
unit (and even rebooting the system) does not enable it. Either i'm missing something or (what i suspect) bluez is not compiled with experimentals (at least on Debain 11).
This seems currently rather inconvenient for Core/Container use cases, where the admin must then compile and replace bluez manually, which they may not want or can do.
Bluez also mentions that experimentals might change significantly.
But, since in theory, the dbus part can work continuously and rellay async (other than using hcitool in a seperate thread): is the old logic still sensible (aka "scan each x seconds") or should there be a new one aka "maximum last seen = nothome". And I obviusly didn't test what happens on crashes - on a clean Stop/Shutdown you would unregister the monitor and stop the discovery session (like someone restarts while it's running; to reload the configuration.yaml
). And the component should not "re-write" the same state ("[not]home"), if the discovery service is very talkative.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/adapter-api.txt
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertisement-monitor-api.txt
Fixed in 2022.8.0 (unreleased)
hcitool lescan
, the command used by pygatt (the lib used by BTLE tracker integration), is not working on recent BT hardware (supporting Bluetooth 5.X). In fact, both hcitool and gatttool are deprecated since 2017.Running this command results in a
Set scan parameters failed: Input/output error
.I tested multiple intel Wi-Fi cards, and the only working ones had Bluetooth version less than 5 (same computer, just Wi-Fi swapped).
I’m referencing another thread I just found link on stackoverflow