Compare commits

...

4 Commits

Author SHA1 Message Date
13cff8caa0 Bump version to 8.2 2023-04-23 03:35:13 +02:00
5fc6245806 Get values for every parameter 2023-04-22 23:08:44 +02:00
1dad0e14b8 Handle special dry level 11 2023-04-22 23:08:24 +02:00
b04c601ad6 Add log for empty token 2023-04-21 23:51:35 +02:00
5 changed files with 21 additions and 4 deletions

View File

@ -1,3 +1,6 @@
from pyhon.parameter.fixed import HonParameterFixed
class Appliance:
def data(self, data):
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
@ -7,4 +10,7 @@ class Appliance:
return data
def settings(self, settings):
dry_level = settings["startProgram.dryLevel"]
if isinstance(dry_level, HonParameterFixed) and dry_level.value == "11":
settings.pop("startProgram.dryLevel", None)
return settings

View File

@ -228,7 +228,10 @@ class HonAuth:
except json.JSONDecodeError:
await self._error_logger(response)
return False
self._cognito_token = json_data["cognitoUser"]["Token"]
self._cognito_token = json_data.get("cognitoUser", {}).get("Token", "")
if not self._cognito_token:
_LOGGER.error(json_data)
raise exceptions.HonAuthenticationError()
return True
async def authenticate(self) -> None:

View File

@ -1,4 +1,4 @@
from typing import Dict, Any
from typing import Dict, Any, List
from pyhon.parameter.base import HonParameter
@ -19,3 +19,7 @@ class HonParameterFixed(HonParameter):
def value(self, value: str | float) -> None:
# Fixed values seems being not so fixed as thought
self._value = value
@property
def values(self) -> List[str]:
return list(str(self.value))

View File

@ -1,4 +1,4 @@
from typing import Dict, Any
from typing import Dict, Any, List
from pyhon.parameter.base import HonParameter
@ -47,3 +47,7 @@ class HonParameterRange(HonParameter):
raise ValueError(
f"Allowed: min {self._min} max {self._max} step {self._step}"
)
@property
def values(self) -> List[str]:
return [str(i) for i in range(int(self.min), int(self.max) + 1, int(self.step))]

View File

@ -7,7 +7,7 @@ with open("README.md", "r") as f:
setup(
name="pyhOn",
version="0.8.1",
version="0.8.2",
author="Andre Basche",
description="Control hOn devices with python",
long_description=long_description,