From 011e47593f6e0f90327a4658983867bb8094322f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Mandari=C4=87?= <2945713+MislavMandaric@users.noreply.github.com> Date: Fri, 8 Apr 2022 18:44:15 +0200 Subject: [PATCH 1/3] chore: Updates devcontainer and cleans up scripts. --- .devcontainer/devcontainer.json | 14 ++++++++------ .vscode/launch.json | 4 ++-- .vscode/tasks.json | 2 +- hacs.json | 5 +++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f3a77b0..43a0a70 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,10 +1,8 @@ -// See https://aka.ms/vscode-remote/devcontainer.json for format details. { - "image": "ludeeus/container:integration-debian", - "name": "Vaillant vSMART integration development", + "image": "ghcr.io/ludeeus/devcontainer/integration:stable", "context": "..", "appPort": [ - "9123:8123" + "8123:8123" ], "postCreateCommand": "container install", "extensions": [ @@ -17,14 +15,18 @@ "files.eol": "\n", "editor.tabSize": 4, "terminal.integrated.shell.linux": "/bin/bash", - "python.pythonPath": "/usr/bin/python3", + "python.pythonPath": "/usr/local/python/bin/python", "python.analysis.autoSearchPaths": false, "python.linting.pylintEnabled": true, "python.linting.enabled": true, + "python.linting.pylintArgs": [ + "--disable", + "import-error" + ], "python.formatting.provider": "black", "editor.formatOnPaste": false, "editor.formatOnSave": true, "editor.formatOnType": true, "files.trimTrailingWhitespace": true } -} +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index cba37ff..ace635a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "name": "Python: Attach Local", "type": "python", "request": "attach", - "port": 5678, + "port": 8123, "host": "localhost", "justMyCode": false, "pathMappings": [ @@ -22,7 +22,7 @@ "name": "Python: Attach Remote", "type": "python", "request": "attach", - "port": 5678, + "port": 8123, "host": "homeassistant.local", "justMyCode": false, "pathMappings": [ diff --git a/.vscode/tasks.json b/.vscode/tasks.json index c86f5bb..a63c861 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,7 +2,7 @@ "version": "2.0.0", "tasks": [ { - "label": "Run Home Assistant on port 9123", + "label": "Run Home Assistant on port 8123", "type": "shell", "command": "container start", "problemMatcher": [] diff --git a/hacs.json b/hacs.json index c2a3084..cc60b81 100644 --- a/hacs.json +++ b/hacs.json @@ -3,8 +3,9 @@ "hacs": "1.6.0", "domains": [ "climate", - "switch", - "sensor" + "select", + "sensor", + "switch" ], "iot_class": "Cloud Polling", "homeassistant": "2021.6" From ef18d97db6741b2ec768c22a85799c65196b12b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Mandari=C4=87?= <2945713+MislavMandaric@users.noreply.github.com> Date: Fri, 8 Apr 2022 18:44:46 +0200 Subject: [PATCH 2/3] fix: Replaces deprecated entity config consts with new enum with the same purpose --- custom_components/vaillant_vsmart/select.py | 7 +++---- custom_components/vaillant_vsmart/sensor.py | 7 ++++--- custom_components/vaillant_vsmart/switch.py | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/custom_components/vaillant_vsmart/select.py b/custom_components/vaillant_vsmart/select.py index f9741e5..abbd6b1 100644 --- a/custom_components/vaillant_vsmart/select.py +++ b/custom_components/vaillant_vsmart/select.py @@ -1,13 +1,12 @@ """The Vaillant vSMART climate platform.""" from __future__ import annotations -import datetime import logging from homeassistant.components.select import SelectEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import DOMAIN @@ -48,10 +47,10 @@ def name(self) -> str: return f"{self._module.module_name} {self._program.name} Profile" @property - def entity_category(self) -> str: + def entity_category(self) -> EntityCategory: """Return entity category for this select.""" - return ENTITY_CATEGORY_DIAGNOSTIC + return EntityCategory.DIAGNOSTIC @property def current_option(self) -> str | None: diff --git a/custom_components/vaillant_vsmart/sensor.py b/custom_components/vaillant_vsmart/sensor.py index b32b2d1..b2ee8a8 100644 --- a/custom_components/vaillant_vsmart/sensor.py +++ b/custom_components/vaillant_vsmart/sensor.py @@ -9,8 +9,9 @@ STATE_CLASS_MEASUREMENT, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC, PERCENTAGE +from homeassistant.const import PERCENTAGE from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import DOMAIN @@ -50,10 +51,10 @@ def name(self) -> str: return f"{self._module.module_name} Battery" @property - def entity_category(self) -> str: + def entity_category(self) -> EntityCategory: """Return entity category for this sensor.""" - return ENTITY_CATEGORY_DIAGNOSTIC + return EntityCategory.DIAGNOSTIC @property def device_class(self) -> str: diff --git a/custom_components/vaillant_vsmart/switch.py b/custom_components/vaillant_vsmart/switch.py index fa5229a..9bd77ad 100644 --- a/custom_components/vaillant_vsmart/switch.py +++ b/custom_components/vaillant_vsmart/switch.py @@ -6,8 +6,8 @@ from homeassistant.components.switch import SwitchEntity, DEVICE_CLASS_SWITCH from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ENTITY_CATEGORY_CONFIG from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity_platform import AddEntitiesCallback from vaillant_netatmo_api import ApiException, SetpointMode @@ -54,10 +54,10 @@ def name(self) -> str: return f"{self._module.module_name} HWB" @property - def entity_category(self) -> str: + def entity_category(self) -> EntityCategory: """Return entity category for this switch.""" - return ENTITY_CATEGORY_CONFIG + return EntityCategory.CONFIG @property def device_class(self) -> str: @@ -120,10 +120,10 @@ def name(self) -> str: return f"{self._module.module_name} {self._program.name} Schedule" @property - def entity_category(self) -> str: + def entity_category(self) -> EntityCategory: """Return entity category for this switch.""" - return ENTITY_CATEGORY_CONFIG + return EntityCategory.CONFIG @property def device_class(self) -> str: From bb471f40ba42ffeab072b4964619a9b34cc45910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Mandari=C4=87?= <2945713+MislavMandaric@users.noreply.github.com> Date: Fri, 8 Apr 2022 18:54:30 +0200 Subject: [PATCH 3/3] fix: Removes custom title translation for configuring the integration through the UI --- custom_components/vaillant_vsmart/translations/en.json | 1 - custom_components/vaillant_vsmart/translations/hr.json | 1 - 2 files changed, 2 deletions(-) diff --git a/custom_components/vaillant_vsmart/translations/en.json b/custom_components/vaillant_vsmart/translations/en.json index 0fad8cd..7d8cf90 100644 --- a/custom_components/vaillant_vsmart/translations/en.json +++ b/custom_components/vaillant_vsmart/translations/en.json @@ -2,7 +2,6 @@ "config": { "step": { "user": { - "title": "Vaillant vSMART", "description": "If you need help with the configuration have a look here: https://github.com/MislavMandaric/home-assistant-vaillant-vsmart", "data": { "client_id": "Client ID", diff --git a/custom_components/vaillant_vsmart/translations/hr.json b/custom_components/vaillant_vsmart/translations/hr.json index ba0aabe..9dabff6 100644 --- a/custom_components/vaillant_vsmart/translations/hr.json +++ b/custom_components/vaillant_vsmart/translations/hr.json @@ -2,7 +2,6 @@ "config": { "step": { "user": { - "title": "Vaillant vSMART", "description": "Pomoć oko konfiguracije integracije potražite na ovom linku: https://github.com/MislavMandaric/home-assistant-vaillant-vsmart", "data": { "client_id": "ID klijenta",