mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-09 19:09:48 +00:00
Add if/else automation/script action (#12301)
Co-authored-by: Zack Barett <zackbarett@hey.com>
This commit is contained in:
@@ -194,6 +194,13 @@ export interface ChooseAction {
|
||||
default?: Action | Action[];
|
||||
}
|
||||
|
||||
export interface IfAction {
|
||||
alias?: string;
|
||||
if: string | Condition[];
|
||||
then: Action | Action[];
|
||||
else?: Action | Action[];
|
||||
}
|
||||
|
||||
export interface VariablesAction {
|
||||
alias?: string;
|
||||
variables: Record<string, unknown>;
|
||||
@@ -215,6 +222,7 @@ export type Action =
|
||||
| WaitForTriggerAction
|
||||
| RepeatAction
|
||||
| ChooseAction
|
||||
| IfAction
|
||||
| VariablesAction
|
||||
| PlayMediaAction
|
||||
| UnknownAction;
|
||||
@@ -228,6 +236,7 @@ export interface ActionTypes {
|
||||
activate_scene: SceneAction;
|
||||
repeat: RepeatAction;
|
||||
choose: ChooseAction;
|
||||
if: IfAction;
|
||||
wait_for_trigger: WaitForTriggerAction;
|
||||
variables: VariablesAction;
|
||||
service: ServiceAction;
|
||||
@@ -299,6 +308,9 @@ export const getActionType = (action: Action): ActionType => {
|
||||
if ("choose" in action) {
|
||||
return "choose";
|
||||
}
|
||||
if ("if" in action) {
|
||||
return "if";
|
||||
}
|
||||
if ("wait_for_trigger" in action) {
|
||||
return "wait_for_trigger";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user