aiohomekit icon indicating copy to clipboard operation
aiohomekit copied to clipboard

BLE callbacks can error if a device is unpairing because the cache has been deleted

Open bdraco opened this issue 11 months ago • 0 comments

2023-07-19 13:31:02.329 DEBUG (MainThread) [aiohomekit.controller.abstract] A133RDP8 [DB:AF:6E:65:E8:41] (id=89:A9:01:69:8C:83): Config number has changed from -1 to 1; char cache invalid
2023-07-19 13:31:02.330 ERROR (MainThread) [homeassistant.components.bluetooth.manager] Error in callback: <bound method BleController._device_detected of <aiohomekit.controller.ble.controller.BleController object at 0x2a6b1c4d0>>
Traceback (most recent call last):
  File "/Users/bdraco/home-assistant/homeassistant/components/bluetooth/manager.py", line 97, in _dispatch_bleak_callback
    callback(device, advertisement_data)
  File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/aiohomekit/controller/ble/controller.py", line 102, in _device_detected
    pairing._async_description_update(data)
  File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/aiohomekit/controller/ble/pairing.py", line 418, in _async_description_update
    self._update_cached_state_num(description.state_num)
  File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/aiohomekit/controller/ble/pairing.py", line 388, in _update_cached_state_num
    old_state_num = self._accessories_state.state_num
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state_num'

bdraco avatar Jul 19 '23 18:07 bdraco