TionAPI / HA-tion

Home assistant integration for Tion breezers
Apache License 2.0
70 stars 5 forks source link

Установка модуля + конфигурация #4

Closed fishenebelny closed 4 years ago

fishenebelny commented 4 years ago

Не могли бы вы описать реквизиты установи модуля и какой-то порядок действий чуть более детально? Я пробовал установить модуль на hassio (готовая флешка Home assistant). Но при попытке связать устройства получал ошибку. У меня сейчас все работает на Raspberry OS + venv установка Home assistant. Но, откровенно, я это смог "каким-то" образом установить. Пришлось вручную ставить Bluepy, tion-python. Потом вручную при помощи pair.py связывать Тионы. И сейчас все работает нестабильно. Перезагружаю систему, отправляю команду на Тион - все ок. Через 5 минут эту же команду, на этот же Тион уже не отправить. Все висит. И выглядит так, что висит из-за этой команды все.

fishenebelny commented 4 years ago

И вспомнил. Что пришлось как-то править модуль tion-python. Кажется pair.py. В этом скрипте использовался класс s3, а его почему-то не было в python. Пришлось где-то переименовать с s3 на tion. И заработало.

IATkachenko commented 4 years ago

@fishenebelny, что касается текущей ситуации (зависание при отправке команды, что похоже на #2 ):

  1. повысьте, пожалуйста уровень логов для модуля добавив в configuration.yaml и пришлите момент зависания:
    logger:
    default: warning
    logs:
    custom_components.tion.climate: debug
    s3: debug
    tion: debug
    tion.s3: debug
    1. в #1 тоже жаловались на проблемы с установкой компонент. Как именно вы устанавливаете custom component: через HACS или в ручную?
    2. как именно выглядит ошибка при связывании устройств? (тут мы вряд ли сможем получить дополнительную информацию, поскольку pairing уже выполнен, но возможно сохранились логи/скриншоты итд)

pair сейчас посмотрю.

IATkachenko commented 4 years ago

Pair поправил. Спасибо!

fishenebelny commented 4 years ago

Я пока удалил компонент полнлстью (даже Bluepy и удалил paired device через bluetoothctl), так как зависания были, а сейчас пропали. Пока такие ощущения. Готов его установить и проверить все с нуля.

Я правильнл понимаю, что должна быть железка с BT(Raspberry pi 4 4Gb в моем случае) и Tion 3S (2 шт. в моем случае). В такой конфигурации все долюно работать без видимых проблем? Тип ОС (Raspbian или Hassio) не имеет значение? Я под hassio пробовал ставить, но там почему-то Bluepy не ставился никак....

fishenebelny commented 4 years ago

И простая установка модуля HA-Tion через HACS? При жтом tion-python, Bluepy ручкаии ставить не предполагается? Верно?

IATkachenko commented 4 years ago

@fishenebelny, доброго дня.

Спасибо за предложение помочь с проверкой установки. Было бы не плохо. Я посмотрел как другие компоненты используют bluepy: они указывают версию. Сделал также (обновление будет в v1.2.3, в ближайшие часы сделаю). Может быть это решит проблемы. Но не факт, поскольку все компоненты включенные в HA используют wheels с предсобранным bluepy (https://github.com/home-assistant/core/issues/24441). Если после задания версии проблемы при установке bluepy сохранятся -- дайте, пожалуйста, занть. Форсирую свои планы в этом направлении.

И простая установка модуля HA-Tion через HACS? При жтом tion-python, Bluepy ручкаии ставить не предполагается? Верно?

Верно. Идея перехода к установке через HACS и настройке через GUI именно в этом: чтобы пользователь ничего дополнительно не делал.

Про зависания: если будет возможность выложите debug логи в #2 (и давайте с этим вопросом туда перебираться, чтобы вся информация была в одном месте). Ситуация для меня непонятная: у самого (Raspberry 3, HA через venv, HASC+GUI, а до этого configuration.yaml + manual installation) все работает и никаких зависаний нет. Единственное подозрение такое: 2 инстанса одновременно начинают опрашивать свои бризеры и дерутся за BT. Так ли это покажет лог.

fishenebelny commented 4 years ago

Проверил установку (Pi4 + venv + HA-Tion 1.2.5) - работает. Спаривается. Но не с первого раза, несмотря на то, что устройство добавилось и сказало что все прекрасно. Однако, ничего не работает. Захожу в bluetootchctl:

  1. paired-devices - тион есть.
  2. в консоле постоянно пишется device connected yes, потом no. Соответственно управление недоступно (хотя до этого-то работало, хоть и с зависаниями)

Проверил как телефон с точки установки малины подключается. Телефон подключился. Даже подключился к более дальнему тиону. Включил логи как описано выше. Выключил малину. Перенес малину в прямую видимость на расстоянии 5 метров. Включил. Объект climate,.tion_2 недоступен.

В логах пишет ошибку что-то там про сенсор было. Ниже логи.

Ниже логи ``` Tion instance updated at 2020-08-23 21:34:46.521150+00:00 0:36:46 – Tion breezer (WARNING) - первое сообщение получено 0:27:16 и повторялось 20 раз Got exception while _connect: Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random 0:36:19 – /srv/homeassistant/lib/python3.7/site-packages/tion_btle/tion.py (WARNING) - первое сообщение получено 0:28:19 и повторялось 22 раз Got Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random exception 0:36:17 – /srv/homeassistant/lib/python3.7/site-packages/tion_btle/tion.py (WARNING) - первое сообщение получено 0:28:17 и повторялось 21 раз Error doing job: Task exception was never retrieved 0:35:49 – custom_components/tion/__init__.py (ERROR) Response is {'code': 400, 'error': "Got exception ('_connect', 'Could not connect to d5:91:dd:fc:1a:60')"} 0:35:49 – Tion breezer (CRITICAL) - первое сообщение получено 0:28:25 и повторялось 7 раз Error doing job: Task exception was never retrieved 0:30:54 – custom_components/tion/__init__.py (ERROR) - первое сообщение получено 0:28:25 и повторялось 6 раз ('_connect', 'Could not connect to d5:91:dd:fc:1a:60') 0:30:54 – /srv/homeassistant/lib/python3.7/site-packages/tion_btle/s3.py (ERROR) - первое сообщение получено 0:28:25 и повторялось 6 раз You are using a custom integration for gismeteo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 0:28:25 – loader.py (WARNING) - первое сообщение получено 0:21:36 и повторялось 2 раз Error doing job: Task exception was never retrieved 0:27:51 – custom_components/tion/__init__.py (ERROR) Will delay next check 0:27:51 – Tion breezer (CRITICAL) - первое сообщение получено 0:27:19 и повторялось 2 раз Got exception Device disconnected 0:27:51 – Tion breezer (CRITICAL) - первое сообщение получено 0:27:19 и повторялось 2 раз Unable to prepare setup for platform tion.sensor: Platform not found (No module named 'custom_components.tion.sensor'). 0:27:19 – setup.py (ERROR) Error while setting up tion platform for climate 0:27:19 – Климат (ERROR) Ended unfinished session (id=104 from 2020-08-23 21:05:01.811886) 0:21:31 – Recorder (WARNING) ```
Ниже полный лог. Файл не нашел как прикрепить. Там много получается. Ниже полный лог. Файл не нашел как прикрепить. Там много получается. ``` 2020-08-23 22:21:29 INFO (MainThread) [homeassistant.bootstrap] Config directory: /home/homeassistant/.homeassistant 2020-08-23 22:21:29 INFO (SyncWorker_1) [homeassistant.loader] Loaded gismeteo from custom_components.gismeteo 2020-08-23 22:21:29 INFO (SyncWorker_4) [homeassistant.loader] Loaded mosenergosbyt from custom_components.mosenergosbyt 2020-08-23 22:21:29 INFO (SyncWorker_6) [homeassistant.loader] Loaded hacs from custom_components.hacs 2020-08-23 22:21:29 INFO (SyncWorker_3) [homeassistant.loader] Loaded sonoff from custom_components.sonoff 2020-08-23 22:21:29 INFO (SyncWorker_1) [homeassistant.loader] Loaded tion from custom_components.tion 2020-08-23 22:21:29 INFO (SyncWorker_0) [homeassistant.loader] Loaded homeassistant from homeassistant.components.homeassistant 2020-08-23 22:21:29 INFO (SyncWorker_7) [homeassistant.loader] Loaded persistent_notification from homeassistant.components.persistent_notification 2020-08-23 22:21:29 INFO (MainThread) [homeassistant.setup] Setting up homeassistant 2020-08-23 22:21:29 INFO (MainThread) [homeassistant.setup] Setup of domain homeassistant took 0.0 seconds 2020-08-23 22:21:29 INFO (MainThread) [homeassistant.setup] Setting up persistent_notification 2020-08-23 22:21:29 INFO (MainThread) [homeassistant.setup] Setup of domain persistent_notification took 0.0 seconds 2020-08-23 22:21:29 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 2020-08-23 22:21:29 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for tion which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 2020-08-23 22:21:29 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 2020-08-23 22:21:29 INFO (SyncWorker_14) [homeassistant.loader] Loaded shopping_list from homeassistant.components.shopping_list 2020-08-23 22:21:29 INFO (SyncWorker_0) [homeassistant.loader] Loaded sensor from homeassistant.components.sensor 2020-08-23 22:21:29 INFO (SyncWorker_21) [homeassistant.loader] Loaded met from homeassistant.components.met 2020-08-23 22:21:29 INFO (SyncWorker_3) [homeassistant.loader] Loaded cast from homeassistant.components.cast 2020-08-23 22:21:29 INFO (SyncWorker_2) [homeassistant.loader] Loaded group from homeassistant.components.group 2020-08-23 22:21:29 INFO (SyncWorker_4) [homeassistant.loader] Loaded zha from homeassistant.components.zha 2020-08-23 22:21:29 INFO (SyncWorker_10) [homeassistant.loader] Loaded logger from homeassistant.components.logger 2020-08-23 22:21:29 INFO (SyncWorker_9) [homeassistant.loader] Loaded tts from homeassistant.components.tts 2020-08-23 22:21:29 INFO (SyncWorker_1) [homeassistant.loader] Loaded scene from homeassistant.components.scene 2020-08-23 22:21:29 INFO (SyncWorker_8) [homeassistant.loader] Loaded utility_meter from homeassistant.components.utility_meter 2020-08-23 22:21:29 INFO (SyncWorker_6) [homeassistant.loader] Loaded recorder from homeassistant.components.recorder 2020-08-23 22:21:29 INFO (SyncWorker_18) [homeassistant.loader] Loaded weather from homeassistant.components.weather 2020-08-23 22:21:29 INFO (SyncWorker_13) [homeassistant.loader] Loaded tuya from homeassistant.components.tuya 2020-08-23 22:21:29 INFO (SyncWorker_22) [homeassistant.loader] Loaded speedtestdotnet from homeassistant.components.speedtestdotnet 2020-08-23 22:21:29 INFO (SyncWorker_34) [homeassistant.loader] Loaded default_config from homeassistant.components.default_config 2020-08-23 22:21:29 INFO (SyncWorker_27) [homeassistant.loader] Loaded smartthings from homeassistant.components.smartthings 2020-08-23 22:21:29 INFO (SyncWorker_11) [homeassistant.loader] Loaded counter from homeassistant.components.counter 2020-08-23 22:21:29 INFO (SyncWorker_19) [homeassistant.loader] Loaded esphome from homeassistant.components.esphome 2020-08-23 22:21:29 INFO (SyncWorker_5) [homeassistant.loader] Loaded mobile_app from homeassistant.components.mobile_app 2020-08-23 22:21:29 INFO (SyncWorker_16) [homeassistant.loader] Loaded automation from homeassistant.components.automation 2020-08-23 22:21:29 INFO (SyncWorker_12) [homeassistant.loader] Loaded cloud from homeassistant.components.cloud 2020-08-23 22:21:29 INFO (SyncWorker_23) [homeassistant.loader] Loaded script from homeassistant.components.script 2020-08-23 22:21:29 INFO (SyncWorker_26) [homeassistant.loader] Loaded binary_sensor from homeassistant.components.binary_sensor 2020-08-23 22:21:29 INFO (SyncWorker_28) [homeassistant.loader] Loaded http from homeassistant.components.http 2020-08-23 22:21:29 INFO (SyncWorker_29) [homeassistant.loader] Loaded zeroconf from homeassistant.components.zeroconf 2020-08-23 22:21:29 INFO (SyncWorker_28) [homeassistant.loader] Loaded websocket_api from homeassistant.components.websocket_api 2020-08-23 22:21:29 INFO (SyncWorker_30) [homeassistant.loader] Loaded fan from homeassistant.components.fan 2020-08-23 22:21:29 INFO (SyncWorker_38) [homeassistant.loader] Loaded webhook from homeassistant.components.webhook 2020-08-23 22:21:29 INFO (SyncWorker_40) [homeassistant.loader] Loaded api from homeassistant.components.api 2020-08-23 22:21:29 INFO (SyncWorker_15) [homeassistant.loader] Loaded alexa from homeassistant.components.alexa 2020-08-23 22:21:29 INFO (SyncWorker_20) [homeassistant.loader] Loaded frontend from homeassistant.components.frontend 2020-08-23 22:21:29 INFO (SyncWorker_43) [homeassistant.loader] Loaded person from homeassistant.components.person 2020-08-23 22:21:29 INFO (SyncWorker_0) [homeassistant.loader] Loaded auth from homeassistant.components.auth 2020-08-23 22:21:29 INFO (SyncWorker_3) [homeassistant.loader] Loaded config from homeassistant.components.config 2020-08-23 22:21:29 INFO (SyncWorker_4) [homeassistant.loader] Loaded device_automation from homeassistant.components.device_automation 2020-08-23 22:21:29 INFO (SyncWorker_9) [homeassistant.loader] Loaded lovelace from homeassistant.components.lovelace 2020-08-23 22:21:29 INFO (SyncWorker_9) [homeassistant.loader] Loaded onboarding from homeassistant.components.onboarding 2020-08-23 22:21:29 INFO (SyncWorker_9) [homeassistant.loader] Loaded search from homeassistant.components.search 2020-08-23 22:21:29 INFO (SyncWorker_9) [homeassistant.loader] Loaded system_log from homeassistant.components.system_log 2020-08-23 22:21:29 INFO (SyncWorker_13) [homeassistant.loader] Loaded history from homeassistant.components.history 2020-08-23 22:21:29 INFO (SyncWorker_34) [homeassistant.loader] Loaded logbook from homeassistant.components.logbook 2020-08-23 22:21:29 INFO (SyncWorker_19) [homeassistant.loader] Loaded map from homeassistant.components.map 2020-08-23 22:21:29 INFO (SyncWorker_5) [homeassistant.loader] Loaded ssdp from homeassistant.components.ssdp 2020-08-23 22:21:30 INFO (SyncWorker_12) [homeassistant.loader] Loaded sun from homeassistant.components.sun 2020-08-23 22:21:30 INFO (SyncWorker_26) [homeassistant.loader] Loaded system_health from homeassistant.components.system_health 2020-08-23 22:21:30 INFO (SyncWorker_35) [homeassistant.loader] Loaded updater from homeassistant.components.updater 2020-08-23 22:21:30 INFO (SyncWorker_24) [homeassistant.loader] Loaded zone from homeassistant.components.zone 2020-08-23 22:21:30 INFO (SyncWorker_59) [homeassistant.loader] Loaded input_boolean from homeassistant.components.input_boolean 2020-08-23 22:21:30 INFO (SyncWorker_39) [homeassistant.loader] Loaded input_datetime from homeassistant.components.input_datetime 2020-08-23 22:21:30 INFO (SyncWorker_29) [homeassistant.loader] Loaded input_text from homeassistant.components.input_text 2020-08-23 22:21:30 INFO (SyncWorker_28) [homeassistant.loader] Loaded input_number from homeassistant.components.input_number 2020-08-23 22:21:30 INFO (SyncWorker_33) [homeassistant.loader] Loaded input_select from homeassistant.components.input_select 2020-08-23 22:21:30 INFO (MainThread) [homeassistant.bootstrap] Domains to be set up: {'input_select', 'system_log', 'group', 'scene', 'fan', 'history', 'http', 'shopping_list', 'sun', 'logger', 'sensor', 'cast', 'onboarding', 'zha', 'device_automation', 'ssdp', 'utility_meter', 'tts', 'recorder', 'sonoff', 'config', 'automation', 'auth', 'input_number', 'zeroconf', 'map', 'tion', 'script', 'input_datetime', 'lovelace', 'counter', 'alexa', 'system_health', 'updater', 'cloud', 'esphome', 'webhook', 'mobile_app', 'search', 'met', 'persistent_notification', 'websocket_api', 'person', 'frontend', 'api', 'input_boolean', 'zone', 'speedtestdotnet', 'weather', 'input_text', 'tuya', 'logbook', 'binary_sensor', 'smartthings', 'hacs', 'default_config'} 2020-08-23 22:21:30 INFO (MainThread) [homeassistant.bootstrap] Setting up logging: {'recorder', 'logger', 'system_log'} 2020-08-23 22:21:30 INFO (MainThread) [homeassistant.setup] Setting up recorder 2020-08-23 22:21:30 INFO (MainThread) [homeassistant.setup] Setting up logger 2020-08-23 22:21:31 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=104 from 2020-08-23 21:05:01.811886) 2020-08-23 22:21:36 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for gismeteo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 2020-08-23 22:27:16 WARNING (MainThread) [custom_components.tion] Tion instance updated at None 2020-08-23 22:27:19 CRITICAL (MainThread) [custom_components.tion] Got exception Device disconnected 2020-08-23 22:27:19 CRITICAL (MainThread) [custom_components.tion] Will delay next check 2020-08-23 22:27:19 ERROR (MainThread) [homeassistant.components.climate] Error while setting up tion platform for climate Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 87, in async_update_state response = self.__tion.get(keep_connection) File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/s3.py", line 110, in get self._enable_notifications() File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/tion.py", line 203, in _enable_notifications self.notify.read() File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 197, in read return self.peripheral.readCharacteristic(self.valHandle) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 530, in readCharacteristic resp = self._getResp('rd') File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 407, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 362, in _waitResp raise BTLEDisconnectError("Device disconnected", resp) bluepy.btle.BTLEDisconnectError: Device disconnected During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 192, in _async_setup_platform await asyncio.gather(*pending) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 301, in async_add_entities await asyncio.gather(*tasks) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 472, in _async_add_entity await entity.async_added_to_hass() File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 334, in async_added_to_hass await self._async_update_state(force=True) File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 411, in _async_update_state await self._tion_entry.async_update_state(time, force, keep_connection) File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 100, in async_update_state self._next_update = now + self._delay AttributeError: 'TionInstance' object has no attribute '_delay' 2020-08-23 22:27:19 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform tion.sensor: Platform not found (No module named 'custom_components.tion.sensor'). 2020-08-23 22:27:46 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-23 21:27:46.110936+00:00 2020-08-23 22:27:51 CRITICAL (MainThread) [custom_components.tion] Got exception Device disconnected 2020-08-23 22:27:51 CRITICAL (MainThread) [custom_components.tion] Will delay next check 2020-08-23 22:27:51 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 87, in async_update_state response = self.__tion.get(keep_connection) File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/s3.py", line 110, in get self._enable_notifications() File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/tion.py", line 203, in _enable_notifications self.notify.read() File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 197, in read return self.peripheral.readCharacteristic(self.valHandle) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 530, in readCharacteristic resp = self._getResp('rd') File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 407, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 362, in _waitResp raise BTLEDisconnectError("Device disconnected", resp) bluepy.btle.BTLEDisconnectError: Device disconnected During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 411, in _async_update_state await self._tion_entry.async_update_state(time, force, keep_connection) File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 100, in async_update_state self._next_update = now + self._delay AttributeError: 'TionInstance' object has no attribute '_delay' 2020-08-23 22:28:16 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-23 21:28:16.111525+00:00 2020-08-23 22:28:17 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random exception 2020-08-23 22:28:19 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random 2020-08-23 22:28:20 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random exception 2020-08-23 22:28:22 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random 2020-08-23 22:28:23 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random exception 2020-08-23 22:28:25 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random 2020-08-23 22:28:25 ERROR (MainThread) [tion_btle.s3] ('_connect', 'Could not connect to d5:91:dd:fc:1a:60') 2020-08-23 22:28:25 CRITICAL (MainThread) [custom_components.tion] Response is {'code': 400, 'error': "Got exception ('_connect', 'Could not connect to d5:91:dd:fc:1a:60')"} 2020-08-23 22:28:25 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 411, in _async_update_state await self._tion_entry.async_update_state(time, force, keep_connection) File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 103, in async_update_state raise e File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 89, in async_update_state self.__out_temp = response["out_temp"] KeyError: 'out_temp' 2020-08-23 22:28:25 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for mosenergosbyt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 2020-08-23 22:28:46 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-23 21:28:46.506270+00:00 2020-08-23 22:28:48 WARNING (MainThread) [tion_btle.tion] Got Device disconnected exception 2020-08-23 22:28:50 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Device disconnected 2020-08-23 22:28:51 WARNING (MainThread) [tion_btle.tion] Got Device disconnected exception 2020-08-23 22:28:53 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Device disconnected 2020-08-23 22:28:55 WARNING (MainThread) [tion_btle.tion] Got Device disconnected exception 2020-08-23 22:28:57 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Device disconnected 2020-08-23 22:28:57 ERROR (MainThread) [tion_btle.s3] ('_connect', 'Could not connect to d5:91:dd:fc:1a:60') 2020-08-23 22:28:57 CRITICAL (MainThread) [custom_components.tion] Response is {'code': 400, 'error': "Got exception ('_connect', 'Could not connect to d5:91:dd:fc:1a:60')"} 2020-08-23 22:28:57 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 411, in _async_update_state await self._tion_entry.async_update_state(time, force, keep_connection) File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 103, in async_update_state raise e File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 89, in async_update_state self.__out_temp = response["out_temp"] KeyError: 'out_temp' ```

По всей видимости не хочет подключаться.

fishenebelny commented 4 years ago

Проверил Hassio. Модуль обновил со старой версии, предварительно удали старую неудачную запись. Устройство добавилось. Было написано что все в порядке!

Но hassio повис намертво. Даже по питанию перезагрузка пока не помогла. Вот уже 5 минут он в сети, пинги идут, но веб морды так и нет.

Попробую проверить Bluetooth модуль с колонками.

fishenebelny commented 4 years ago

Проверил работу Bluetooth. С телефоном моим через Bluetoothctl спарился. С колонками, с которыми раньше спаривался, а потом удалил выдает ошибку. Но с Тиjном спаривается. bluetoothctl -> paired devices и Тион тут есть.

Даже корпус снял, чтоб убедиться, что он не мешает никак. Какой-то запрос проходит, а потом все... тишина. Connectec yes/no/yes/no.

IATkachenko commented 4 years ago

@fishenebelny, спасибо за проделанную работу и логи. bluetoothctl для tion не показатель. У него свой механизм pairing'a и однозначно ответить что pair прошел правильно можно только по факту "все работает".

После заливки модуля на PyPi он называется tion_btle (извините, документация не успевает за разработкой):

logger:
  default: warning
  logs:
    custom_components.tion: debug
    tion_btle.tion: debug
    tion_btle.s3: debug

(readme обновил) Выглядеть логи будут примерно так:

2020-08-24 10:18:09 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3
2020-08-24 10:18:11 DEBUG (MainThread) [tion_btle.tion] Enabling notification
2020-08-24 10:18:11 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11
2020-08-24 10:18:11 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle
2020-08-24 10:18:11 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']}
2020-08-24 10:18:11 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3
2020-08-24 10:18:11 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e
2020-08-24 10:18:11 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310241403001514148f000c0a004b0a0033005a

После того как в логах выставлен правильный уровень отладки нужно:

  1. Отключить все устройства от бризера (телефоны, пульт)
  2. Удалить конфигурацию бризеров из интеграции
  3. Обновить custom component до текущей версии (v1.2.5)
  4. Перезапустить Home Assistant
  5. добавить бризер с установленным флагом pair
  6. после сообщения что все ОК подождать минуту-две
  7. прислать получившиеся логи (в них будет виден pair шаг от tion_btle.s3 и работа компонента от tion_btle.tion)

Иногда бывает такое, что после pair бризер в течении 5-10 минут вообще отказывается принимать соедиения. Так что, возможно, придется подождать перед последними шагами чуть дольше.

По текущим логам я вижу что: BT на малине работает нормально, вероятно не проходит нормальное сопряжение и/или во время работы через HA к бризеру подключается пульт или телефон.

Подключение-отключение к бризеру, которое видно через bluetoothctl, -- нормально. BTLE протокол тут устроен так, что не позволяет двум клиентам работать с одним устройством. Поэтому, чтобы сохранить возможность управления бризером через телефон и пульт, компонент подключается к бризеру только если нужно обновить данные или передать команду.

IATkachenko commented 4 years ago

В v1.3.0, среди прочего, обновил механизм добавления бризера: теперь на этапе конфигурации будет сообщаться о проблемах с сопряжением/подключением и если такие проблемы есть бризер в конфигурацию не добавится.

fishenebelny commented 4 years ago

Первая попытка

Could not pair! Error occurs while pairing routine! Check logs for details.

Логи ``` 2020-08-24 23:01:05 DEBUG (MainThread) [tion_btle.s3] Pairing 2020-08-24 23:01:05 DEBUG (MainThread) [tion_btle.s3] Connecting 2020-08-24 23:01:05 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-24 23:01:06 DEBUG (MainThread) [tion_btle.s3] Collecting characteristic 2020-08-24 23:01:06 DEBUG (MainThread) [tion_btle.s3] Got characteristic Characteristic <6e400003-b5a3-f393-e0a9-e50e24dcca9e> for pairing 2020-08-24 23:01:06 DEBUG (MainThread) [tion_btle.s3] Sending pair command 3d0501000000000000000000000000000000005a to Characteristic <6e400003-b5a3-f393-e0a9-e50e24dcca9e> 2020-08-24 23:01:06 DEBUG (MainThread) [tion_btle.s3] Disconnecting 2020-08-24 23:01:06 DEBUG (MainThread) [tion_btle.s3] Done! 2020-08-24 23:01:06 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-24 23:01:07 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-24 23:01:07 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-24 23:01:07 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-24 23:01:07 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-24 23:01:07 ERROR (MainThread) [custom_components.tion.config_flow] Cannot pair and get data. Result is {}, error: Device disconnected 2020-08-24 23:01:43 DEBUG (MainThread) [custom_components.tion.config_flow] Pair failed. Returning to first step ```
fishenebelny commented 4 years ago

Вторая попытка через минуту - процесс настройки закончился успешно. Тион управляется. Но в логах сервера все равно какие-то сообщения. Второй не могу сейчас пробовать, завтра попробую.

Tion instance updated at None 1:08:20 – Tion breezer (WARNING) - первое сообщение получено 1:03:57 и повторялось 8 раз Need to set mode to heat 1:07:37 – Tion breezer (WARNING) Init of sensor input temperature for 66d6f182c5e144baa7fd2de9be7788e5 1:03:58 – Tion breezer (WARNING) - первое сообщение получено 1:03:58 и повторялось 2 раз No previously saved temperature, setting to 22 1:03:58 – Tion breezer (WARNING)

Логи спаривания 2020-08-24 23:03:43 DEBUG (MainThread) [custom_components.tion.config_flow] Showing pair info 2020-08-24 23:03:54 DEBUG (MainThread) [custom_components.tion.config_flow] Real pairing step 2020-08-24 23:03:54 DEBUG (MainThread) [tion_btle.s3] Pairing 2020-08-24 23:03:54 DEBUG (MainThread) [tion_btle.s3] Connecting 2020-08-24 23:03:54 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-24 23:03:55 DEBUG (MainThread) [tion_btle.s3] Collecting characteristic 2020-08-24 23:03:56 DEBUG (MainThread) [tion_btle.s3] Got characteristic Characteristic <6e400003-b5a3-f393-e0a9-e50e24dcca9e> for pairing 2020-08-24 23:03:56 DEBUG (MainThread) [tion_btle.s3] Sending pair command 3d0501000000000000000000000000000000005a to Characteristic <6e400003-b5a3-f393-e0a9-e50e24dcca9e> 2020-08-24 23:03:56 DEBUG (MainThread) [tion_btle.s3] Disconnecting 2020-08-24 23:03:56 DEBUG (MainThread) [tion_btle.s3] Done! 2020-08-24 23:03:56 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-24 23:03:56 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-24 23:03:56 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-24 23:03:56 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-24 23:03:56 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-24 23:03:57 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-24 23:03:57 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-24 23:03:57 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310230701001717174b01002300001d0033005a 2020-08-24 23:03:57 INFO (MainThread) [custom_components.tion] Setting up None 2020-08-24 23:03:57 WARNING (MainThread) [custom_components.tion] Tion instance updated at None 2020-08-24 23:03:57 DEBUG (MainThread) [custom_components.tion] Update fired force = True. Keep connection is False 2020-08-24 23:03:57 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-24 23:03:58 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-24 23:03:58 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-24 23:03:58 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-24 23:03:58 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-24 23:03:58 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-24 23:03:58 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-24 23:03:58 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310230701001717174b01002300001d0033005a 2020-08-24 23:03:58 WARNING (MainThread) [custom_components.tion.climate] No previously saved temperature, setting to 22 2020-08-24 23:03:58 WARNING (MainThread) [custom_components.tion.sensor] Init of sensor input temperature for 66d6f182c5e144baa7fd2de9be7788e5 2020-08-24 23:03:58 WARNING (MainThread) [custom_components.tion.sensor] Init of sensor filters remain for 66d6f182c5e144baa7fd2de9be7788e5 2020-08-24 23:04:57 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-24 22:04:57.689882+00:00 2020-08-24 23:04:57 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-24 23:04:57 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-24 22:04:57.689882+00:00 2020-08-24 23:04:57 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-24 23:04:58 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-24 23:04:58 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-24 23:04:58 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-24 23:04:58 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-24 23:04:59 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-24 23:04:59 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-24 23:04:59 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310230701001717174b01002400001d0033005a
fishenebelny commented 4 years ago

Относительно управления с других устройств. В настройках Tion Remote есть галочка "Передача управления". Я так понимаю, если она включена, то можно и с пульта подключиться и с малины. И проблем быть не должно.

fishenebelny commented 4 years ago

В v1.3.0, среди прочего, обновил механизм добавления бризера: теперь на этапе конфигурации будет сообщаться о проблемах с сопряжением/подключением и если такие проблемы есть бризер в конфигурацию не добавится.

В первой попытке как раз ничего не добавилось.

fishenebelny commented 4 years ago

Первая попытка подключить второй Тион. Неудачная. Тион был включен. Появились следующие сообщения:

Tion instance updated at 2020-08-25 07:10:59.163314+00:00
10:15:39 – Tion breezer (WARNING) - первое сообщение получено 1:49:58 и повторялось 507 раз
Cannot pair and get data. Result is {}, error: ('_connect', 'Could not connect to c4:64:95:c3:5e:79')
10:15:39 – Tion breezer (ERROR)
Got exception while _connect: Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random
10:15:39 – /srv/homeassistant/lib/python3.7/site-packages/tion_btle/tion.py (WARNING) - первое сообщение получено 1:58:00 и повторялось 28 раз
Got Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random exception
10:15:37 – /srv/homeassistant/lib/python3.7/site-packages/tion_btle/tion.py (WARNING) - первое сообщение получено 1:57:58 и повторялось 28 раз
Логи спаривания ``` 2020-08-25 08:13:21 DEBUG (MainThread) [custom_components.tion.config_flow] Showing pair info 2020-08-25 08:13:32 DEBUG (MainThread) [custom_components.tion.config_flow] Real pairing step 2020-08-25 08:13:32 DEBUG (MainThread) [tion_btle.s3] Pairing 2020-08-25 08:13:32 DEBUG (MainThread) [tion_btle.s3] Connecting 2020-08-25 08:13:32 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 08:14:13 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 08:14:15 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 08:14:15 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 2/3 2020-08-25 08:14:55 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 08:14:57 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 08:14:57 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 3/3 2020-08-25 08:15:37 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 08:15:39 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 08:15:39 ERROR (MainThread) [custom_components.tion.config_flow] Cannot pair and get data. Result is {}, error: ('_connect', 'Could not connect to c4:64:95:c3:5e:79') 2020-08-25 08:15:39 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 07:13:59.165639+00:00 2020-08-25 08:15:39 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 08:15:39 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 07:13:59.165639+00:00 2020-08-25 08:15:39 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 08:15:40 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 08:15:40 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 08:15:40 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 08:15:40 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 08:15:41 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 08:15:41 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 08:15:41 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310220a01001616164b01092f00001d0033005a ```
fishenebelny commented 4 years ago

Вторая попытка. Выключил Тион, дождался отключения пульта. Не подключилось. При этом никаких ошибок не было показано. Просто бесконечно крутится кружочек в момент спаривания и все.

Логи ``` 2020-08-25 08:22:16 DEBUG (MainThread) [custom_components.tion.config_flow] Showing pair info 2020-08-25 08:22:28 DEBUG (MainThread) [custom_components.tion.config_flow] Real pairing step 2020-08-25 08:22:28 DEBUG (MainThread) [tion_btle.s3] Pairing 2020-08-25 08:22:28 DEBUG (MainThread) [tion_btle.s3] Connecting 2020-08-25 08:22:28 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 08:23:09 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 08:23:11 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 08:23:11 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 2/3 2020-08-25 08:23:48 DEBUG (MainThread) [tion_btle.s3] Collecting characteristic 2020-08-25 08:23:50 DEBUG (MainThread) [tion_btle.s3] Got characteristic Characteristic <6e400003-b5a3-f393-e0a9-e50e24dcca9e> for pairing 2020-08-25 08:23:50 DEBUG (MainThread) [tion_btle.s3] Sending pair command 3d0501000000000000000000000000000000005a to Characteristic <6e400003-b5a3-f393-e0a9-e50e24dcca9e> 2020-08-25 08:23:50 DEBUG (MainThread) [tion_btle.s3] Disconnecting 2020-08-25 08:23:50 DEBUG (MainThread) [tion_btle.s3] Done! 2020-08-25 08:23:50 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 08:23:51 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 08:23:51 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 08:23:51 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 08:23:51 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 08:23:52 ERROR (MainThread) [custom_components.tion.config_flow] Cannot pair and get data. Result is {}, error: Device disconnected 2020-08-25 08:23:52 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 07:22:39.613270+00:00 2020-08-25 08:23:52 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 08:23:52 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 07:22:39.613270+00:00 2020-08-25 08:23:52 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 08:23:53 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 08:23:53 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 08:23:53 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 08:23:53 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 08:23:54 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 08:23:54 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 08:23:54 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310220a01001717164b01093700001d0033005a ```
fishenebelny commented 4 years ago

Попытка 3.

Появилось сообщение интеграции. Could not pair! Error occurs while pairing routine! Check logs for details.

Логи ``` 2020-08-25 08:26:44 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 08:26:55 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 08:26:57 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 08:26:57 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 2/3 2020-08-25 08:27:16 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 08:27:18 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 08:27:18 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 3/3 2020-08-25 08:27:24 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 08:27:26 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 08:27:26 ERROR (MainThread) [custom_components.tion.config_flow] Cannot pair and get data. Result is {}, error: ('_connect', 'Could not connect to c4:64:95:c3:5e:79') 2020-08-25 08:27:26 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 07:26:52.732386+00:00 2020-08-25 08:27:26 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 08:27:26 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 07:26:52.732386+00:00 2020-08-25 08:27:26 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 08:27:27 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 08:27:27 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 08:27:27 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 08:27:27 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 08:27:28 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 08:27:28 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 08:27:28 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310220a01001717164b01093b00001d0033005a 2020-08-25 08:28:22 DEBUG (MainThread) [custom_components.tion.config_flow] Pair failed. Returning to first step 2020-08-25 08:28:26 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 07:28:26.184949+00:00 2020-08-25 08:28:26 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 08:28:26 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 07:28:26.184949+00:00 2020-08-25 08:28:26 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 08:28:27 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 08:28:27 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 08:28:27 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 08:28:27 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 08:28:28 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 08:28:28 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 08:28:28 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310220a01001717164b010a0000001d0033005a ```
fishenebelny commented 4 years ago

Четвертая тоже не дала спариться. Заканчиаю попытки, жду обратной связи.

IATkachenko commented 4 years ago

@fishenebelny, спасибо за логи. Сейчас буду разбираться.

Относительно управления с других устройств. В настройках Tion Remote есть галочка "Передача управления". Я так понимаю, если она включена, то можно и с пульта подключиться и с малины. И проблем быть не должно.

Нет, это не так. "Передача управления" в настройках приложения означает что приложение подключается к бризеру только для передачи команд и обновления статуса и не держит соединение открытым постоянно. Можете самостоятельно провести эксперимент: подключиться к бризеру пультом, постоянно что-то с пульта делать (менять температуру +/-1 градус) и в этот же момент попробовать подключиться приложением. Приложение скажет что не может подключиться к бризеру или пульт потеряет соединение.

fishenebelny commented 4 years ago

подключиться к бризеру пультом, постоянно что-то с пульта делать (менять температуру +/-1 градус) и в этот же момент попробовать подключиться приложением. Приложение скажет что не может подключиться к бризеру или пульт потеряет соединение.

Оьращал внимание на такое. Когда с одного телефона настройки меняли, другой уже не подключался. Я подумал, что эта галочка как раз и решает эту проблемв. Попробую проверить.

IATkachenko commented 4 years ago

@fishenebelny, в ваших логах я вижу ошибки подключения: малина не может подключиться к бризеру. Точно ли в этот момент с бризером никто не общается (из пульта вынута батарейка, на телефоне отключен BT итд и с момента отключения прошло хотя бы минут 5: для нормальной работы 5 минут не нужно, но сейчас я вижу что что-то идет не так на стадии подключения и хорошо бы убедиться что все подключения сброшены).

Далее по попыткам:

1

Я вижу два бризера. К которым одновременно, в 10:15:39 пытается подключиться малина. Само по себе это не смертельно, но неприятно и я попытаюсь разнести параллельные запросы в будущем. До этого в 08:13:32 малина, на фоне не занятого BT, не смогла подключиться к бризеру c4:64:95:c3:5e:79. Она пыталась это сделать 1.5 минуты. Тут от вас нужно подтверждение что все происходит в "стерильной" обстановке и с бризером никто не общается в этот момент. Запрос на обновление второго бризера пришел в 07:13:59 (тут я думаю есть проблемы с временными зонами и на самом деле это 08:13:59), терпеливо подождал пока все обновится и корректно отработал. Итого: проблем в работе модуля и компонента я не вижу.

2

К бризеру подключение прошло со второго раза (видимо чуть поторопились после отключения пульта). Pair прошел корректно (дальше pair для c4:64:95:c3:5e:79 делать не нужно). Завалился модуль на чтении из notify топика на стадии включения уведомлений. С этим буду разбираться.

3

Тут все ожидаемо (я с таким уже сталкивался) после device disconnected после pair бризер не рвет соединение сразу. Людям помогает подождать минут 5-10, после этого все начинает "само" работать нормально.

Резюме:

  1. оба бризера успешно прошли pair (больше его делать не нужно)
  2. во вторых логах python модуль завалился на подписке на уведомления. Возможно подключение для проверки результата нужно сделать с задержкой в несколько секунд после завершения pairing'a
  3. возможно нужно сделать в модуле нормальные очереди, чтобы исключить одновременные запросы к бризерам, как минимум на старте (по ходу работы все выглядит прилично: запросы идут последовательно). Чтобы это понять, нужно будет у вас попросить debug логи в момент старта, когда оба бризера успешно добавлены в систему и работают.
fishenebelny commented 4 years ago

С шестой попытки Pairing прошел. Перед этим перезагрузил Home Assistant.

IATkachenko commented 4 years ago

Значит нужно выставить задержку между завершением pair и проверкой что все нормально в компоненте, потому что стадия pair (на уровне устройств) у вас нормально завершилась во вторых логах.

fishenebelny commented 4 years ago

Теперь при попытке включить проветриватели они очень долго думали. Минуты 2-3 прошло и потом они внезапно включились. Кажется теперь проблема с зависаними будет.

Логи

``` 2020-08-25 12:00:00 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 11:00:00.911783+00:00 2020-08-25 12:00:00 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 12:00:00 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 11:00:00.911783+00:00 2020-08-25 12:00:00 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:00:01 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:00:01 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:00:01 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:00:01 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:00:02 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:00:02 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:00:02 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310260a01001717164b010d1f00001d0033005a 2020-08-25 12:00:27 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 11:00:27.941153+00:00 2020-08-25 12:00:27 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 12:00:27 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 11:00:27.941153+00:00 2020-08-25 12:00:27 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:00:31 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:00:31 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:00:31 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:00:32 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:00:33 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:00:33 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:00:33 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310210a0100171716ab000d270000bd0033005a 2020-08-25 12:00:55 WARNING (MainThread) [custom_components.tion.climate] Need to set mode to heat 2020-08-25 12:00:55 INFO (MainThread) [custom_components.tion.climate] Need to set: heater='on', status='on' 2020-08-25 12:00:55 INFO (MainThread) [custom_components.tion] Need to set: heater='on', status='on' 2020-08-25 12:00:55 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:00:57 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:00:57 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:00:57 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:00:57 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:00:57 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:00:59 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:00:59 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:00:59 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310210a0100161616ab000d270000bd0033005a 2020-08-25 12:00:59 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:01:00 WARNING (MainThread) [tion_btle.tion] Got Device disconnected exception 2020-08-25 12:01:02 WARNING (MainThread) [tion_btle.tion] Got exception while _try_write: Device disconnected 2020-08-25 12:01:02 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 2/3 2020-08-25 12:01:03 DEBUG (MainThread) [tion_btle.tion] Writing 3d02010a0203000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:01:03 WARNING (MainThread) [custom_components.tion] Tion instance updated at None 2020-08-25 12:01:03 DEBUG (MainThread) [custom_components.tion] Update fired force = True. Keep connection is False 2020-08-25 12:01:03 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:01:04 WARNING (MainThread) [tion_btle.tion] Got Device disconnected exception 2020-08-25 12:01:06 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Device disconnected 2020-08-25 12:01:06 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 2/3 2020-08-25 12:01:08 WARNING (MainThread) [tion_btle.tion] Got Device disconnected exception 2020-08-25 12:01:10 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Device disconnected 2020-08-25 12:01:10 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 3/3 2020-08-25 12:01:12 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:01:12 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:01:12 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:01:13 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:01:14 CRITICAL (MainThread) [custom_components.tion] Got exception Device disconnected 2020-08-25 12:01:14 CRITICAL (MainThread) [custom_components.tion] Will delay next check 2020-08-25 12:01:14 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 11:01:00.912516+00:00 2020-08-25 12:01:14 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 12:01:14 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 11:01:00.912516+00:00 2020-08-25 12:01:14 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:01:15 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:01:15 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:01:15 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:01:15 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:01:16 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:01:16 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:01:16 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310260a01001717164b010d2000001d0033005a 2020-08-25 12:01:16 ERROR (MainThread) [homeassistant.core] Error executing service: Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 89, in async_update_state response = self.__tion.get(keep_connection) File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/s3.py", line 110, in get self._enable_notifications() File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/tion.py", line 203, in _enable_notifications self.notify.read() File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 197, in read return self.peripheral.readCharacteristic(self.valHandle) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 530, in readCharacteristic resp = self._getResp('rd') File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 407, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 362, in _waitResp raise BTLEDisconnectError("Device disconnected", resp) bluepy.btle.BTLEDisconnectError: Device disconnected During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py", line 1324, in catch_exceptions await coro_or_task File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py", line 1343, in _execute_service await handler.func(service_call) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 209, in handle_service self._platforms.values(), func, call, required_features File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 454, in entity_service_call future.result() # pop exception if have File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 583, in async_request_call await coro File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 485, in _handle_entity_call await result File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 248, in async_set_hvac_mode await self._async_set_state(heater=True, is_on=True) File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 406, in _async_set_state await self._async_update_state(force=True, keep_connection=False) File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 410, in _async_update_state await self._tion_entry.async_update_state(time, force, keep_connection) File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 104, in async_update_state self._next_update = now + self._delay AttributeError: 'TionInstance' object has no attribute '_delay' 2020-08-25 12:01:16 WARNING (MainThread) [custom_components.tion.climate] Need to set mode to heat 2020-08-25 12:01:16 INFO (MainThread) [custom_components.tion.climate] Need to set: heater='on', status='on' 2020-08-25 12:01:16 INFO (MainThread) [custom_components.tion] Need to set: heater='on', status='on' 2020-08-25 12:01:16 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:01:19 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 12:01:21 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 12:01:21 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 2/3 2020-08-25 12:01:24 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:01:24 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:01:24 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:01:24 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:01:25 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:01:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.26770760500291499ecd is taking over 10 seconds 2020-08-25 12:01:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.bf8fa63efe33d44c464s6g is taking over 10 seconds 2020-08-25 12:01:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.575174502cf43220e534 is taking over 10 seconds 2020-08-25 12:01:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.827772252cf43238e829_1 is taking over 10 seconds 2020-08-25 12:01:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.827772252cf43238e829_2 is taking over 10 seconds 2020-08-25 12:01:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.43300007bcddc266d477_1 is taking over 10 seconds 2020-08-25 12:01:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.43300007bcddc266d477_2 is taking over 10 seconds 2020-08-25 12:01:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.43300007bcddc267a917_1 is taking over 10 seconds 2020-08-25 12:01:27 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.43300007bcddc267a917_2 is taking over 10 seconds 2020-08-25 12:01:27 ERROR (MainThread) [homeassistant.core] Error executing service: Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py", line 1324, in catch_exceptions await coro_or_task File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/core.py", line 1343, in _execute_service await handler.func(service_call) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 209, in handle_service self._platforms.values(), func, call, required_features File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 454, in entity_service_call future.result() # pop exception if have File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 583, in async_request_call await coro File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 485, in _handle_entity_call await result File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 248, in async_set_hvac_mode await self._async_set_state(heater=True, is_on=True) File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 405, in _async_set_state await self._tion_entry.set(**kwargs) File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 186, in set self.__tion.set(kwargs) File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/s3.py", line 161, in set self._do_action(self._try_write, request=encode_request(request)) File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/s3.py", line 151, in encode_request settings = {**self.get(True), **request} File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/s3.py", line 110, in get self._enable_notifications() File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/tion.py", line 203, in _enable_notifications self.notify.read() File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 197, in read return self.peripheral.readCharacteristic(self.valHandle) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 530, in readCharacteristic resp = self._getResp('rd') File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 407, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 362, in _waitResp raise BTLEDisconnectError("Device disconnected", resp) bluepy.btle.BTLEDisconnectError: Device disconnected 2020-08-25 12:01:27 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 11:01:27.942132+00:00 2020-08-25 12:01:27 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 12:01:27 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 11:01:27.942132+00:00 2020-08-25 12:01:27 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:01:38 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:01:38 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:01:38 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:01:38 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:01:40 CRITICAL (MainThread) [custom_components.tion] Got exception Device disconnected 2020-08-25 12:01:40 CRITICAL (MainThread) [custom_components.tion] Will delay next check 2020-08-25 12:01:40 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 89, in async_update_state response = self.__tion.get(keep_connection) File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/s3.py", line 110, in get self._enable_notifications() File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/tion.py", line 203, in _enable_notifications self.notify.read() File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 197, in read return self.peripheral.readCharacteristic(self.valHandle) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 530, in readCharacteristic resp = self._getResp('rd') File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 407, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) File "/srv/homeassistant/lib/python3.7/site-packages/bluepy/btle.py", line 362, in _waitResp raise BTLEDisconnectError("Device disconnected", resp) bluepy.btle.BTLEDisconnectError: Device disconnected During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 410, in _async_update_state await self._tion_entry.async_update_state(time, force, keep_connection) File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 104, in async_update_state self._next_update = now + self._delay AttributeError: 'TionInstance' object has no attribute '_delay' 2020-08-25 12:01:40 WARNING (MainThread) [custom_components.tion.climate] Need to set mode to heat 2020-08-25 12:01:40 INFO (MainThread) [custom_components.tion.climate] Need to set: heater='on', status='on' 2020-08-25 12:01:40 INFO (MainThread) [custom_components.tion] Need to set: heater='on', status='on' 2020-08-25 12:01:40 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:01:43 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 12:01:45 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 12:01:45 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 2/3 2020-08-25 12:01:49 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random exception 2020-08-25 12:01:51 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral c4:64:95:c3:5e:79, addr type: random 2020-08-25 12:01:51 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 3/3 2020-08-25 12:01:55 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:01:55 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:01:55 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:01:55 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:01:55 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:01:57 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:01:57 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:01:57 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310210a0100171716ab000d280000bd0033005a 2020-08-25 12:01:57 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:01:58 DEBUG (MainThread) [tion_btle.tion] Writing 3d02010a0203000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:01:58 WARNING (MainThread) [custom_components.tion] Tion instance updated at None 2020-08-25 12:01:58 DEBUG (MainThread) [custom_components.tion] Update fired force = True. Keep connection is False 2020-08-25 12:01:58 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:01:59 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:01:59 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:01:59 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:02:00 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:02:00 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:02:00 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:02:00 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310210a0300171716ab000d28001ebd0033005a 2020-08-25 12:02:01 WARNING (MainThread) [custom_components.tion.climate] Need to set mode to heat 2020-08-25 12:02:01 INFO (MainThread) [custom_components.tion.climate] Need to set: heater='on', status='on' 2020-08-25 12:02:01 INFO (MainThread) [custom_components.tion] Need to set: heater='on', status='on' 2020-08-25 12:02:01 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:02:01 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:02:01 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:02:01 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:02:01 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:02:02 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:02:02 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:02:02 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:02:02 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310260a01001717164b010d2100001d0033005a 2020-08-25 12:02:02 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:02:03 DEBUG (MainThread) [tion_btle.tion] Writing 3d02060a0203000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:02:03 WARNING (MainThread) [custom_components.tion] Tion instance updated at None 2020-08-25 12:02:03 DEBUG (MainThread) [custom_components.tion] Update fired force = True. Keep connection is False 2020-08-25 12:02:03 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:02:04 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:02:04 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:02:04 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:02:04 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:02:04 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:02:04 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:02:04 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310260a03001717164b010d21008c1d0033005a 2020-08-25 12:02:14 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 11:02:14.540635+00:00 2020-08-25 12:02:14 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 12:02:14 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 11:02:14.540635+00:00 2020-08-25 12:02:14 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:02:15 WARNING (MainThread) [tion_btle.tion] Got Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random exception 2020-08-25 12:02:17 WARNING (MainThread) [tion_btle.tion] Got exception while _connect: Failed to connect to peripheral d5:91:dd:fc:1a:60, addr type: random 2020-08-25 12:02:17 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 2/3 2020-08-25 12:02:18 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:02:18 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:02:18 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:02:18 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:02:19 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:02:19 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:02:19 DEBUG (MainThread) [tion_btle.tion] Got data in 11 response b310260a03001817174b010d21008c1d0033005a 2020-08-25 12:02:27 WARNING (MainThread) [custom_components.tion] Tion instance updated at 2020-08-25 11:02:27.943517+00:00 2020-08-25 12:02:27 DEBUG (MainThread) [custom_components.tion] Update fired force = False. Keep connection is False 2020-08-25 12:02:27 DEBUG (MainThread) [custom_components.tion] Now is 2020-08-25 11:02:27.943517+00:00 2020-08-25 12:02:27 DEBUG (MainThread) [tion_btle.tion] Doing _connect. Attempt 1/3 2020-08-25 12:02:31 DEBUG (MainThread) [tion_btle.tion] Enabling notification 2020-08-25 12:02:31 DEBUG (MainThread) [tion_btle.tion] Notify handler is 11 2020-08-25 12:02:31 DEBUG (MainThread) [tion_btle.tion] Will write b'\x01\x00' to 12 handle 2020-08-25 12:02:32 DEBUG (MainThread) [tion_btle.tion] Result is {'rsp': ['wr']} 2020-08-25 12:02:33 DEBUG (MainThread) [tion_btle.tion] Doing _try_write. Attempt 1/3 2020-08-25 12:02:33 DEBUG (MainThread) [tion_btle.tion] Writing 3d0100000000000000000000000000000000005a to 6e400002-b5a3-f393-e0a9-e50e24dcca9e 2020-08-25 12:02:33 DEBUG (MainThread) [tion_btle.s3] Got Device disconnected while waiting for notification 2020-08-25 12:02:33 CRITICAL (MainThread) [custom_components.tion] Response is {} 2020-08-25 12:02:33 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/tion/climate.py", line 410, in _async_update_state await self._tion_entry.async_update_state(time, force, keep_connection) File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 107, in async_update_state raise e File "/home/homeassistant/.homeassistant/custom_components/tion/__init__.py", line 89, in async_update_state response = self.__tion.get(keep_connection) File "/srv/homeassistant/lib/python3.7/site-packages/tion_btle/s3.py", line 134, in get return result UnboundLocalError: local variable 'result' referenced before assignment ```

fishenebelny commented 4 years ago

Зависания есть. История не подгружается. Или подгружается через какое-то время, чего раньше не было.

IATkachenko commented 4 years ago

ОК. Я понял/вижу: нужны очереди и поменьше await, поскольку на это время блокируется работа HA. Ровно ситуация в #2

Пока придется пользоваться одним бризером через HA (с одним проблем быть не должно).

Что-то еще (кроме дополнительной паузы во время сопряжения), в рамках этого issue нужно прояснить/сделать, на ваш взгляд?

fishenebelny commented 4 years ago

Спасибо за оперативный ответ!

Что-то еще (кроме дополнительной паузы во время сопряжения), в рамках этого issue нужно прояснить/сделать, на ваш взгляд?

В рамках установки? На данный момент вроде отлично работает. Может быть не имеет смысла только мак адрес вводить. Вче таки Тион видется средствами Блютуз и это можно автомат зировать по аналошии как обычный пульт сопрягается. Добавить комментарий - что за пауза 60 секунд? Интервал опроса устройства? Ну и какую то информацию в случае ошибки. Мол повторите еще раз откдючив все пульты, телефоны, которые могут управлять устройством.

IATkachenko commented 4 years ago

Scan и автоматическое добавление устройств -- это хорошо и правильно, но, пока, сложно и не очень обязательные рюшечки, на которые нужно потратить достаточно много времени. Можно под это завести отдельный issue (чтобы идея не потерялась), но у меня, в ближайшее время, до этого руки не дойдут.

Про keep alive в настройках понял, добавлю. Информацию при ошибке тоже перепишу обновлю. Спасибо.