Fixes for fridge

This commit is contained in:
Andre Basche 2023-05-21 20:33:08 +02:00
parent c2765fe953
commit 9cd12e3234
2 changed files with 4 additions and 1 deletions

View File

@ -9,7 +9,7 @@ class HonParameterEnum(HonParameter):
self._default = attributes.get("defaultValue") self._default = attributes.get("defaultValue")
self._value = self._default or "0" self._value = self._default or "0"
self._values: List[str] = attributes.get("enumValues", []) 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) self._values.append(self._default)
def __repr__(self) -> str: def __repr__(self) -> str:

View File

@ -26,10 +26,13 @@ class HonRuleSet:
for entity_key, params in rule.items(): for entity_key, params in rule.items():
entity_key = self._command.appliance.options.get(entity_key, entity_key) entity_key = self._command.appliance.options.get(entity_key, entity_key)
for trigger_key, values in params.items(): for trigger_key, values in params.items():
trigger_key = trigger_key.replace("@", "")
trigger_key = self._command.appliance.options.get( trigger_key = self._command.appliance.options.get(
trigger_key, trigger_key trigger_key, trigger_key
) )
for trigger_value, entity_value in values.items(): for trigger_value, entity_value in values.items():
if entity_value.get("fixedValue") == f"@{entity_key}":
continue
self._rules.setdefault(trigger_key, []).append( self._rules.setdefault(trigger_key, []).append(
HonRule( HonRule(
trigger_key, trigger_key,