Jc2k/aiohomekit

Don't process disconnected events until pairing is completed

bdraco opened this issue · 1 comments

Looks like this is been an issue forever but now only obvious since we look up a char

Oct 24 14:02:17 homeassistant homeassistant[483]: 2022-10-24 09:02:17.612 DEBUG (MainThread) [aiohomekit.controller.ble.pairing] Eve Room 0881 [EF:69:05:18:C5:37] (id=22:28:60:67:C0:6F): Polling subscriptions for changes during disconnection; rssi=-64
Oct 24 14:02:17 homeassistant homeassistant[483]: 2022-10-24 09:02:17.612 ERROR (MainThread) [aiohomekit.utils] Failure running background task: Task-19716
Oct 24 14:02:17 homeassistant homeassistant[483]: Traceback (most recent call last):
Oct 24 14:02:17 homeassistant homeassistant[483]:   File "/usr/local/lib/python3.10/site-packages/aiohomekit/utils.py", line 29, in _handle_task_result
Oct 24 14:02:17 homeassistant homeassistant[483]:     task.result()
Oct 24 14:02:17 homeassistant homeassistant[483]:   File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/pairing.py", line 470, in _process_disconnected_events
Oct 24 14:02:17 homeassistant homeassistant[483]:     protocol_param = await self.get_all_protocol_params()
Oct 24 14:02:17 homeassistant homeassistant[483]:   File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/pairing.py", line 144, in _async_operation_lock_wrap
Oct 24 14:02:17 homeassistant homeassistant[483]:     return await func(self, *args, **kwargs)
Oct 24 14:02:17 homeassistant homeassistant[483]:   File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 600, in _async_wrap_bluetooth_connection_error_retry
Oct 24 14:02:17 homeassistant homeassistant[483]:     return await func(*args, **kwargs)
Oct 24 14:02:17 homeassistant homeassistant[483]:   File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/pairing.py", line 746, in get_all_protocol_params
Oct 24 14:02:17 homeassistant homeassistant[483]:     return await self._get_all_protocol_params()
Oct 24 14:02:17 homeassistant homeassistant[483]:   File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/pairing.py", line 756, in _get_all_protocol_params
Oct 24 14:02:17 homeassistant homeassistant[483]:     hap_char = info[CharacteristicsTypes.SERVICE_SIGNATURE]
Oct 24 14:02:17 homeassistant homeassistant[483]:   File "/usr/local/lib/python3.10/site-packages/aiohomekit/model/services/service.py", line 105, in __getitem__
Oct 24 14:02:17 homeassistant homeassistant[483]:     return self.characteristics_by_type[key]
Oct 24 14:02:17 homeassistant homeassistant[483]: KeyError: '000000A5-0000-1000-8000-0026BB765291'

found this will testing with an eve room 1 trying to replicate home-assistant/core#80177