You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 96, in _async_wrap_bluetooth_operation
return await func(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 540, in write_gatt_char
await self._client.bluetooth_gatt_write(
File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/client.py", line 667, in bluetooth_gatt_write
await self._send_bluetooth_message_await_response(
File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/client.py", line 440, in _send_bluetooth_message_await_response
raise BluetoothGATTAPIError(BluetoothGATTError.from_pb(resp[0]))
aioesphomeapi.core.BluetoothGATTAPIError: Bluetooth GATT Error address=90:38:0C:61:82:42 handle=21 error=-1 description=Not connected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pysnooz/commands.py", line 171, in _async_execute_wrapper
await self._async_execute(api)
File "/usr/local/lib/python3.10/site-packages/pysnooz/commands.py", line 261, in _async_execute
await api.async_set_power(self.command.on)
File "/usr/local/lib/python3.10/site-packages/pysnooz/api.py", line 86, in async_set_power
await self._async_write_command(CommandId.SET_POWER, b"\x01" if on else b"\x00")
File "/usr/local/lib/python3.10/site-packages/pysnooz/api.py", line 129, in _async_write_command
await self._client.write_gatt_char(
File "/usr/local/lib/python3.10/site-packages/bleak/init.py", line 593, in write_gatt_char
await self._backend.write_gatt_char(char_specifier, data, response)
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 79, in _async_wrap_bluetooth_connected_operation
await task
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 117, in _async_wrap_bluetooth_operation
self._async_ble_device_disconnected()
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 197, in _async_ble_device_disconnected
self._async_disconnected_cleanup()
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 192, in _async_disconnected_cleanup
self._unsubscribe_connection_state()
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 168, in _unsubscribe_connection_state
self._cancel_connection_state()
File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/client.py", line 534, in unsub
self._connection.remove_message_callback(on_msg, msg_types)
File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 455, in remove_message_callback
self._message_handlers[msg_type].remove(on_message)
KeyError: <class 'api_pb2.BluetoothDeviceConnectionResponse'>
Environment
Home Assistant Component
Additional details
Home Assistant 2023.1.7
Supervisor 2022.12.1
Operating System 9.4
Frontend 20230110.0 - latest
Using ESPHome bluetooth proxy. Snooz stops working randomly unless I restart Home Assistant.
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. It appears that there's a disconnection scenario that's not handled gracefully by pysnooz that's unique to bluetooth proxies. I haven't been available in the last month to work on this, but I'm hoping to get to this soon.
The fix should be straightforward - I think the first step is figuring out if this should be handled in esphome or this library, since currently the library is not aware of esphome or its implementation details.
Following up on this issue. @clanterns11 can you verify this still occurs on the latest releases of ESPHome bluetooth proxies? If it does, please enable debug logs so we can isolate the issue.
# Home Assistant configuration.yamllogger:
default: infologs:
homeassistant.components.snooz: debugpysnooz: debug
Is there an existing issue for this?
Stack trace
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 96, in _async_wrap_bluetooth_operation
return await func(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 540, in write_gatt_char
await self._client.bluetooth_gatt_write(
File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/client.py", line 667, in bluetooth_gatt_write
await self._send_bluetooth_message_await_response(
File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/client.py", line 440, in _send_bluetooth_message_await_response
raise BluetoothGATTAPIError(BluetoothGATTError.from_pb(resp[0]))
aioesphomeapi.core.BluetoothGATTAPIError: Bluetooth GATT Error address=90:38:0C:61:82:42 handle=21 error=-1 description=Not connected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pysnooz/commands.py", line 171, in _async_execute_wrapper
await self._async_execute(api)
File "/usr/local/lib/python3.10/site-packages/pysnooz/commands.py", line 261, in _async_execute
await api.async_set_power(self.command.on)
File "/usr/local/lib/python3.10/site-packages/pysnooz/api.py", line 86, in async_set_power
await self._async_write_command(CommandId.SET_POWER, b"\x01" if on else b"\x00")
File "/usr/local/lib/python3.10/site-packages/pysnooz/api.py", line 129, in _async_write_command
await self._client.write_gatt_char(
File "/usr/local/lib/python3.10/site-packages/bleak/init.py", line 593, in write_gatt_char
await self._backend.write_gatt_char(char_specifier, data, response)
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 79, in _async_wrap_bluetooth_connected_operation
await task
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 117, in _async_wrap_bluetooth_operation
self._async_ble_device_disconnected()
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 197, in _async_ble_device_disconnected
self._async_disconnected_cleanup()
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 192, in _async_disconnected_cleanup
self._unsubscribe_connection_state()
File "/usr/src/homeassistant/homeassistant/components/esphome/bluetooth/client.py", line 168, in _unsubscribe_connection_state
self._cancel_connection_state()
File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/client.py", line 534, in unsub
self._connection.remove_message_callback(on_msg, msg_types)
File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 455, in remove_message_callback
self._message_handlers[msg_type].remove(on_message)
KeyError: <class 'api_pb2.BluetoothDeviceConnectionResponse'>
Environment
Home Assistant Component
Additional details
Home Assistant 2023.1.7
Supervisor 2022.12.1
Operating System 9.4
Frontend 20230110.0 - latest
Using ESPHome bluetooth proxy. Snooz stops working randomly unless I restart Home Assistant.
The text was updated successfully, but these errors were encountered: