zweckj / lamarzocco

Interact with your La Marzocco espresso machine
54 stars 4 forks source link

Failed to initialize Integration due to bluetooth device #11

Closed dl-mai closed 10 months ago

dl-mai commented 11 months ago

Using the integration with Raspberry PI 4 and HA for my Micra since Sunday. The integration didn't work reliable and I couldn't figure it out until i checked the logs and saw the stacktrace. At first I only saw timeouts. Upon checking the stack trace I noticed it failed initializing the bleak client.

Since the Raspberry PI is in the basement i disabled the BT device. Since then if worked reliably for me.

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 209, in connect
    reply = await self._bus.call(
            ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/dbus_fast/aio/message_bus.py", line 399, in call
    await future
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/config/custom_components/lamarzocco/services.py", line 35, in call_service
    await func(*args, **kwargs)
  File "/config/custom_components/lamarzocco/lm_client.py", line 96, in set_power
    await self.get_hass_bt_client()
  File "/config/custom_components/lamarzocco/lm_client.py", line 172, in get_hass_bt_client
    await self._lm_bluetooth.new_bleak_client_from_ble_device(ble_device)
  File "/usr/local/lib/python3.11/site-packages/lmcloud/lmbluetooth.py", line 104, in new_bleak_client_from_ble_device
    await self._client.connect()
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/wrappers.py", line 292, in connect
    connected = await super().connect(**kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bleak/__init__.py", line 605, in connect
    return await self._backend.connect(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 146, in connect
    async with async_timeout(timeout):
  File "/usr/local/lib/python3.11/asyncio/timeouts.py", line 111, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2049, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/lamarzocco/switch.py", line 143, in async_turn_off
    await call_service(
  File "/config/custom_components/lamarzocco/services.py", line 38, in call_service
    raise HomeAssistantError(ex) from ex
homeassistant.exceptions.HomeAssistantError