From 9cd12e3234f1db71ce9d1df456916aadf69f3c56 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 21 May 2023 20:33:08 +0200 Subject: [PATCH] Fixes for fridge --- pyhon/parameter/enum.py | 2 +- pyhon/rules.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyhon/parameter/enum.py b/pyhon/parameter/enum.py index e518f1d..016c617 100644 --- a/pyhon/parameter/enum.py +++ b/pyhon/parameter/enum.py @@ -9,7 +9,7 @@ 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 str(self._default) not in self.values: + if self._default and str(self._default.strip("[]")) not in self.values: self._values.append(self._default) def __repr__(self) -> str: diff --git a/pyhon/rules.py b/pyhon/rules.py index 6ba060d..a87cd9a 100644 --- a/pyhon/rules.py +++ b/pyhon/rules.py @@ -26,10 +26,13 @@ class HonRuleSet: for entity_key, params in rule.items(): entity_key = self._command.appliance.options.get(entity_key, entity_key) for trigger_key, values in params.items(): + trigger_key = trigger_key.replace("@", "") trigger_key = self._command.appliance.options.get( trigger_key, trigger_key ) for trigger_value, entity_value in values.items(): + if entity_value.get("fixedValue") == f"@{entity_key}": + continue self._rules.setdefault(trigger_key, []).append( HonRule( trigger_key,