Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
13cff8caa0 | |||
5fc6245806 | |||
1dad0e14b8 | |||
b04c601ad6 | |||
3ec0f5a006 | |||
78bc85132f | |||
191928287f | |||
c0aab8b99d | |||
a68dcac379 | |||
40cc0013a5 | |||
f2aa3dc8fd | |||
e887371bec | |||
18b0ecdd68 |
14
pyhon/appliances/ov.py
Normal file
14
pyhon/appliances/ov.py
Normal file
@ -0,0 +1,14 @@
|
||||
class Appliance:
|
||||
def data(self, data):
|
||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
data["attributes"]["parameters"]["temp"] = "0"
|
||||
data["attributes"]["parameters"]["onOffStatus"] = "0"
|
||||
data["attributes"]["parameters"]["remoteCtrValid"] = "0"
|
||||
data["attributes"]["parameters"]["remainingTimeMM"] = "0"
|
||||
|
||||
data["active"] = data["attributes"]["parameters"]["onOffStatus"] == "1"
|
||||
|
||||
return data
|
||||
|
||||
def settings(self, settings):
|
||||
return settings
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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))
|
||||
|
@ -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))]
|
||||
|
Reference in New Issue
Block a user