homeassistant-config icon indicating copy to clipboard operation
homeassistant-config copied to clipboard

Bluetooth LE Tracker Issues

Open brianjking opened this issue 6 years ago • 2 comments

2018-11-22 17:21:31 INFO (Thread-6) [pygatt.backends.gatttool.gatttool] Starting BLE scan
2018-11-22 17:21:31 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform bluetooth_le_tracker
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/device_tracker/__init__.py", line 184, 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_le_tracker.py", line 114, in setup_scanner
    update_ble(dt_util.utcnow())
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 96, in update_ble
    devs = discover_ble_devices()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 58, in discover_ble_devices
    devs = adapter.scan()
  File "/srv/homeassistant/lib/python3.5/site-packages/pygatt/backends/gatttool/gatttool.py", line 312, in scan
    scan = pexpect.spawn(cmd)
NameError: name 'pexpect' is not defined

https://github.com/brianjking/homeassistant-config/blob/master/configuration.yaml#L237-L239

  - platform: bluetooth_le_tracker
    device_id: hci0
    track_new_devices: True

https://www.home-assistant.io/components/device_tracker.bluetooth_le_tracker/

brianjking avatar Nov 22 '18 17:11 brianjking

Also encountered the same "bug". For reference I'am on RPi2 with external usb bt adapter BTW the fix is simple:

pip3 install pexpect

in your venv/containter/whatever runs homeassistant

hitokiri8x avatar Jan 02 '19 15:01 hitokiri8x

@hitokiri8x Thanks, I'm currently trying to sort out using Tile Trackers without the Tile app instead as it resolves the need to have Bluetooth turned on our phones for presence detection.

See here and #163

brianjking avatar Jan 02 '19 20:01 brianjking