From 6775a951ca713a6297fd67a4dcd389e3a4ac636f Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:29:05 +0200 Subject: [PATCH] Support for AEG Devices & de.json (#61) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added AEG PX7 Purifier * Update AEG Devices AX7 AX9 * Created German Translation * Translation of States * Update Translation & States * Update api.py --------- Co-authored-by: Johan Nenzén --- custom_components/wellbeing/api.py | 20 +++++++++-- .../wellbeing/translations/de.json | 35 +++++++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 custom_components/wellbeing/translations/de.json diff --git a/custom_components/wellbeing/api.py b/custom_components/wellbeing/api.py index 8400a63..21e11c5 100644 --- a/custom_components/wellbeing/api.py +++ b/custom_components/wellbeing/api.py @@ -2,6 +2,7 @@ import asyncio import logging import socket +import json from datetime import datetime, timedelta from enum import Enum @@ -14,6 +15,7 @@ from homeassistant.const import TEMP_CELSIUS, PERCENTAGE, CONCENTRATION_PARTS_PER_MILLION, \ CONCENTRATION_PARTS_PER_BILLION, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER + TIMEOUT = 10 RETRIES = 3 CLIENT_ID = "ElxOneApp" @@ -40,6 +42,10 @@ HEADERS = {"Content-type": "application/json; charset=UTF-8"} +class CustomComponent: + def get_translation(self, key): + return translations.get(key, key) + class Mode(str, Enum): OFF = "PowerOff" AUTO = "Auto" @@ -240,14 +246,22 @@ def setup(self, data): @property def speed_range(self) -> tuple: - if self.model == "WELLA7": + ## Electrolux Devices: + if self.model == "WELLA5": return 1, 5 - if self.model == "AX7": + if self.model == "WELLA7": return 1, 5 if self.model == "PUREA9": return 1, 9 - if self.model == "WELLA5": + + + ## AEG Devices: + if self.model == "AX5": return 1, 5 + if self.model == "AX7": + return 1, 5 + if self.model == "AX9": + return 1, 9 return 0, 0 diff --git a/custom_components/wellbeing/translations/de.json b/custom_components/wellbeing/translations/de.json new file mode 100644 index 0000000..cfc0d13 --- /dev/null +++ b/custom_components/wellbeing/translations/de.json @@ -0,0 +1,35 @@ +{ + "config": { + "step": { + "user": { + "description": "Wenn Sie Hilfe bei der Konfiguration benötigen, schauen Sie hier: https://github.com/JohNan/homeassistant-wellbeing", + "data": { + "username": "Benutzername (E-Mail)", + "password": "Passwort" + } + }, + "reauth_validate": { + "data": { + "password": "Passwort" + }, + "description": "Geben Sie das Passwort für {username} ein.", + "title": "Account-Reauthentifizierung" + } + }, + "error": { + "auth": "Benutzername oder Passwort falsch!" + }, + "abort": { + "single_instance_allowed": "Nur eine einzige Instanz ist zulässig." + } + }, + "options": { + "step": { + "user": { + "data": { + "scan_interval": "API-Aktualisierungsintervall (in Sekunden)" + } + } + } + } +}