[
{
"id": "f6f2187d.f17ca8",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "3cc11d24.ff01a2",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "WARNING: please check you have started this container with a volume that is mounted to /data\\n otherwise any flow changes are lost when you redeploy or upgrade the container\\n (e.g. upgrade to a more recent node-red docker image).\\n If you are using named volumes you can ignore this warning.\\n Double click or see info side panel to learn how to start Node-RED in Docker to save your work",
"info": "\nTo start docker with a bind mount volume (-v option), for example:\n\n```\ndocker run -it -p 1880:1880 -v /home/user/node_red_data:/data --name mynodered nodered/node-red\n```\n\nwhere `/home/user/node_red_data` is a directory on your host machine where you want to store your flows.\n\nIf you do not do this then you can experiment and redploy flows, but if you restart or upgrade the container the flows will be disconnected and lost. \n\nThey will still exist in a hidden data volume, which can be recovered using standard docker techniques, but that is much more complex than just starting with a named volume as described above.",
"x": 350,
"y": 80,
"wires": []
},
{
"id": "b8226fa74b51b805",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "长按事件",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{"action":"长按"}",
"payloadType": "json",
"x": 160,
"y": 260,
"wires": [
[
"4625ef356421614f"
]
]
},
{
"id": "5860f1f8a03068da",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "短按事件",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{"action":"短按"}",
"payloadType": "json",
"x": 160,
"y": 360,
"wires": [
[
"4625ef356421614f"
]
]
},
{
"id": "4625ef356421614f",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "",
"property": "payload.action",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "长按",
"vt": "str"
},
{
"t": "eq",
"v": "短按",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 350,
"y": 300,
"wires": [
[
"bf5e1173c9daae01",
"cadf44ac989d0d62"
],
[
"b7b3cb2b3e2c3ab6"
]
]
},
{
"id": "bf5e1173c9daae01",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "设置阀",
"func": "flow.set("a", true)\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 240,
"wires": [
[
"b0f3dd1585350d2f"
]
]
},
{
"id": "b0f3dd1585350d2f",
"type": "delay",
"z": "f6f2187d.f17ca8",
"name": "",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 640,
"y": 240,
"wires": [
[
"5d291038e05825c5"
]
]
},
{
"id": "5d291038e05825c5",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "设置阀",
"func": "\nflow.set("a", false)\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 770,
"y": 240,
"wires": [
[]
]
},
{
"id": "cadf44ac989d0d62",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "开灯",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 610,
"y": 280,
"wires": []
},
{
"id": "f89df6f5f5b112c5",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "调节亮度",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 620,
"y": 360,
"wires": []
},
{
"id": "b7b3cb2b3e2c3ab6",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "",
"property": "a",
"propertyType": "flow",
"rules": [
{
"t": "eq",
"v": "false",
"vt": "jsonata"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 490,
"y": 360,
"wires": [
[
"f89df6f5f5b112c5"
]
]
}
]