sonicare-ble-hacs
sonicare-ble-hacs copied to clipboard
UnboundLocalError: cannot access local variable 'addr' where it is not associated with a value
I just updated to version f6a7b74 and my Sonicare was discovered. However when configuring said toothbrush, I got the following error:
This error originated from a custom integration.
Logger: custom_components.sonicare_bletb.config_flow
Source: components/esphome/bluetooth/client.py:317
Integration: sonicare_bletb
First occurred: 06:05:08 (1 occurrences)
Last logged: 06:05:08
Unexpected error
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/client.py", line 570, in bluetooth_device_connect
await event.wait()
File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/client.py", line 603, in bluetooth_device_connect
unsub()
File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/client.py", line 565, in unsub
self._connection.remove_message_callback(on_msg, msg_types)
File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/connection.py", line 535, in remove_message_callback
self._message_handlers[msg_type].remove(on_message)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: <class 'api_pb2.BluetoothDeviceConnectionResponse'>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/sonicare_bletb/config_flow.py", line 64, in async_step_user
await sonicare_ble.initialise()
File "/usr/local/lib/python3.11/site-packages/sonicare_bletb/sonicare_bletb.py", line 265, in initialise
await self._ensure_connected()
File "/usr/local/lib/python3.11/site-packages/sonicare_bletb/sonicare_bletb.py", line 314, in _ensure_connected
client = await establish_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/bleak_retry_connector/__init__.py", line 344, in establish_connection
await client.connect(
File "/usr/src/homeassistant/homeassistant/components/bluetooth/wrappers.py", line 272, in connect
connected = await super().connect(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/bleak/__init__.py", line 531, in connect
return await self._backend.connect(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 102, in _async_wrap_bluetooth_operation
return await func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 317, in connect
await self._client.bluetooth_device_connect(
File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/client.py", line 606, in bluetooth_device_connect
"%s: Bluetooth device connection canceled but already unsubscribed",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'addr' where it is not associated with a value