lkempf/casambi-bt-hass

Unexpected error creating network 6D:2A:B2:63:D8:B0

tjorim opened this issue · 1 comments

tjorim commented

Describe the bug
Updated integration, restarted HA and was greeted with an error (setting up entry Evolution for casambi_bt).
I turned the light on and off in the Casambi app directly without issues.
Afterwards I reloaded the integration and it worked all of a sudden, not sure why.

To Reproduce
Steps to reproduce the behavior:

  1. Install the latest version
  2. Restart Home Assistant
  3. See error

Expected behavior
I can control the light via HA.

Versions

  • HA version: 2023.12.0b2
  • Integration version: 18179d8

Logs

Logger: homeassistant.config_entries
Source: config_entries.py:402
First occurred: 00:05:58 (1 occurrences)
Last logged: 00:05:58

Error setting up entry Evolution for casambi_bt: Unexpected error creating network 6D:2A:B2:63:D8:B0
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 79, in _async_wrap_bluetooth_operation
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 539, in read_gatt_char
    return await self._client.bluetooth_gatt_read(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/client.py", line 753, in bluetooth_gatt_read
    return await self._bluetooth_gatt_read(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/client.py", line 783, in _bluetooth_gatt_read
    resp = await self._send_bluetooth_message_await_response(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aioesphomeapi/client.py", line 465, in _send_bluetooth_message_await_response
    raise BluetoothGATTAPIError(BluetoothGATTError.from_pb(resp))
aioesphomeapi.core.BluetoothGATTAPIError: Bluetooth GATT Error address=6D:2A:B2:63:D8:B0 handle=9 error=133 description=Error

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/casambi_bt/__init__.py", line 83, in async_casmbi_api_setup
    await casa.connect(device, password)
  File "/usr/local/lib/python3.11/site-packages/CasambiBt/_casambi.py", line 139, in connect
    await self._connectClient()
  File "/usr/local/lib/python3.11/site-packages/CasambiBt/_casambi.py", line 146, in _connectClient
    await self._casaClient.exchangeKey(self._casaNetwork.getKeyStore())  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/CasambiBt/_client.py", line 148, in exchangeKey
    firstResp = await self._gattClient.read_gatt_char(CASA_AUTH_CHAR_UUID)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bleak/__init__.py", line 711, in read_gatt_char
    return await self._backend.read_gatt_char(char_specifier, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 106, in _async_wrap_bluetooth_operation
    raise BleakError(str(ex)) from ex
bleak.exc.BleakError: Bluetooth GATT Error address=6D:2A:B2:63:D8:B0 handle=9 error=133 description=Error

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/casambi_bt/__init__.py", line 31, in async_setup_entry
    casa_api = await async_casmbi_api_setup(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/casambi_bt/__init__.py", line 95, in async_casmbi_api_setup
    raise ConfigEntryError(f"Unexpected error creating network {address}") from err
homeassistant.exceptions.ConfigEntryError: Unexpected error creating network 6D:2A:B2:63:D8:B0

Full (debug) log attached, including reload of integration.

home-assistant_2023-12-04T23-11-30.818Z.log

lkempf commented

This error was caused because HA tried to connect to Casambi using ESPHome but failed to connect to the ESP. That's outside of my control.