Merge pull request #2937 from smilerz/automation_fix

regex replace not run on food if there are no food aliases
This commit is contained in:
vabene1111 2024-02-11 09:31:15 +01:00 committed by GitHub
commit 3f19d94d2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,7 +98,7 @@ class AutomationEngine:
try:
return self.food_aliases[food.lower()]
except KeyError:
return food
return self.apply_regex_replace_automation(food, Automation.FOOD_REPLACE)
else:
if automation := Automation.objects.filter(space=self.request.space, type=Automation.FOOD_ALIAS, param_1__iexact=food, disabled=False).order_by('order').first():
return automation.param_2