From 3438912ba59aa34ff84780da72c5b6643b7f133b Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 29 Apr 2022 16:47:44 +0200 Subject: [PATCH] Support shorthand logical operators in script sequences (#12509) --- src/data/script.ts | 2 +- .../config/automation/action/ha-automation-action-row.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/data/script.ts b/src/data/script.ts index dec65806c5..ee587f5946 100644 --- a/src/data/script.ts +++ b/src/data/script.ts @@ -294,7 +294,7 @@ export const getActionType = (action: Action): ActionType => { if ("wait_template" in action) { return "wait_template"; } - if ("condition" in action) { + if (["condition", "and", "or", "not"].some((key) => key in action)) { return "check_condition"; } if ("event" in action) { diff --git a/src/panels/config/automation/action/ha-automation-action-row.ts b/src/panels/config/automation/action/ha-automation-action-row.ts index 119f22ca5c..42a4465878 100644 --- a/src/panels/config/automation/action/ha-automation-action-row.ts +++ b/src/panels/config/automation/action/ha-automation-action-row.ts @@ -65,6 +65,9 @@ const getType = (action: Action | undefined) => { if ("service" in action || "scene" in action) { return getActionType(action); } + if (["and", "or", "not"].some((key) => key in action)) { + return "condition"; + } return OPTIONS.find((option) => option in action); };