choose flow

This commit is contained in:
ari committed 2022-04-30 22:51:51 -04:00
1 parent 468a022582
commit 56d68d9065
5 files changed
+338 -58

No files matched your search

+195 -1
View File
@@ -18,7 +18,10 @@ export default {
nodeWidth: dgconst.NODE_WIDTH,
distanceFactor: dgconst.DISTANCE_FACTOR,
circleSize: dgconst.CIRCLE_SIZE,
padding: dgconst.PADDING,
padding: {
x: dgconst.PADDING,
y: dgconst.PADDING,
},
}
}
} as ComponentMeta<typeof DAGFlow>
@@ -120,6 +123,197 @@ Simple.args = {
}
export const Complex = Template.bind({})
Complex.args = {
...Complex.args,
automation: {
tags: {
"Room": "Bathroom",
"For": "Toliet",
"Type": "Smell",
"Use": "Flushing"
},
metadata: {
id: "random",
alias: "Random",
description: "Example Metadata",
trigger_variables: {
'wowo': '!'
},
mode: 'single',
},
trigger: [
{
"$smType": undefined,
"platform": "numeric_state",
"entity_id": "test",
"alias": "1",
},
{
"$smType": undefined,
"platform": "homeassistant",
"event": "start",
"alias": "2",
}
],
sequence: [
{
"$smType": "condition",
"condition": "and",
"condition_data": {
"conditions": [
{
"$smType": "condition",
"condition": "numeric_state",
"condition_data": {
"entity_id": "sensor.temperature_kitchen",
"below": "15"
}
},
{
"$smType": "condition",
"condition": "template",
"condition_data": {
"value_template": "states(switch.kitchen_light) == \"on\""
}
}
]
}
},
{
"$smType": "action",
"action": "service",
"action_data": {
"alias": "Start Music In Kitchen",
"service": "media_player.play_media",
"target": {
"entity_id": "media_player.kitchen_dot"
},
"data": {
"media_content_id": "Good Morning",
"media_content_type": "SPOTIFY"
}
}
},
{
"$smType": "action",
"action": "choose",
"action_data": {
"choose": [
{
"conditions": [
{
"$smType": "condition",
"condition": "state",
"condition_data": {
"entity_id": "lights.bathroom",
"state": "off",
}
}
],
"sequence": [
{
"$smType": "action",
"action": "service",
"action_data": {
"service": "light.turn_on",
"target": {
"entity_id": "lights.bathroom"
},
"data": {}
}
},
{
"$smType": "action",
"action": "service",
"action_data": {
"alias": "Turn off bedroom",
"service": "light.turn_off",
"target": {
"entity_id": "lights.bedroom"
},
"data": {}
}
}
]
},
{
"conditions": [
{
"$smType": "condition",
"condition": "state",
"condition_data": {
"entity_id": "lights.bedroom",
"state": "off",
}
}
],
"sequence": [
{
"$smType": "action",
"action": "service",
"action_data": {
"alias": "Turn on bedroom",
"service": "light.turn_on",
"target": {
"entity_id": "lights.bedroom"
},
"data": {}
}
},
{
"$smType": "action",
"action": "choose",
"action_data": {
"choose": [
{
"conditions": [],
"sequence": [
{
"$smType": "action",
"action": "choose",
"action_data": {
"choose": [],
"default": [],
}
}
]
}
],
"default": [
{
"$smType": "action",
"action": "choose",
"action_data": {
"choose": [],
"default": [],
}
}
],
}
}
]
}
],
"default": [
{
"$smType": "action",
"action": "service",
"action_data": {
"service": "light.turn_off",
"target": {
"entity_id": "lights.bathroom"
},
"data": {}
}
}
]
}
}
]
}
}
export const EmptyStart = Template.bind({})
EmptyStart.args = {
...EmptyStart.args,