Improve set parameters

This commit is contained in:
Andre Basche 2023-05-15 19:29:42 +02:00
parent 22a98e1781
commit b5af81b744
2 changed files with 5 additions and 1 deletions

View File

@ -169,7 +169,9 @@ class HonAppliance:
category = category.split(".")[-1].lower()
categories[category] = result[0]
if categories:
return [list(categories.values())[-1]]
if "setParameters" in categories:
return [categories["setParameters"]]
return [list(categories.values())[0]]
return []
def _get_commands(self, data):

View File

@ -9,6 +9,8 @@ class HonParameterEnum(HonParameter):
self._default = attributes.get("defaultValue")
self._value = self._default or "0"
self._values: List[str] = attributes.get("enumValues", [])
if self._default and self._default not in self._values:
self._values.append(self._default)
def __repr__(self) -> str:
return f"{self.__class__} (<{self.key}> {self.values})"