Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
3ec0f5a006 | |||
78bc85132f | |||
191928287f | |||
c0aab8b99d | |||
b37715d0ca | |||
411effd814 | |||
04f19c4609 | |||
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
|
@ -62,11 +62,10 @@ class HonCommand:
|
|||||||
return self._ancillary_parameters
|
return self._ancillary_parameters
|
||||||
|
|
||||||
async def send(self) -> bool:
|
async def send(self) -> bool:
|
||||||
parameters = {
|
params = {k: v.value for k, v in self._parameters.items()}
|
||||||
name: parameter.value for name, parameter in self._parameters.items()
|
ancillary_params = {k: v.value for k, v in self._ancillary_parameters.items()}
|
||||||
}
|
|
||||||
return await self._api.send_command(
|
return await self._api.send_command(
|
||||||
self._appliance, self._name, parameters, self.ancillary_parameters
|
self._appliance, self._name, params, ancillary_params
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import List, TYPE_CHECKING
|
from typing import List, TYPE_CHECKING, Dict
|
||||||
|
|
||||||
from pyhon.parameter.enum import HonParameterEnum
|
from pyhon.parameter.enum import HonParameterEnum
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ class HonParameterProgram(HonParameterEnum):
|
|||||||
super().__init__(key, {})
|
super().__init__(key, {})
|
||||||
self._command = command
|
self._command = command
|
||||||
self._value: str = command.program
|
self._value: str = command.program
|
||||||
self._values: List[str] = list(command.programs)
|
self._programs: Dict[str, "HonCommand"] = command.programs
|
||||||
self._typology: str = "enum"
|
self._typology: str = "enum"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -25,9 +25,9 @@ class HonParameterProgram(HonParameterEnum):
|
|||||||
if value in self.values:
|
if value in self.values:
|
||||||
self._command.program = value
|
self._command.program = value
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Allowed values {self._values}")
|
raise ValueError(f"Allowed values {self.values}")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def values(self) -> List[str]:
|
def values(self) -> List[str]:
|
||||||
values = [v for v in self._values if all(f not in v for f in self._FILTER)]
|
values = [v for v in self._programs if all(f not in v for f in self._FILTER)]
|
||||||
return sorted(values)
|
return sorted(values)
|
||||||
|
2
setup.py
2
setup.py
@ -7,7 +7,7 @@ with open("README.md", "r") as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="pyhOn",
|
name="pyhOn",
|
||||||
version="0.8.0b5",
|
version="0.8.1",
|
||||||
author="Andre Basche",
|
author="Andre Basche",
|
||||||
description="Control hOn devices with python",
|
description="Control hOn devices with python",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
Reference in New Issue
Block a user