Add oven climate support
This commit is contained in:
parent
7c6ac15901
commit
4888f2b1d0
@ -11,6 +11,7 @@ from pyhon import helper
|
||||
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
|
||||
@ -302,6 +303,16 @@ class HonAppliance:
|
||||
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
|
||||
|
||||
|
||||
|
@ -11,6 +11,10 @@ class Appliance:
|
||||
|
||||
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):
|
||||
|
@ -26,16 +26,28 @@ class HonParameterRange(HonParameter):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user