aiohomekit icon indicating copy to clipboard operation
aiohomekit copied to clipboard

There is a race where we can be waiting for the device to be detected at startup and we get it more than once because we don't clear it before its detected again

Open bdraco opened this issue 1 year ago • 0 comments

2022-12-03 18:26:47.215 ERROR (MainThread) [homeassistant.components.bluetooth.manager] Error in callback: <bound method BleController._device_detected of <aiohomekit.controller.ble.controller.BleController object at 0x7f6ac8a69450>>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/manager.py", line 92, in _dispatch_bleak_callback
    callback(device, advertisement_data)
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/controller.py", line 106, in _device_detected
    future.set_result(discovery)
asyncio.exceptions.InvalidStateError: invalid state
2022-12-03 18:26:47.225 DEBUG (MainThread) [aiohomekit.controller.ble.pairing] [CE:E7:37:9D:36:60] (id=D5:2F:11:1D:88:F2): Description updated: old=None new=HomeKitAdvertisement(name='VOCOlinc-VS1-1857C6', id='d5:2f:11:1d:88:f2', status_flags=<StatusFlags.0: 0>, config_num=1, category=<Categories.SENSOR: 10>, setup_hash=b'\xb00U\xa3', address='CE:E7:37:9D:36:60', state_num=34)
2022-12-03 18:26:47.225 DEBUG (MainThread) [aiohomekit.controller.abstract] [CE:E7:37:9D:36:60] (id=D5:2F:11:1D:88:F2): Description updated: old=None new=HomeKitAdvertisement(name='VOCOlinc-VS1-1857C6', id='d5:2f:11:1d:88:f2', status_flags=<StatusFlags.0: 0>, config_num=1, category=<Categories.SENSOR: 10>, setup_hash=b'\xb00U\xa3', address='CE:E7:37:9D:36:60', state_num=34)
2022-12-03 18:26:47.226 DEBUG (MainThread) [aiohomekit.controller.abstract] [CE:E7:37:9D:36:60] (id=D5:2F:11:1D:88:F2): Disconnected event notification received; Triggering catch-up poll
2022-12-03 18:26:47.229 DEBUG (MainThread) [aiohomekit.controller.ble.controller] BLE device for CE:E7:37:9D:36:60 found, fulfilling futures
2022-12-03 18:26:47.229 ERROR (MainThread) [homeassistant.components.bluetooth.manager] Error in callback: <bound method BleController._device_detected of <aiohomekit.controller.ble.controller.BleController object at 0x7f6ac8a69450>>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/manager.py", line 92, in _dispatch_bleak_callback
    callback(device, advertisement_data)
  File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/controller.py", line 106, in _device_detected
    future.set_result(discovery)
asyncio.exceptions.InvalidStateError: invalid state

bdraco avatar Dec 03 '22 18:12 bdraco