forked from node-red/node-red
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault-flows.json
More file actions
194 lines (194 loc) · 5.08 KB
/
default-flows.json
File metadata and controls
194 lines (194 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
[
{
"id": "demo-flow-1",
"type": "tab",
"label": "Welcome Flow",
"disabled": false,
"info": "This is a demo flow showing basic Node-RED capabilities",
"env": []
},
{
"id": "inject-node-1",
"type": "inject",
"z": "demo-flow-1",
"name": "Click to start",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "demo",
"payload": "{\"message\":\"Hello from Node-RED!\",\"timestamp\":$millis()}",
"payloadType": "jsonata",
"x": 150,
"y": 340,
"wires": [
["function-node-1"]
]
},
{
"id": "function-node-1",
"type": "function",
"z": "demo-flow-1",
"name": "Process Message",
"func": "// This function processes the incoming message\nconst timestamp = new Date(msg.payload.timestamp);\nmsg.payload.formatted = {\n original: msg.payload.message,\n uppercase: msg.payload.message.toUpperCase(),\n time: timestamp.toLocaleString(),\n wordCount: msg.payload.message.split(' ').length\n};\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 350,
"y": 340,
"wires": [
["debug-node-1", "change-node-1"]
]
},
{
"id": "debug-node-1",
"type": "debug",
"z": "demo-flow-1",
"name": "Output",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.formatted",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 550,
"y": 300,
"wires": []
},
{
"id": "change-node-1",
"type": "change",
"z": "demo-flow-1",
"name": "Extract Stats",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.formatted.wordCount",
"tot": "msg"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "statistics",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 350,
"y": 440,
"wires": [
["switch-node-1"]
]
},
{
"id": "switch-node-1",
"type": "switch",
"z": "demo-flow-1",
"name": "Check Count",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "lt",
"v": "3",
"vt": "num"
},
{
"t": "gte",
"v": "3",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 530,
"y": 440,
"wires": [
["template-node-1"],
["template-node-2"]
]
},
{
"id": "template-node-1",
"type": "template",
"z": "demo-flow-1",
"name": "Short Message",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Your message had only {{payload}} words.",
"output": "str",
"x": 720,
"y": 420,
"wires": [
["debug-node-2"]
]
},
{
"id": "template-node-2",
"type": "template",
"z": "demo-flow-1",
"name": "Long Message",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Great! Your message had {{payload}} words.",
"output": "str",
"x": 720,
"y": 460,
"wires": [
["debug-node-2"]
]
},
{
"id": "debug-node-2",
"type": "debug",
"z": "demo-flow-1",
"name": "Statistics",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 900,
"y": 440,
"wires": []
},
{
"id": "comment-node-1",
"type": "comment",
"z": "demo-flow-1",
"name": "This Node-RED environment is in demo mode. \\n Some things are simulated like deploys or do not work \\n on purpose like actual debug output. Other than that, \\n these experiments are meant to showcase a Node-RED \\n interface UX change for quick feedback purposes, the \\n experience is likely buggy due to this not being \\n production code.",
"info": "",
"x": 230,
"y": 120,
"wires": []
}
]