TionAPI / HA-tion

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

Странное поведение интеграции #114

Closed fishenebelny closed 2 years ago

fishenebelny commented 2 years ago

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

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

Наблюдал работы компонента в bluetoothctl и обратил внимание, что подключение к бризеру D5:91:DD:FC:1A:60 прошло успешно. Однако команды на отключение, как обычно это происходит в режим ожидания (запросы каждую минуту) не прошло. И компонент как бы завис на этом бризере. При этом команда disconnect отправленная через bluetoothctl отработала без ошибок. Сам Тион D5:91:DD:FC:1A:60 находится на расстоянии 3х метров в прямой видимости (без преград в виде капитальных стен). А вот второй Тион, как раз находится за капитальной стеной, но он прекрасно продолжает работать.

Debug-log

2022-09-15 14:21:02.225 INFO (MainThread) [custom_components.ha_tion_btle] update_btle_device called with service_info=BluetoothServiceInfoBleak(name='Tion Breezer 3S', address='D5:91:DD:FC:1A:60', rssi=0, manufacturer_data={}, service_data={}, service_uuids=['00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', '6e400001-b5a3-f393-e0a9-e50e24dcca9e'], source='local', device=D5:91:DD:FC:1A:60: Tion Breezer 3S, advertisement=AdvertisementData(local_name='Tion Breezer 3S', service_uuids=['00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', '6e400001-b5a3-f393-e0a9-e50e24dcca9e'])), _change=<BluetoothChange.ADVERTISEMENT: 1>
2022-09-15 14:21:02.974 DEBUG (MainThread) [tion_btle.tion] Enabling notification. self.connection_status='disc'
2022-09-15 14:21:02.974 WARNING (MainThread) [tion_btle.tion] Got exception Not connected while enabling notifications!
2022-09-15 14:21:02.981 DEBUG (MainThread) [tion_btle.tion] Disconnecting. self.connection_status='disc'.
2022-09-15 14:21:02.982 DEBUG (MainThread) [tion_btle.tion] _disconnect done. self.connection_status='disc'
2022-09-15 14:21:02.982 CRITICAL (MainThread) [custom_components.ha_tion_btle] Response is {}
2022-09-15 14:21:02.986 ERROR (MainThread) [custom_components.ha_tion_btle] Unexpected error fetching Tion Kids data: Not connected
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 123, in async_update_state
raise e
File "/config/custom_components/ha_tion_btle/__init__.py", line 113, 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 779, in start_notify
raise BleakError("Not connected")
bleak.exc.BleakError: Not connected
2022-09-15 14:21:03.003 DEBUG (MainThread) [custom_components.ha_tion_btle] Finished fetching Tion Kids data in 1.003 seconds (success: False)
2022-09-15 14:21:58.001 INFO (MainThread) [custom_components.ha_tion_btle] Tion instance update started
2022-09-15 14:21:58.001 DEBUG (MainThread) [tion_btle.tion] Connecting. self.connection_status='disc'.
2022-09-15 14:21:58.001 DEBUG (MainThread) [tion_btle.tion] Trying 0/1: _try_connect(args=(<tion_btle.s3.TionS3 object at 0xac97b640>,),kwargs={})
2022-09-15 14:21:59.086 DEBUG (MainThread) [tion_btle.tion] Enabling notification. self.connection_status='connected'
2022-09-15 14:21:59.184 DEBUG (MainThread) [tion_btle.tion] _enable_notifications done
2022-09-15 14:21:59.185 DEBUG (MainThread) [tion_btle.tion] _connect done. self.connection_status='connected'.
2022-09-15 14:21:59.185 DEBUG (MainThread) [tion_btle.tion] Trying 0/3: _try_write(args=(<tion_btle.s3.TionS3 object at 0xac97b640>,),kwargs={'request': bytearray(b'=\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Z')})
2022-09-15 14:21:59.185 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e, self.connection_status='connected'
2022-09-15 14:21:59.319 DEBUG (MainThread) [tion_btle.tion] Collecting data
2022-09-15 14:21:59.322 DEBUG (MainThread) [tion_btle.tion] Got data in 10 response b310211301001313139f000c3600006c0033005a
2022-09-15 14:21:59.323 DEBUG (MainThread) [tion_btle.tion] self._data=[bytearray(b'\xb3\x10!\x13\x01\x00\x13\x13\x13\x9f\x00\x0c6\x00\x00l\x003\x00Z')]
2022-09-15 14:22:00.321 DEBUG (MainThread) [tion_btle.tion] Disconnecting. self.connection_status='connected'.
2022-09-15 14:22:03.043 DEBUG (MainThread) [tion_btle.tion] _disconnect done. self.connection_status='disc'
2022-09-15 14:22:03.043 DEBUG (MainThread) [tion_btle.s3] Data is b310211301001313139f000c3600006c0033005a
2022-09-15 14:22:03.044 DEBUG (MainThread) [custom_components.ha_tion_btle] Result is {'state': 'off', 'heater': True, 'heating': 'off', 'sound': 'off', 'mode': 'outside', 'out_temp': 19, 'in_temp': 19, 'heater_temp': 19, 'fan_speed': 1, 'filter_remain': 159, 'time': '12:54', 'request_error_code': 0, 'model': 'S3', 'code': 200, 'timer': 'off', 'productivity': 0, 'fw_version': '0033', 'is_on': False, 'is_heating': False}
2022-09-15 14:22:03.044 DEBUG (MainThread) [custom_components.ha_tion_btle] Finished fetching Tion Bedroom data in 5.044 seconds (success: True)
2022-09-15 14:23:03.001 INFO (MainThread) [custom_components.ha_tion_btle] Tion instance update started
2022-09-15 14:23:03.001 DEBUG (MainThread) [tion_btle.tion] Connecting. self.connection_status='disc'.
2022-09-15 14:23:03.001 DEBUG (MainThread) [tion_btle.tion] Trying 0/1: _try_connect(args=(<tion_btle.s3.TionS3 object at 0xac97b640>,),kwargs={})
2022-09-15 14:23:04.166 DEBUG (MainThread) [tion_btle.tion] Enabling notification. self.connection_status='connected'
2022-09-15 14:23:04.257 DEBUG (MainThread) [tion_btle.tion] _enable_notifications done
2022-09-15 14:23:04.257 DEBUG (MainThread) [tion_btle.tion] _connect done. self.connection_status='connected'.
2022-09-15 14:23:04.257 DEBUG (MainThread) [tion_btle.tion] Trying 0/3: _try_write(args=(<tion_btle.s3.TionS3 object at 0xac97b640>,),kwargs={'request': bytearray(b'=\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Z')})
2022-09-15 14:23:04.258 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e, self.connection_status='connected'
2022-09-15 14:23:04.390 DEBUG (MainThread) [tion_btle.tion] Collecting data
2022-09-15 14:23:04.393 DEBUG (MainThread) [tion_btle.tion] Got data in 10 response b310211301001313139f000c3800006c0033005a
2022-09-15 14:23:04.394 DEBUG (MainThread) [tion_btle.tion] self._data=[bytearray(b'\xb3\x10!\x13\x01\x00\x13\x13\x13\x9f\x00\x0c8\x00\x00l\x003\x00Z')]
2022-09-15 14:23:05.392 DEBUG (MainThread) [tion_btle.tion] Disconnecting. self.connection_status='connected'.
2022-09-15 14:23:08.006 DEBUG (MainThread) [tion_btle.tion] _disconnect done. self.connection_status='disc'
2022-09-15 14:23:08.007 DEBUG (MainThread) [tion_btle.s3] Data is b310211301001313139f000c3800006c0033005a
2022-09-15 14:23:08.007 DEBUG (MainThread) [custom_components.ha_tion_btle] Result is {'state': 'off', 'heater': True, 'heating': 'off', 'sound': 'off', 'mode': 'outside', 'out_temp': 19, 'in_temp': 19, 'heater_temp': 19, 'fan_speed': 1, 'filter_remain': 159, 'time': '12:56', 'request_error_code': 0, 'model': 'S3', 'code': 200, 'timer': 'off', 'productivity': 0, 'fw_version': '0033', 'is_on': False, 'is_heating': False}
2022-09-15 14:23:08.007 DEBUG (MainThread) [custom_components.ha_tion_btle] Finished fetching Tion Bedroom data in 5.007 seconds (success: True)
2022-09-15 14:24:08.002 INFO (MainThread) [custom_components.ha_tion_btle] Tion instance update started
2022-09-15 14:24:08.003 DEBUG (MainThread) [tion_btle.tion] Connecting. self.connection_status='disc'.
2022-09-15 14:24:08.003 DEBUG (MainThread) [tion_btle.tion] Trying 0/1: _try_connect(args=(<tion_btle.s3.TionS3 object at 0xac97b640>,),kwargs={})
2022-09-15 14:24:08.993 DEBUG (MainThread) [tion_btle.tion] Enabling notification. self.connection_status='connected'
2022-09-15 14:24:09.069 DEBUG (MainThread) [tion_btle.tion] _enable_notifications done
2022-09-15 14:24:09.069 DEBUG (MainThread) [tion_btle.tion] _connect done. self.connection_status='connected'.
2022-09-15 14:24:09.069 DEBUG (MainThread) [tion_btle.tion] Trying 0/3: _try_write(args=(<tion_btle.s3.TionS3 object at 0xac97b640>,),kwargs={'request': bytearray(b'=\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Z')})
2022-09-15 14:24:09.069 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e, self.connection_status='connected'

Как можно воспроизвети вашу проблему

Не знаю.

Дополнительное описание

Проблема примерно в 14:21 произошла. Нашел последнее подключение к Тиону D5:91:DD:FC:1A:60 (Tion Kids). После подключений к нему не было. image

IATkachenko commented 2 years ago

Видимо исправлено в v4.1.0.