Fix types

This commit is contained in:
Paulus Schoutsen 2021-03-22 22:43:08 +00:00
parent 4b664cc142
commit 20da329a21
3 changed files with 19 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import { DemoTrace } from "./types";
export const motionLightTrace: DemoTrace = {
trace: {
automation_id: "",
last_action: "action/3",
last_condition: null,
run_id: "1",

View File

@ -18,6 +18,14 @@ export interface ConditionTrace extends BaseTrace {
result: { result: boolean };
}
export interface CallServiceActionTrace extends BaseTrace {
result: {
limit: number;
running_script: boolean;
params: Record<string, unknown>;
};
}
export interface ChooseActionTrace extends BaseTrace {
result: { choice: number };
}
@ -28,10 +36,13 @@ export interface ChooseChoiceActionTrace extends BaseTrace {
export type ActionTrace =
| BaseTrace
| CallServiceActionTrace
| ChooseActionTrace
| ChooseChoiceActionTrace;
export interface AutomationTrace {
automation_id: string;
unique_id: string;
last_action: string | null;
last_condition: string | null;
run_id: string;
@ -41,7 +52,6 @@ export interface AutomationTrace {
finish: string | null;
};
trigger: unknown;
unique_id: string;
}
export interface AutomationTraceExtended extends AutomationTrace {

View File

@ -104,8 +104,13 @@ export interface UntilRepeat extends BaseRepeat {
}
export interface ChooseAction {
alias?: string;
choose: [{ conditions: Condition[]; sequence: Action[] }];
choose: [
{
alias?: string;
conditions: string | Condition[];
sequence: Action[];
}
];
default?: Action[];
}