From 9b4d16c8b243a33ecdb86583264a2a7b8d667d20 Mon Sep 17 00:00:00 2001 From: Konstantin Pivnov Date: Thu, 7 Nov 2024 14:02:01 +0300 Subject: [PATCH 1/5] added breezer reset filters service --- custom_components/tion/binary_sensor.py | 2 +- custom_components/tion/climate.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/custom_components/tion/binary_sensor.py b/custom_components/tion/binary_sensor.py index 6e74efd..e988b62 100644 --- a/custom_components/tion/binary_sensor.py +++ b/custom_components/tion/binary_sensor.py @@ -1,4 +1,4 @@ -"""Platform for sensor integration.""" +"""Platform for binary sensor integration.""" import abc import logging diff --git a/custom_components/tion/climate.py b/custom_components/tion/climate.py index f17520e..1462553 100644 --- a/custom_components/tion/climate.py +++ b/custom_components/tion/climate.py @@ -84,6 +84,12 @@ async def async_setup_entry( "set_breezer_max_speed", ) + platform.async_register_entity_service( + name="reset_filters", + schema=None, + func="async_reset_filters", + ) + return True @@ -561,6 +567,13 @@ async def set_breezer_max_speed(self, **kwargs): self._speed_max_set = new_max_speed await self._send_breezer() + async def async_reset_filters(self, **kwargs): + """Reset breezer filter replacement.""" + _ = kwargs + await self._api.send_settings( + self._breezer_guid, data={"reset_filter_timer": True} + ) + async def _load_breezer(self, force=False): """Update breezer data from API.""" if device_data := await self._api.get_device( From fbbd6d5c47f53e0e450466c74909b0de44af9c85 Mon Sep 17 00:00:00 2001 From: Konstantin Pivnov Date: Thu, 7 Nov 2024 14:04:16 +0300 Subject: [PATCH 2/5] updated strings and translations --- custom_components/tion/strings.json | 42 +++++++++++++ custom_components/tion/translations/en.json | 36 ----------- custom_components/tion/translations/ru.json | 66 ++++++++++++--------- 3 files changed, 80 insertions(+), 64 deletions(-) create mode 100644 custom_components/tion/strings.json delete mode 100644 custom_components/tion/translations/en.json diff --git a/custom_components/tion/strings.json b/custom_components/tion/strings.json new file mode 100644 index 0000000..fc3123f --- /dev/null +++ b/custom_components/tion/strings.json @@ -0,0 +1,42 @@ +{ + "title": "Tion", + "config": { + "step": { + "user": { + "title": "Add new Tion configuration", + "description": "Please enter your Tion account credentials", + "data": { + "name": "[%key:common::config_flow::data::name%]", + "username": "Username", + "password": "Password", + "scan_interval": "API poll interval" + }, + "data_description": { + "scan_interval": "Tion devices data minimum update period." + } + } + }, + "abort": { + "already_configured": "Account is already configured" + }, + "error": { + "invalid_auth": "Invalid authentication", + "unknown": "Unexpected error" + } + }, + "entity": { + "climate": { + "tion_breezer": { + "state_attributes": { + "swing_mode": { + "state": { + "outside": "Outside", + "inside": "Inside", + "mixed": "Mixed" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/custom_components/tion/translations/en.json b/custom_components/tion/translations/en.json deleted file mode 100644 index b9b6131..0000000 --- a/custom_components/tion/translations/en.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "config": { - "abort": { - "already_configured": "Device is already configured" - }, - "error": { - "invalid_auth": "Invalid authentication", - "unknown": "Unexpected error" - }, - "step": { - "user": { - "description": "Please enter your Tion account credentials:", - "data": { - "username": "Username", - "password": "Password", - "scan_interval": "API poll interval" - } - } - } - }, - "entity": { - "climate": { - "tion_breezer": { - "state_attributes": { - "swing_mode": { - "state": { - "outside": "Outside", - "inside": "Inside", - "mixed": "Mixed" - } - } - } - } - } - } -} \ No newline at end of file diff --git a/custom_components/tion/translations/ru.json b/custom_components/tion/translations/ru.json index 205291e..fc4cb5c 100644 --- a/custom_components/tion/translations/ru.json +++ b/custom_components/tion/translations/ru.json @@ -1,36 +1,46 @@ { - "config": { - "abort": { - "already_configured": "Устройство уже было добавлено" + "config": { + "step": { + "user": { + "title": "Новая конфигурация Tion", + "description": "Введите данные учётной записи Tion", + "data": { + "username": "Логин", + "password": "Пароль", + "scan_interval": "Интервал обновления" }, - "error": { - "invalid_auth": "Ошибка аутентификации", - "unknown": "Непредвиденная ошибка" - }, - "step": { - "user": { - "description": "Введите данные учётной записи Tion:", - "data": { - "username": "Логин", - "password": "Пароль", - "scan_interval": "Интервал обновления" - } - } + "data_description": { + "scan_interval": "Минимальный период обновления данных устройств Tion от API." } + } + }, + "abort": { + "already_configured": "Учётная запись уже была добавлена" }, - "entity": { - "climate": { - "tion_breezer": { - "state_attributes": { - "swing_mode": { - "state": { - "outside": "С улицы", - "inside": "Из комнаты", - "mixed": "Смешанный" - } - } - } + "error": { + "invalid_auth": "Ошибка аутентификации", + "unknown": "Неизвестная ошибка" + } + }, + "entity": { + "climate": { + "tion_breezer": { + "state_attributes": { + "swing_mode": { + "state": { + "outside": "С улицы", + "inside": "Из комнаты", + "mixed": "Смешанный" } + } } + } + } + }, + "services": { + "reset_filters": { + "name": "Сбросить фильтры", + "description": "Сбрасывает период замены фильтров бризера." } + } } \ No newline at end of file From 038ec9bbe83d5458c0be5e110566d81974c70d0a Mon Sep 17 00:00:00 2001 From: Konstantin Pivnov Date: Thu, 7 Nov 2024 14:05:32 +0300 Subject: [PATCH 3/5] added new filter reset service to services.yaml --- custom_components/tion/services.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/custom_components/tion/services.yaml b/custom_components/tion/services.yaml index 0f913dc..f7b5889 100644 --- a/custom_components/tion/services.yaml +++ b/custom_components/tion/services.yaml @@ -59,4 +59,12 @@ set_breezer_max_speed: min: 0 max: 6 step: 1 - mode: slider \ No newline at end of file + mode: slider + +reset_filters: + name: Reset Filters + description: Resets breezer filter replacement period + target: + entity: + integration: tion + domain: climate \ No newline at end of file From 50832a0095f3df7e95da608094b8a9c2221f253d Mon Sep 17 00:00:00 2001 From: Konstantin Pivnov Date: Thu, 7 Nov 2024 14:07:45 +0300 Subject: [PATCH 4/5] bump manifest version --- custom_components/tion/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/tion/manifest.json b/custom_components/tion/manifest.json index 8592ec3..e87d6a1 100644 --- a/custom_components/tion/manifest.json +++ b/custom_components/tion/manifest.json @@ -17,5 +17,5 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/vaproloff/tion_home_assistant/issues", "requirements": [], - "version": "2024.11.0" + "version": "2024.11.1" } \ No newline at end of file From 44dc0ee6d75525a6dc5eefe16d3cc7c371bff405 Mon Sep 17 00:00:00 2001 From: Konstantin Pivnov Date: Thu, 7 Nov 2024 14:14:09 +0300 Subject: [PATCH 5/5] added info to reset filters service description --- custom_components/tion/services.yaml | 2 +- custom_components/tion/translations/ru.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/tion/services.yaml b/custom_components/tion/services.yaml index f7b5889..e135cfa 100644 --- a/custom_components/tion/services.yaml +++ b/custom_components/tion/services.yaml @@ -63,7 +63,7 @@ set_breezer_max_speed: reset_filters: name: Reset Filters - description: Resets breezer filter replacement period + description: Resets breezer filter replacement period. Require some time for replacement period to be updated - please, be patient after service activation. target: entity: integration: tion diff --git a/custom_components/tion/translations/ru.json b/custom_components/tion/translations/ru.json index fc4cb5c..211edae 100644 --- a/custom_components/tion/translations/ru.json +++ b/custom_components/tion/translations/ru.json @@ -40,7 +40,7 @@ "services": { "reset_filters": { "name": "Сбросить фильтры", - "description": "Сбрасывает период замены фильтров бризера." + "description": "Сбрасывает период замены фильтров бризера. Обновление периода замены может занять некоторое время - после запуска службы, пожалуйста, ожидайте." } } } \ No newline at end of file