From b5af81b74467c5350daaff260436b49fde6e2b0d Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Mon, 15 May 2023 19:29:42 +0200 Subject: [PATCH] Improve set parameters --- pyhon/appliance.py | 4 +++- pyhon/parameter/enum.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pyhon/appliance.py b/pyhon/appliance.py index 74f0b7c..64e18a5 100644 --- a/pyhon/appliance.py +++ b/pyhon/appliance.py @@ -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): diff --git a/pyhon/parameter/enum.py b/pyhon/parameter/enum.py index 02d01b4..66cfe7e 100644 --- a/pyhon/parameter/enum.py +++ b/pyhon/parameter/enum.py @@ -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})"