Skip to content

Commit

Permalink
Add oven climate support
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed May 28, 2023
1 parent 7c6ac15 commit 4888f2b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
11 changes: 11 additions & 0 deletions pyhon/appliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pyhon.commands import HonCommand
from pyhon.parameter.base import HonParameter
from pyhon.parameter.fixed import HonParameterFixed
from pyhon.parameter.range import HonParameterRange

if TYPE_CHECKING:
from pyhon import HonAPI
Expand Down Expand Up @@ -302,6 +303,16 @@ def sync_command(self, main, target=None) -> None:
continue
for name, parameter in data.parameters.items():
if base_value := base.parameters.get(name):
if isinstance(base_value, HonParameterRange) and isinstance(
parameter, HonParameterRange
):
parameter.max = base_value.max
parameter.min = base_value.min
parameter.step = base_value.step
elif isinstance(parameter, HonParameterRange):
parameter.max = int(base_value.value)
parameter.min = int(base_value.value)
parameter.step = 1
parameter.value = base_value.value


Expand Down
4 changes: 4 additions & 0 deletions pyhon/appliances/ov.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def data(self, data):

data["active"] = data["attributes"]["parameters"]["onOffStatus"] == "1"

if program := int(data["attributes"]["parameters"]["prCode"]):
ids = self.parent.settings["startProgram.program"].ids
data["programName"] = ids.get(program, "")

return data

def settings(self, settings):
Expand Down
12 changes: 12 additions & 0 deletions pyhon/parameter/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,28 @@ def __repr__(self):
def min(self) -> float:
return self._min

@min.setter
def min(self, min: float) -> None:
self._min = min

@property
def max(self) -> float:
return self._max

@max.setter
def max(self, max: float) -> None:
self._max = max

@property
def step(self) -> float:
if not self._step:
return 1
return self._step

@step.setter
def step(self, step: float) -> None:
self._step = step

@property
def value(self) -> str | float:
return self._value if self._value is not None else self._min
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="pyhOn",
version="0.11.2",
version="0.11.3",
author="Andre Basche",
description="Control hOn devices with python",
long_description=long_description,
Expand Down

0 comments on commit 4888f2b

Please sign in to comment.