Browse Source

guide edit

Federico Bonelli 2 years ago
parent
commit
c10039811a
1 changed files with 130 additions and 0 deletions
  1. 130 0
      guide.md

+ 130 - 0
guide.md

@@ -179,3 +179,133 @@ type: `sudo npm install -g --unsafe-perm node-red`
179 179
 
180 180
 ### Node-red to Arduino
181 181
 - https://nodered.org/docs/hardware/arduino
182
+
183
+
184
+
185
+saved for awareness
186
+[
187
+    {
188
+        "id": "ef1636fd.7b444",
189
+        "type": "redis-command",
190
+        "z": "e245c75.b7b05b8",
191
+        "server": "1eaea47.a3a8fdc",
192
+        "command": "keys",
193
+        "name": "redis_thing_list",
194
+        "topic": "",
195
+        "x": 534,
196
+        "y": 214,
197
+        "wires": [
198
+            [
199
+                "ff91d9fa.ca87b"
200
+            ]
201
+        ]
202
+    },
203
+    {
204
+        "id": "ff91d9fa.ca87b",
205
+        "type": "function",
206
+        "z": "e245c75.b7b05b8",
207
+        "name": "things_state",
208
+        "func": "global.set(\"count\", msg.payload.length);\n\nmsg.payload = global.get(\"count\");\n\nreturn msg;",
209
+        "outputs": 1,
210
+        "noerr": 0,
211
+        "x": 774,
212
+        "y": 83,
213
+        "wires": [
214
+            []
215
+        ]
216
+    },
217
+    {
218
+        "id": "a26d10b.1e4a97",
219
+        "type": "redis-command",
220
+        "z": "e245c75.b7b05b8",
221
+        "server": "1eaea47.a3a8fdc",
222
+        "command": "keys",
223
+        "name": "redis_thing_list",
224
+        "topic": "",
225
+        "x": 513,
226
+        "y": 399,
227
+        "wires": [
228
+            [
229
+                "3403d100.3bcc38",
230
+                "cc300ec0.38ee8"
231
+            ]
232
+        ]
233
+    },
234
+    {
235
+        "id": "38d0bf6d.74b7c8",
236
+        "type": "inject",
237
+        "z": "e245c75.b7b05b8",
238
+        "name": "list_things",
239
+        "topic": "",
240
+        "payload": "[\"thing_*\"]",
241
+        "payloadType": "json",
242
+        "repeat": "",
243
+        "crontab": "",
244
+        "once": false,
245
+        "x": 227,
246
+        "y": 398,
247
+        "wires": [
248
+            [
249
+                "a26d10b.1e4a97"
250
+            ]
251
+        ]
252
+    },
253
+    {
254
+        "id": "3403d100.3bcc38",
255
+        "type": "trigger",
256
+        "z": "e245c75.b7b05b8",
257
+        "op1": "",
258
+        "op2": "[\"thing_*\"]",
259
+        "op1type": "nul",
260
+        "op2type": "json",
261
+        "duration": "1",
262
+        "extend": false,
263
+        "units": "s",
264
+        "reset": "",
265
+        "name": "trigger_rescan",
266
+        "x": 348,
267
+        "y": 227,
268
+        "wires": [
269
+            [
270
+                "ef1636fd.7b444"
271
+            ]
272
+        ]
273
+    },
274
+    {
275
+        "id": "cc300ec0.38ee8",
276
+        "type": "function",
277
+        "z": "e245c75.b7b05b8",
278
+        "name": "comp_things",
279
+        "func": "var old_cnt = global.get(\"count\");\nvar new_cnt = msg.payload.length;\n\nif (old_cnt > new_cnt) {\n    msg.payload = \"A thing went away.\";\n} else if ( old_cnt < new_cnt) {\n    msg.payload = \"A thing appeared!\";\n} else {\n    msg.payload = null;\n}\n\nreturn msg;",
280
+        "outputs": 1,
281
+        "noerr": 0,
282
+        "x": 790,
283
+        "y": 401,
284
+        "wires": [
285
+            [
286
+                "87175c25.0255f8"
287
+            ]
288
+        ]
289
+    },
290
+    {
291
+        "id": "87175c25.0255f8",
292
+        "type": "debug",
293
+        "z": "e245c75.b7b05b8",
294
+        "name": "",
295
+        "active": true,
296
+        "console": "false",
297
+        "complete": "false",
298
+        "x": 1034,
299
+        "y": 418,
300
+        "wires": []
301
+    },
302
+    {
303
+        "id": "1eaea47.a3a8fdc",
304
+        "type": "redis-config",
305
+        "z": "",
306
+        "host": "localhost",
307
+        "port": "6379",
308
+        "dbase": "0",
309
+        "pass": ""
310
+    }
311
+]