TionAPI / HA-tion

Home assistant integration for Tion breezers
Apache License 2.0
72 stars 6 forks source link

Connection Rejected Due To Security Reasons [HA 2022.8.5, интеграция v4.0.0] #109

Closed tms320 closed 2 years ago

tms320 commented 2 years ago

Общая информация

Краткое описание

Вчера вечером обновил интеграцию до v4.0.0. Всё заработало нормально, бризер управлялся из HA. На ночь оставил бризер на минимальной скорости 1. Утром попытался увеличить скорость до 50% - и никакой реакции. На команды включения/выключения тоже не реагирует. Дебаг-логи для интеграции (в configuration.yaml) я, увы, вчера отключил. Поэтому в логах HA только это:

2022-08-17 23:48:15.785 CRITICAL (MainThread) [custom_components.ha_tion_btle] Response is {}
2022-08-17 23:48:15.787 ERROR (MainThread) [custom_components.ha_tion_btle] Unexpected error fetching Tion Breezer data: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected Due To Security Reasons)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
return await self.update_method()
File "/config/custom_components/ha_tion_btle/__init__.py", line 109, in async_update_state
raise e
File "/config/custom_components/ha_tion_btle/__init__.py", line 99, in async_update_state
response = await self.__tion.get()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 208, in get
await self.get_state_from_breezer()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 188, in get_state_from_breezer
await self.connect()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 505, in connect
await self._connect()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 308, in _connect
await self._enable_notifications()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 337, in _enable_notifications
raise e
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 334, in _enable_notifications
await self._btle.start_notify(self.uuid_notify, self._delegation.handleNotification)
File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 825, in start_notify
assert_reply(reply)
File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected Due To Security Reasons)
2022-08-17 23:55:46.783 WARNING (MainThread) [tion_btle.tion] Got exception [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected Due To Security Reasons) while enabling notifications!
2022-08-17 23:55:46.786 CRITICAL (MainThread) [custom_components.ha_tion_btle] Response is {}
2022-08-17 23:55:46.788 ERROR (MainThread) [custom_components.ha_tion_btle] Unexpected error fetching Tion Breezer data: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected Due To Security Reasons)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
return await self.update_method()
File "/config/custom_components/ha_tion_btle/__init__.py", line 109, in async_update_state
raise e
File "/config/custom_components/ha_tion_btle/__init__.py", line 99, in async_update_state
response = await self.__tion.get()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 208, in get
await self.get_state_from_breezer()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 188, in get_state_from_breezer
await self.connect()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 505, in connect
await self._connect()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 308, in _connect
await self._enable_notifications()
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 337, in _enable_notifications
raise e
File "/usr/local/lib/python3.10/site-packages/tion_btle/tion.py", line 334, in _enable_notifications
await self._btle.start_notify(self.uuid_notify, self._delegation.handleNotification)
File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 825, in start_notify
assert_reply(reply)
File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected Due To Security Reasons)
2022-08-18 02:16:30.606 WARNING (MainThread) [tion_btle.tion] Got exception: [org.bluez.Error.Failed] le-connection-abort-by-local. Will try again

Утром перезапустил HA - всё заработало, бризер управляется, в логах ошибок нет. Буду наблюдать дальше...

IATkachenko commented 2 years ago

Есть одна идея, связанная с тем что я сейчас не обновляю bleak-device каждый раз (что не совсем корректное поведение). В логах сервера (dmesg/messages/journalctl) нет ничего про BT адаптер?

tms320 commented 2 years ago

В логах сервера (dmesg/messages/journalctl) нет ничего про BT адаптер?

Попытался отфильтровать (по ключевым словам tion/bleak/bluetooth) логи сервера-хоста, где установлен HA, начиная со вчерашнего вечера и до утра. См. вложение: log.txt PS: за прошедший день проблем не было.

IATkachenko commented 2 years ago

Скорее всего исправлено в v4.0.1.