Closed no2chem closed 5 years ago
Hello. You can use this to reset it:
sudo hciconfig hci0 reset
With hciX being relevant to your setup
@danlinn thanks. Yeah I figured that out but it'd be nice if HA can do that for me. It seems that you really need root though, the permissions given by setcap don't seem to be enough to perform a reset
Same issue on:
The suggested command by @danlinn is useless (not present in Arch and on docker console respond "Operation not permitted (1)").
The log portion:
2018-11-01 18:45:08 INFO (SyncWorker_8) [pygatt.backends.gatttool.gatttool] Found 7 BLE devices
2018-11-01 18:45:08 INFO (SyncWorker_8) [homeassistant.components.device_tracker.bluetooth_le_tracker] Discovered Bluetooth LE device BF:EF:75:44:28:96
2018-11-01 18:45:08 INFO (SyncWorker_8) [homeassistant.components.device_tracker.bluetooth_le_tracker] Discovered Bluetooth LE device 60:64:05:BD:71:F7
2018-11-01 18:45:08 INFO (SyncWorker_8) [homeassistant.components.device_tracker.bluetooth_le_tracker] Discovered Bluetooth LE device 68:14:01:36:43:B0
2018-11-01 18:45:08 INFO (SyncWorker_8) [homeassistant.components.device_tracker.bluetooth_le_tracker] Discovered Bluetooth LE device C4:7C:8D:66:35:B4
2018-11-01 18:45:08 INFO (SyncWorker_8) [homeassistant.components.device_tracker.bluetooth_le_tracker] Discovered Bluetooth LE device FF:FF:3D:15:AB:59
2018-11-01 18:45:08 INFO (SyncWorker_8) [homeassistant.components.device_tracker.bluetooth_le_tracker] Discovered Bluetooth LE device C4:7C:8D:66:33:1B
2018-11-01 18:45:08 INFO (SyncWorker_8) [homeassistant.components.device_tracker.bluetooth_le_tracker] Discovered Bluetooth LE device FC:0E:8C:22:DA:F4
2018-11-01 18:45:16 INFO (SyncWorker_6) [homeassistant.components.device_tracker.nmap_tracker] nmap scan successful
2018-11-01 18:45:27 INFO (MainThread) [homeassistant.setup] Setup of domain device_tracker took 33.1 seconds.
2018-11-01 18:45:27 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 35.42s
2018-11-01 18:45:27 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2018-11-01 18:45:27 INFO (MainThread) [homeassistant.loader] Loaded automation.state from homeassistant.components.automation.state
2018-11-01 18:45:27 INFO (MainThread) [homeassistant.components.automation] Initialized trigger UU - notifications
2018-11-01 18:45:27 INFO (MainThread) [homeassistant.loader] Loaded automation.homeassistant from homeassistant.components.automation.homeassistant
2018-11-01 18:45:27 INFO (MainThread) [homeassistant.components.automation] Initialized trigger HA - Start
2018-11-01 18:45:28 INFO (MainThread) [homeassistant.components.automation] Initialized trigger HA - Stop
2018-11-01 18:45:28 INFO (MainThread) [homeassistant.loader] Loaded automation.numeric_state from homeassistant.components.automation.numeric_state
2018-11-01 18:45:28 INFO (MainThread) [homeassistant.components.automation] Initialized trigger Sensor - Temp above 28°c or below 27°C - Multi
2018-11-01 18:45:28 INFO (MainThread) [homeassistant.components.automation] Initialized trigger Sensor - Temp above 28°c or below 27°C - Multi
2018-11-01 18:45:28 INFO (MainThread) [homeassistant.core] Timer:starting
2018-11-01 18:45:28 INFO (MainThread) [homeassistant.components.automation] Executing HA - Start
2018-11-01 18:45:28 INFO (MainThread) [homeassistant.helpers.script] Script HA - Start: Running script
2018-11-01 18:45:28 INFO (MainThread) [homeassistant.helpers.script] Script HA - Start: Executing step call service
2018-11-01 18:45:31 INFO (SyncWorker_3) [pygatt.backends.gatttool.gatttool] Starting BLE scan
2018-11-01 18:45:31 ERROR (SyncWorker_3) [pygatt.backends.gatttool.gatttool] BLE adapter requires reset after a scan as root- call adapter.reset()
2018-11-01 18:45:31 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
s = os.read(self.child_fd, size)
OSError: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pexpect/expect.py", line 111, in expect_loop
incoming = spawn.read_nonblocking(spawn.maxread, timeout)
File "/usr/local/lib/python3.6/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
return super(spawn, self).read_nonblocking(size)
File "/usr/local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 171, in read_nonblocking
raise EOF('End Of File (EOF). Exception style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pygatt/backends/gatttool/gatttool.py", line 315, in scan
scan.expect('foooooo', timeout=timeout)
File "/usr/local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 341, in expect
timeout, searchwindowsize, async_)
File "/usr/local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 369, in expect_list
return exp.expect_loop(timeout)
File "/usr/local/lib/python3.6/site-packages/pexpect/expect.py", line 117, in expect_loop
return self.eof(e)
File "/usr/local/lib/python3.6/site-packages/pexpect/expect.py", line 63, in eof
raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7feb9c7a8c50>
command: /usr/bin/hcitool
args: ['/usr/bin/hcitool', '-i', 'hci0', 'lescan']
buffer (last 100 chars): b''
before (last 100 chars): b'Set scan parameters failed: Input/output error\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: 1
flag_eof: True
pid: 46
child_fd: 32
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile(b'foooooo')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 93, in update_ble
devs = discover_ble_devices()
File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 55, in discover_ble_devices
devs = adapter.scan()
File "/usr/local/lib/python3.6/site-packages/pygatt/backends/gatttool/gatttool.py", line 326, in scan
raise BLEError(message)
pygatt.exceptions.BLEError: BLE adapter requires reset after a scan as root- call adapter.reset()
Update: Removing from the configuration:
The error changes, after some correct scans in the log appear this error:
2018-11-01 20:12:39 INFO (SyncWorker_5) [homeassistant.components.device_tracker.bluetooth_le_tracker] Discovered Bluetooth LE device 68:14:01:36:43:B0
2018-11-01 20:12:39 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 107, in update_ble
see_device(address, devs[address], new_device=True)
File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 47, in see_device
see(mac=BLE_PREFIX + address, host_name=name.strip("\x00"),
AttributeError: 'NoneType' object has no attribute 'strip'
Setting:
- platform: bluetooth_le_tracker
track_new_devices: False
Resolve the following error, but is still necessary to remove platform: bluetooth_tracker
and platform: miflora
from the configuration.
Update: Removing from the configuration:
- platform: bluetooth_tracker
- platform: miflora
The error changes, after some correct scans in the log appear this error:
2018-11-01 20:12:39 INFO (SyncWorker_5) [homeassistant.components.device_tracker.bluetooth_le_tracker] Discovered Bluetooth LE device 68:14:01:36:43:B0 2018-11-01 20:12:39 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 107, in update_ble see_device(address, devs[address], new_device=True) File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 47, in see_device see(mac=BLE_PREFIX + address, host_name=name.strip("\x00"), AttributeError: 'NoneType' object has no attribute 'strip'
Home Assistant release with the issue: 0.81.4
Issue still present; if bluetooth_tracker
and/or miflora
are present in the configuration with bluetooth_le_tracker
, the last one tends to generate an error before of the others.
Setting bluetooth_le_tracker
with interval_seconds: 60
it seems to mitigate the issue, but i'm realtive sure that soon or late, bluetooth_le_tracker
will try to access at BT at same time of bluetooth_tracker
or miflora
.
it seems that HA does not control if the resource is busy before to use it, and instead of waiting, it generates an error and breaks all component that use the BT device.
Home Assistant release with the issue: 0.81.6
Returned at situation of 0.81.2 stuck a first scan. (miflora still configured)
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 :+1:
Hi,
V 0.87.1
still persists.
bluetooth_le_tracker
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
s = os.read(self.child_fd, size)
OSError: [Errno 5] I/O error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pexpect/expect.py", line 111, in expect_loop
incoming = spawn.read_nonblocking(spawn.maxread, timeout)
File "/usr/local/lib/python3.6/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
return super(spawn, self).read_nonblocking(size)
File "/usr/local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 171, in read_nonblocking
raise EOF('End Of File (EOF). Exception style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pygatt/backends/gatttool/gatttool.py", line 315, in scan
scan.expect('foooooo', timeout=timeout)
File "/usr/local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 341, in expect
timeout, searchwindowsize, async_)
File "/usr/local/lib/python3.6/site-packages/pexpect/spawnbase.py", line 369, in expect_list
return exp.expect_loop(timeout)
File "/usr/local/lib/python3.6/site-packages/pexpect/expect.py", line 117, in expect_loop
return self.eof(e)
File "/usr/local/lib/python3.6/site-packages/pexpect/expect.py", line 63, in eof
raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7fde0a628b00>
command: /usr/bin/hcitool
args: ['/usr/bin/hcitool', '-i', 'hci0', 'lescan']
buffer (last 100 chars): b''
before (last 100 chars): b'Set scan parameters failed: I/O error\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: 1
flag_eof: True
pid: 53
child_fd: 24
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile(b'foooooo')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/__init__.py", line 183, in async_setup_platform
disc_info)
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 114, in setup_scanner
update_ble(dt_util.utcnow())
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 96, in update_ble
devs = discover_ble_devices()
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 58, in discover_ble_devices
devs = adapter.scan()
File "/usr/local/lib/python3.6/site-packages/pygatt/backends/gatttool/gatttool.py", line 326, in scan
raise BLEError(message)
pygatt.exceptions.BLEError: Unexpected error when scanning: Set scan parameters failed: I/O error
Ditto for 89.1...
2019-03-09 23:52:06 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform bluetooth_le_tracker
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
s = os.read(self.child_fd, size)
OSError: [Errno 5] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 111, in expect_loop
incoming = spawn.read_nonblocking(spawn.maxread, timeout)
File "/usr/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
return super(spawn, self).read_nonblocking(size)
File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 171, in read_nonblocking
raise EOF('End Of File (EOF). Exception style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 315, in scan
scan.expect('foooooo', timeout=timeout)
File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 341, in expect
timeout, searchwindowsize, async_)
File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 369, in expect_list
return exp.expect_loop(timeout)
File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 117, in expect_loop
return self.eof(e)
File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 63, in eof
raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7f72b0640630>
command: /usr/bin/hcitool
args: ['/usr/bin/hcitool', '-i', 'hci0', 'lescan']
buffer (last 100 chars): b''
before (last 100 chars): b'Set scan parameters failed: Input/output error\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: 1
flag_eof: True
pid: 58
child_fd: 53
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile(b'foooooo')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 184, in async_setup_platform
disc_info)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 114, in setup_scanner
update_ble(dt_util.utcnow())
File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 96, in update_ble
devs = discover_ble_devices()
File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 58, in discover_ble_devices
devs = adapter.scan()
File "/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 326, in scan
raise BLEError(message)
pygatt.exceptions.BLEError: BLE adapter requires reset after a scan as root- call adapter.reset()```
HA 0.93 - have similar issue after the HA starts:
ERROR (Thread-12) [pygatt.backends.gatttool.gatttool] BLE adapter requires reset after a scan as root- call adapter.reset()
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 now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Error during Bluetooth LE scan: Unexpected error when scanning: Set scan parameters failed: I/O error
in Home Assistant 0.106.5
I know this is closed, but it looks like the most relevant issue and wasn't solved. I have 0.112.4 with config:
device_tracker:
- platform: bluetooth_le_tracker
track_new_devices: true
and get the errors:
2020-07-16 10:38:20 INFO (SyncWorker_13) [pygatt.backends.gatttool.gatttool] Starting BLE scan
2020-07-16 10:38:20 ERROR (SyncWorker_13) [pygatt.backends.gatttool.gatttool] BLE adapter requires reset after a scan as root- call adapter.reset()
2020-07-16 10:38:20 ERROR (SyncWorker_13) [homeassistant.components.bluetooth_le_tracker.device_tracker] Error during Bluetooth LE scan: BLE adapter requires reset after a scan as root- call adapter.reset()
I've run the commands listed at https://www.home-assistant.io/integrations/bluetooth_le_tracker/#rootless-setup I tried this as the pi user; sudo doesn't work as the homeassistant user as it asks for a password and I don't think I have one for it. I'm running Raspbian buster on Raspberry Pi 4 with Home Assistant Core in a venv.
What can be done about this?
Home Assistant release with the issue: 0.79.3
Last working Home Assistant release (if known): Not known
Operating environment (Hass.io/Docker/Windows/etc.): Raspberry Pi 3/Raspian
Component/platform: device_tracker/ble https://www.home-assistant.io/components/device_tracker.bluetooth_le_tracker/
Description of problem: After restarting home assistant several times, the following exception appears in the log: BLE adapter requires reset after a scan as root- call adapter.reset() and the BLE component stops responding.
Problem-relevant
configuration.yaml
entries and (fill out even if it seems unimportant):Traceback (if applicable):
Additional information: