Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
1.5.0b7
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgermain committed Apr 12, 2021
1 parent d80c735 commit 9361a2a
Show file tree
Hide file tree
Showing 24 changed files with 58 additions and 28 deletions.
13 changes: 10 additions & 3 deletions multimatic/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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,
}
)
Expand All @@ -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()
Expand Down
1 change: 1 addition & 0 deletions multimatic/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 5 additions & 2 deletions multimatic/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -36,14 +37,15 @@
_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,
password,
async_create_clientsession(hass),
DEFAULT_SMART_PHONE_ID,
serial,
app,
).login(True)


Expand All @@ -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,
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions multimatic/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/multimatic",
"requirements": [
"pymultimatic==0.3.1"
"pymultimatic==0.4.0b0"
],
"ssdp": [],
"zeroconf": [],
"homekit": {},
"dependencies": [],
"codeowners": [
"@thomasgermain"
],
"version": "1.5.0"
]
}
1 change: 1 addition & 0 deletions multimatic/translations/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand Down
1 change: 1 addition & 0 deletions multimatic/translations/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand Down
1 change: 1 addition & 0 deletions multimatic/translations/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand Down
1 change: 1 addition & 0 deletions multimatic/translations/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand Down
1 change: 1 addition & 0 deletions multimatic/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand Down
1 change: 1 addition & 0 deletions multimatic/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand Down
1 change: 1 addition & 0 deletions multimatic/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand Down
19 changes: 10 additions & 9 deletions multimatic/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/lb.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/nn.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
1 change: 1 addition & 0 deletions multimatic/translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
3 changes: 2 additions & 1 deletion multimatic/translations/sl.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"data": {
"password": "Password",
"username": "Username",
"application": "Application",
"serial_number": "Serial number"
},
"title": "Connection information (same as multiMATIC application)"
Expand All @@ -20,7 +21,7 @@
"already_configured": "Only one configuration is allowed"
}
},
"options": {
"options": {
"step": {
"init": {
"data": {
Expand Down
Loading

0 comments on commit 9361a2a

Please sign in to comment.