I have encountered a problem with setting up the bluetooth_tracker where HA is initialized before the bluetoothd is finished setting up bluetooth (running HA 0.59.2 on hassbian).
If I reboot the PI, this shows up in the logs:
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/device_tracker/init.py”, line 156, in async_setup_platform
disc_info)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/device_tracker/bluetooth_tracker.py”, line 64, in setup_scanner
for dev in discover_devices():
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/device_tracker/bluetooth_tracker.py”, line 42, in discover_devices
lookup_class=False)
File “/srv/homeassistant/lib/python3.5/site-packages/bluetooth/bluez.py”, line 26, in discover_devices
device_id = _bt.hci_get_route()
OSError: [Errno 19] No such device
Now, if I wait for the /var/run/sdp device to be ready (and change the access rights when device exist so HA has access to the device, which I do automatically on boot) and then restart the HA service manually, the bluetooth_tracker is setup correctly.
The best(?) way to solve it, I think, would be to let the bluetooth_tracker monitor the creation of /var/run/sdp, and initialize when its ready, but I don’t know if the component has support for this? At least, I can’t find anything in the docs.
Anyone else got this problem? Or better yet, the solution for it?
EDIT: I am running the bluetoothd in “–compat” mode. Haven’t found a way to make it work with the new BlueZ 5 DBus API, but if anyone got a solution for it, it would be ideal.