added scene support

This commit is contained in:
ari committed 2022-08-06 22:43:56 -04:00
1 parent 754cc2ef98
commit 6b21734041
6 files changed
+52 -12

No files matched your search

@@ -0,0 +1,21 @@
import InputText from "components/Inputs/Base/InputText";
import { SceneAction } from "types/automations/actions";
import { OptionManager } from "./OptionManager";
export const ActionSceneState: OptionManager<SceneAction> = {
defaultState: () => ({
scene: "",
}),
isReady: () => true,
Component: ({ state, setState }) => {
return (
<>
<InputText
label="Scene"
value={state.scene ?? ""}
onChange={(d) => setState({ ...state, scene: d })}
/>
</>
);
},
};
@@ -22,6 +22,7 @@ import { ActionStopState } from "./ActionStop";
import { ActionParallelState } from "./ActionParallel";
import { TriggerSunState } from "./TriggerSun";
import { TriggerCalendarState } from "./TriggerCalendar";
import { ActionSceneState } from "./ActionScene";
export const getOptionManager = <T extends AutomationNodeTypes>(
nodeType: T,
@@ -41,6 +42,8 @@ export const getOptionManager = <T extends AutomationNodeTypes>(
return ActionCallServiceState;
case "wait":
return ActionWaitState;
case "scene":
return ActionSceneState;
case "stop":
return ActionStopState;
case "delay":
+13 -12
View File
@@ -4,24 +4,25 @@ const subtypeDescMap: Partial<Record<AutomationNodeSubtype, string>> = {
choose: "create conditional if/else statements",
parallel: "run multiple nodes at the same time",
stop: "stop the automation with a status code",
scene: "activate a scene.",
wait: "wait based on a condition",
repeat: "repeat a sequence until or while some conditions are met",
device: "device related actions",
service: "call a service",
event: "Fires when an event is being received.",
homeassistant: "Fires when Home Assistant starts up or shuts down.",
mqtt: "Fires when a specific message is received on given MQTT topic.",
sun: "Fires when the sun is setting or rising.",
event: "fires when an event is being received.",
homeassistant: "fires when Home Assistant starts up or shuts down.",
mqtt: "fires when a specific message is received on given MQTT topic.",
sun: "fires when the sun is setting or rising.",
numeric_state:
"Fires when the numeric value of an entity's state or attribute changes.",
state: "Fires when an entity's state or attribute changes",
template: "Evaluate a custom template",
time: "Specify a certain time to run",
"fires when the numeric value of an entity's state or attribute changes.",
state: "fires when an entity's state or attribute changes",
template: "evaluate a custom template",
time: "specify a certain time to run",
webhook:
"Webhook trigger fires when a web request is made to the webhook endpoint",
zone: "Specify when an entity enters or leaves a zone",
tag: "Fires when a tag is scanned.",
calendar: "Fires when a Calendar event starts or ends.",
"webhook trigger fires when a web request is made to the webhook endpoint",
zone: "specify when an entity enters or leaves a zone",
tag: "fires when a tag is scanned.",
calendar: "fires when a Calendar event starts or ends.",
};
export const getNodeSubTypeDescription = (