From 9361a2a02278b22d1bc9cdef94a5dcf09ff90965 Mon Sep 17 00:00:00 2001 From: thomasgermain <12560542+thomasgermain@users.noreply.github.com> Date: Mon, 12 Apr 2021 13:25:52 +0200 Subject: [PATCH] 1.5.0b7 --- multimatic/config_flow.py | 13 ++++++++++--- multimatic/const.py | 1 + multimatic/hub.py | 7 +++++-- multimatic/manifest.json | 5 ++--- multimatic/translations/bg.json | 1 + multimatic/translations/ca.json | 1 + multimatic/translations/cs.json | 1 + multimatic/translations/da.json | 1 + multimatic/translations/de.json | 1 + multimatic/translations/en.json | 1 + multimatic/translations/es.json | 1 + multimatic/translations/fr.json | 19 ++++++++++--------- multimatic/translations/it.json | 3 ++- multimatic/translations/ko.json | 3 ++- multimatic/translations/lb.json | 3 ++- multimatic/translations/nl.json | 3 ++- multimatic/translations/nn.json | 3 ++- multimatic/translations/no.json | 3 ++- multimatic/translations/pl.json | 1 + multimatic/translations/pt-BR.json | 3 ++- multimatic/translations/pt.json | 3 ++- multimatic/translations/ru.json | 3 ++- multimatic/translations/sl.json | 3 ++- multimatic/translations/zh-Hant.json | 3 ++- 24 files changed, 58 insertions(+), 28 deletions(-) diff --git a/multimatic/config_flow.py b/multimatic/config_flow.py index a09f669..21f9f30 100644 --- a/multimatic/config_flow.py +++ b/multimatic/config_flow.py @@ -2,6 +2,7 @@ import logging from pymultimatic.api import ApiError +from pymultimatic.api.defaults import MULTIMATIC, SENSO import voluptuous as vol from homeassistant import config_entries, core, exceptions @@ -10,6 +11,7 @@ import homeassistant.helpers.config_validation as cv from .const import ( # pylint: disable=unused-import + CONF_APPLICATION, CONF_SERIAL_NUMBER, DEFAULT_SCAN_INTERVAL, DOMAIN, @@ -22,6 +24,7 @@ { vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str, + vol.Required(CONF_APPLICATION, default=MULTIMATIC): vol.In([MULTIMATIC, SENSO]), vol.Optional(CONF_SERIAL_NUMBER): str, } ) @@ -34,16 +37,20 @@ async def validate_input(hass: core.HomeAssistant, data): """ await validate_authentication( - hass, data[CONF_USERNAME], data[CONF_PASSWORD], data.get(CONF_SERIAL_NUMBER) + hass, + data[CONF_USERNAME], + data[CONF_PASSWORD], + data.get(CONF_SERIAL_NUMBER), + data.get(CONF_APPLICATION), ) return {"title": "Multimatic"} -async def validate_authentication(hass, username, password, serial): +async def validate_authentication(hass, username, password, serial, app): """Ensure provided credentials are working.""" try: - if not await check_authentication(hass, username, password, serial): + if not await check_authentication(hass, username, password, serial, app): raise InvalidAuth except ApiError as err: resp = await err.response.text() diff --git a/multimatic/const.py b/multimatic/const.py index b79fd12..c7dd9ac 100644 --- a/multimatic/const.py +++ b/multimatic/const.py @@ -33,6 +33,7 @@ CONF_QUICK_VETO_DURATION = "quick_veto_duration" CONF_SMARTPHONE_ID = "smartphoneid" CONF_SERIAL_NUMBER = "serial_number" +CONF_APPLICATION = "application" # constants for states_attributes ATTR_MULTIMATIC_MODE = "multimatic_mode" diff --git a/multimatic/hub.py b/multimatic/hub.py index 3298069..cf371d6 100644 --- a/multimatic/hub.py +++ b/multimatic/hub.py @@ -25,6 +25,7 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from .const import ( + CONF_APPLICATION, CONF_SERIAL_NUMBER, DEFAULT_QUICK_VETO_DURATION, DEFAULT_SMART_PHONE_ID, @@ -36,7 +37,7 @@ _LOGGER = logging.getLogger(__name__) -async def check_authentication(hass, username, password, serial): +async def check_authentication(hass, username, password, serial, app): """Check if provided username an password are corrects.""" return await pymultimatic.systemmanager.SystemManager( username, @@ -44,6 +45,7 @@ async def check_authentication(hass, username, password, serial): async_create_clientsession(hass), DEFAULT_SMART_PHONE_ID, serial, + app, ).login(True) @@ -56,6 +58,7 @@ def __init__(self, hass, entry: ConfigEntry): username = entry.data[CONF_USERNAME] password = entry.data[CONF_PASSWORD] serial = entry.data.get(CONF_SERIAL_NUMBER) + app = entry.data.get(CONF_APPLICATION) super().__init__( hass, @@ -67,7 +70,7 @@ def __init__(self, hass, entry: ConfigEntry): session = async_create_clientsession(hass) self._manager = pymultimatic.systemmanager.SystemManager( - username, password, session, DEFAULT_SMART_PHONE_ID, serial + username, password, session, DEFAULT_SMART_PHONE_ID, serial, app ) self.serial: str = serial diff --git a/multimatic/manifest.json b/multimatic/manifest.json index f4cb2c1..10a3b61 100644 --- a/multimatic/manifest.json +++ b/multimatic/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/multimatic", "requirements": [ - "pymultimatic==0.3.1" + "pymultimatic==0.4.0b0" ], "ssdp": [], "zeroconf": [], @@ -12,6 +12,5 @@ "dependencies": [], "codeowners": [ "@thomasgermain" - ], - "version": "1.5.0" + ] } \ No newline at end of file diff --git a/multimatic/translations/bg.json b/multimatic/translations/bg.json index 8f5da82..3d56273 100644 --- a/multimatic/translations/bg.json +++ b/multimatic/translations/bg.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" diff --git a/multimatic/translations/ca.json b/multimatic/translations/ca.json index 8f5da82..3d56273 100644 --- a/multimatic/translations/ca.json +++ b/multimatic/translations/ca.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" diff --git a/multimatic/translations/cs.json b/multimatic/translations/cs.json index 8f5da82..3d56273 100644 --- a/multimatic/translations/cs.json +++ b/multimatic/translations/cs.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" diff --git a/multimatic/translations/da.json b/multimatic/translations/da.json index 8f5da82..3d56273 100644 --- a/multimatic/translations/da.json +++ b/multimatic/translations/da.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" diff --git a/multimatic/translations/de.json b/multimatic/translations/de.json index 8f5da82..3d56273 100644 --- a/multimatic/translations/de.json +++ b/multimatic/translations/de.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" diff --git a/multimatic/translations/en.json b/multimatic/translations/en.json index 8f5da82..3d56273 100644 --- a/multimatic/translations/en.json +++ b/multimatic/translations/en.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" diff --git a/multimatic/translations/es.json b/multimatic/translations/es.json index 8f5da82..3d56273 100644 --- a/multimatic/translations/es.json +++ b/multimatic/translations/es.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" diff --git a/multimatic/translations/fr.json b/multimatic/translations/fr.json index dfaab36..8eab876 100644 --- a/multimatic/translations/fr.json +++ b/multimatic/translations/fr.json @@ -4,27 +4,28 @@ "step": { "user": { "data": { - "password": "Password", - "username": "Username", - "serial_number": "Serial number" + "password": "Mot de passe", + "username": "Utilisateur", + "application": "Application", + "serial_number": "Numéro de série" }, - "title": "Connection information (same as multiMATIC application)" + "title": "Identifiant (les même que pour vous identifier à l'application) " } }, "error": { - "cannot_connect": "Failed to connect, please try again", - "invalid_auth": "Invalid authentication", - "unknown": "Unexpected error" + "cannot_connect": "Impossible de se connecter", + "invalid_auth": "Identifiants incorrects", + "unknown": "Erreur inattendue" }, "abort": { - "already_configured": "Only one configuration is allowed" + "already_configured": "Une seule instance de l'intégration authorisée" } }, "options": { "step": { "init": { "data": { - "scan_interval": "minutes entre deux scans" + "scan_interval": "Minutes entre chaque rafraîchissement" } } } diff --git a/multimatic/translations/it.json b/multimatic/translations/it.json index ee68e96..3d56273 100644 --- a/multimatic/translations/it.json +++ b/multimatic/translations/it.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/ko.json b/multimatic/translations/ko.json index ee68e96..3d56273 100644 --- a/multimatic/translations/ko.json +++ b/multimatic/translations/ko.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/lb.json b/multimatic/translations/lb.json index ee68e96..3d56273 100644 --- a/multimatic/translations/lb.json +++ b/multimatic/translations/lb.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/nl.json b/multimatic/translations/nl.json index ee68e96..3d56273 100644 --- a/multimatic/translations/nl.json +++ b/multimatic/translations/nl.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/nn.json b/multimatic/translations/nn.json index ee68e96..3d56273 100644 --- a/multimatic/translations/nn.json +++ b/multimatic/translations/nn.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/no.json b/multimatic/translations/no.json index ee68e96..3d56273 100644 --- a/multimatic/translations/no.json +++ b/multimatic/translations/no.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/pl.json b/multimatic/translations/pl.json index 7cd9133..3feddd4 100644 --- a/multimatic/translations/pl.json +++ b/multimatic/translations/pl.json @@ -6,6 +6,7 @@ "data": { "password": "Hasło", "username": "Nazwa użytkownika", + "application": "Application", "serial_number": "Serial number" }, "title": "Informacje o połączeniu (takie same jak w aplikacji multiMATIC)" diff --git a/multimatic/translations/pt-BR.json b/multimatic/translations/pt-BR.json index ee68e96..3d56273 100644 --- a/multimatic/translations/pt-BR.json +++ b/multimatic/translations/pt-BR.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/pt.json b/multimatic/translations/pt.json index ee68e96..3d56273 100644 --- a/multimatic/translations/pt.json +++ b/multimatic/translations/pt.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/ru.json b/multimatic/translations/ru.json index ee68e96..3d56273 100644 --- a/multimatic/translations/ru.json +++ b/multimatic/translations/ru.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/sl.json b/multimatic/translations/sl.json index ee68e96..3d56273 100644 --- a/multimatic/translations/sl.json +++ b/multimatic/translations/sl.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { diff --git a/multimatic/translations/zh-Hant.json b/multimatic/translations/zh-Hant.json index ee68e96..3d56273 100644 --- a/multimatic/translations/zh-Hant.json +++ b/multimatic/translations/zh-Hant.json @@ -6,6 +6,7 @@ "data": { "password": "Password", "username": "Username", + "application": "Application", "serial_number": "Serial number" }, "title": "Connection information (same as multiMATIC application)" @@ -20,7 +21,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": {