node-red-contrib-sht41 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,912 @@
1
+ [
2
+ {
3
+ "id": "0080966785d82556",
4
+ "type": "tab",
5
+ "label": "SHT41",
6
+ "disabled": false,
7
+ "info": "",
8
+ "env": []
9
+ },
10
+ {
11
+ "id": "7efb63c0e8754179",
12
+ "type": "junction",
13
+ "z": "0080966785d82556",
14
+ "x": 60,
15
+ "y": 640,
16
+ "wires": [
17
+ [
18
+ "ebccfd932c2a31f0",
19
+ "4f8b4ec26fd5a71a"
20
+ ]
21
+ ]
22
+ },
23
+ {
24
+ "id": "615e4791407c064f",
25
+ "type": "junction",
26
+ "z": "0080966785d82556",
27
+ "x": 1060,
28
+ "y": 620,
29
+ "wires": [
30
+ [
31
+ "e8888c8f40ef02e7",
32
+ "b11d99967f295bce"
33
+ ]
34
+ ]
35
+ },
36
+ {
37
+ "id": "71d10f437b715aea",
38
+ "type": "inject",
39
+ "z": "0080966785d82556",
40
+ "name": "",
41
+ "props": [
42
+ {
43
+ "p": "payload"
44
+ },
45
+ {
46
+ "p": "topic",
47
+ "vt": "str"
48
+ }
49
+ ],
50
+ "repeat": "3",
51
+ "crontab": "",
52
+ "once": true,
53
+ "onceDelay": "1",
54
+ "topic": "",
55
+ "payload": "",
56
+ "payloadType": "date",
57
+ "x": 190,
58
+ "y": 300,
59
+ "wires": [
60
+ [
61
+ "54a29234d86ad5fc",
62
+ "7efb63c0e8754179"
63
+ ]
64
+ ]
65
+ },
66
+ {
67
+ "id": "bb5d1f552990cb21",
68
+ "type": "modbus-write",
69
+ "z": "0080966785d82556",
70
+ "name": "Temperature Int Scale 1",
71
+ "showStatusActivities": false,
72
+ "showErrors": true,
73
+ "showWarnings": true,
74
+ "unitid": "",
75
+ "dataType": "HoldingRegister",
76
+ "adr": "4",
77
+ "quantity": "1",
78
+ "server": "533869ad9b3eb5c0",
79
+ "emptyMsgOnFail": false,
80
+ "keepMsgProperties": false,
81
+ "delayOnStart": false,
82
+ "startDelayTime": "",
83
+ "x": 1330,
84
+ "y": 200,
85
+ "wires": [
86
+ [],
87
+ []
88
+ ]
89
+ },
90
+ {
91
+ "id": "54a29234d86ad5fc",
92
+ "type": "SHT41",
93
+ "z": "0080966785d82556",
94
+ "name": "",
95
+ "busNum": "1",
96
+ "address": "0x44",
97
+ "precision": "high",
98
+ "unit": "F",
99
+ "x": 440,
100
+ "y": 300,
101
+ "wires": [
102
+ [
103
+ "2235b3f5884da7d5",
104
+ "7d4acd6f6e02d67a",
105
+ "fc58ecc884c93b2a"
106
+ ]
107
+ ]
108
+ },
109
+ {
110
+ "id": "61615f2b34e7a921",
111
+ "type": "modbus-write",
112
+ "z": "0080966785d82556",
113
+ "name": "Humidity Int Scale 1",
114
+ "showStatusActivities": false,
115
+ "showErrors": true,
116
+ "showWarnings": true,
117
+ "unitid": "",
118
+ "dataType": "HoldingRegister",
119
+ "adr": "5",
120
+ "quantity": "1",
121
+ "server": "533869ad9b3eb5c0",
122
+ "emptyMsgOnFail": false,
123
+ "keepMsgProperties": false,
124
+ "delayOnStart": false,
125
+ "startDelayTime": "",
126
+ "x": 1320,
127
+ "y": 240,
128
+ "wires": [
129
+ [],
130
+ []
131
+ ]
132
+ },
133
+ {
134
+ "id": "7996814ebe0de15a",
135
+ "type": "comment",
136
+ "z": "0080966785d82556",
137
+ "name": "Registers 40005, 40006",
138
+ "info": "Registers 40005, 40006\nSending integer values, truncated\nExample: 75.2 -> 75",
139
+ "x": 1320,
140
+ "y": 160,
141
+ "wires": []
142
+ },
143
+ {
144
+ "id": "45e72b8c321d62be",
145
+ "type": "change",
146
+ "z": "0080966785d82556",
147
+ "name": "",
148
+ "rules": [
149
+ {
150
+ "t": "set",
151
+ "p": "payload",
152
+ "pt": "msg",
153
+ "to": "msg.payload * 100",
154
+ "tot": "jsonata"
155
+ }
156
+ ],
157
+ "action": "",
158
+ "property": "",
159
+ "from": "",
160
+ "to": "",
161
+ "reg": false,
162
+ "x": 1100,
163
+ "y": 360,
164
+ "wires": [
165
+ [
166
+ "4a17269f5534ca06"
167
+ ]
168
+ ]
169
+ },
170
+ {
171
+ "id": "1a41eb978e0fb4c9",
172
+ "type": "comment",
173
+ "z": "0080966785d82556",
174
+ "name": "Split Temp & RH into 2 outputs",
175
+ "info": "",
176
+ "x": 780,
177
+ "y": 240,
178
+ "wires": []
179
+ },
180
+ {
181
+ "id": "4a17269f5534ca06",
182
+ "type": "modbus-write",
183
+ "z": "0080966785d82556",
184
+ "name": "Temperature Int Scale 100",
185
+ "showStatusActivities": false,
186
+ "showErrors": true,
187
+ "showWarnings": true,
188
+ "unitid": "",
189
+ "dataType": "HoldingRegister",
190
+ "adr": "6",
191
+ "quantity": "1",
192
+ "server": "533869ad9b3eb5c0",
193
+ "emptyMsgOnFail": false,
194
+ "keepMsgProperties": false,
195
+ "delayOnStart": false,
196
+ "startDelayTime": "",
197
+ "x": 1340,
198
+ "y": 360,
199
+ "wires": [
200
+ [],
201
+ []
202
+ ]
203
+ },
204
+ {
205
+ "id": "a6a73866415c152d",
206
+ "type": "modbus-write",
207
+ "z": "0080966785d82556",
208
+ "name": "Humidity Int Scale 100",
209
+ "showStatusActivities": false,
210
+ "showErrors": true,
211
+ "showWarnings": true,
212
+ "unitid": "",
213
+ "dataType": "HoldingRegister",
214
+ "adr": "7",
215
+ "quantity": "1",
216
+ "server": "533869ad9b3eb5c0",
217
+ "emptyMsgOnFail": false,
218
+ "keepMsgProperties": false,
219
+ "delayOnStart": false,
220
+ "startDelayTime": "",
221
+ "x": 1320,
222
+ "y": 400,
223
+ "wires": [
224
+ [],
225
+ []
226
+ ]
227
+ },
228
+ {
229
+ "id": "e00e70ea6917f057",
230
+ "type": "comment",
231
+ "z": "0080966785d82556",
232
+ "name": "Registers 40007, 40008",
233
+ "info": "Registers 40007, 40008\nSending integer values, scale 100\nExample: 75.2 -> 7520",
234
+ "x": 1320,
235
+ "y": 320,
236
+ "wires": []
237
+ },
238
+ {
239
+ "id": "303c380f947c865c",
240
+ "type": "change",
241
+ "z": "0080966785d82556",
242
+ "name": "",
243
+ "rules": [
244
+ {
245
+ "t": "set",
246
+ "p": "payload",
247
+ "pt": "msg",
248
+ "to": "msg.payload * 100",
249
+ "tot": "jsonata"
250
+ }
251
+ ],
252
+ "action": "",
253
+ "property": "",
254
+ "from": "",
255
+ "to": "",
256
+ "reg": false,
257
+ "x": 1080,
258
+ "y": 400,
259
+ "wires": [
260
+ [
261
+ "a6a73866415c152d"
262
+ ]
263
+ ]
264
+ },
265
+ {
266
+ "id": "e6359853d3e13d3e",
267
+ "type": "comment",
268
+ "z": "0080966785d82556",
269
+ "name": "Multiply by 100",
270
+ "info": "Scale 100",
271
+ "x": 1100,
272
+ "y": 320,
273
+ "wires": []
274
+ },
275
+ {
276
+ "id": "711aab476d3b2984",
277
+ "type": "comment",
278
+ "z": "0080966785d82556",
279
+ "name": "Set repeat interval here",
280
+ "info": "",
281
+ "x": 220,
282
+ "y": 260,
283
+ "wires": []
284
+ },
285
+ {
286
+ "id": "b8ee1c02edef8f37",
287
+ "type": "comment",
288
+ "z": "0080966785d82556",
289
+ "name": "Or provide another trigger",
290
+ "info": "",
291
+ "x": 230,
292
+ "y": 340,
293
+ "wires": []
294
+ },
295
+ {
296
+ "id": "857f83c754dcca8b",
297
+ "type": "function",
298
+ "z": "0080966785d82556",
299
+ "name": "function 2",
300
+ "func": "// Example: msg.payload = 12.34 (float)\nlet value = msg.payload;\n\n// Create a buffer and write float\nlet buf = Buffer.allocUnsafe(4);\nbuf.writeFloatBE(value, 0); // Use writeFloatLE if little-endian\n\n// Split into two 16-bit registers\nlet registers = [\n buf.readUInt16BE(0), // High word\n buf.readUInt16BE(2) // Low word\n];\n\nmsg.payload = registers;\nreturn msg;",
301
+ "outputs": 1,
302
+ "timeout": 0,
303
+ "noerr": 0,
304
+ "initialize": "",
305
+ "finalize": "",
306
+ "libs": [],
307
+ "x": 1040,
308
+ "y": 520,
309
+ "wires": [
310
+ [
311
+ "dab7645d69f3ee14"
312
+ ]
313
+ ]
314
+ },
315
+ {
316
+ "id": "dab7645d69f3ee14",
317
+ "type": "modbus-write",
318
+ "z": "0080966785d82556",
319
+ "name": "Temperature as Float",
320
+ "showStatusActivities": false,
321
+ "showErrors": true,
322
+ "showWarnings": true,
323
+ "unitid": "",
324
+ "dataType": "MHoldingRegisters",
325
+ "adr": "8",
326
+ "quantity": "2",
327
+ "server": "533869ad9b3eb5c0",
328
+ "emptyMsgOnFail": false,
329
+ "keepMsgProperties": false,
330
+ "delayOnStart": false,
331
+ "startDelayTime": "",
332
+ "x": 1320,
333
+ "y": 520,
334
+ "wires": [
335
+ [],
336
+ []
337
+ ]
338
+ },
339
+ {
340
+ "id": "9016b4e24a812558",
341
+ "type": "comment",
342
+ "z": "0080966785d82556",
343
+ "name": "Registers 40009-40012",
344
+ "info": "Registers 40009 & 40010, and 40011 & 40012\nSending true float values across 2 16-bit Registers",
345
+ "x": 1320,
346
+ "y": 480,
347
+ "wires": []
348
+ },
349
+ {
350
+ "id": "cb623be7341fad31",
351
+ "type": "comment",
352
+ "z": "0080966785d82556",
353
+ "name": "Split Float -> 2 Words",
354
+ "info": "Passing float value directly, across two 16-bit registers",
355
+ "x": 1080,
356
+ "y": 480,
357
+ "wires": []
358
+ },
359
+ {
360
+ "id": "c4c0b3c412676c3a",
361
+ "type": "function",
362
+ "z": "0080966785d82556",
363
+ "name": "function 3",
364
+ "func": "// Example: msg.payload = 12.34 (float)\nlet value = msg.payload;\n\n// Create a buffer and write float\nlet buf = Buffer.allocUnsafe(4);\nbuf.writeFloatBE(value, 0); // Use writeFloatLE if little-endian\n\n// Split into two 16-bit registers\nlet registers = [\n buf.readUInt16BE(0), // High word\n buf.readUInt16BE(2) // Low word\n];\n\nmsg.payload = registers;\nreturn msg;",
365
+ "outputs": 1,
366
+ "timeout": 0,
367
+ "noerr": 0,
368
+ "initialize": "",
369
+ "finalize": "",
370
+ "libs": [],
371
+ "x": 1020,
372
+ "y": 560,
373
+ "wires": [
374
+ [
375
+ "1fccc7cb73dba291"
376
+ ]
377
+ ]
378
+ },
379
+ {
380
+ "id": "1fccc7cb73dba291",
381
+ "type": "modbus-write",
382
+ "z": "0080966785d82556",
383
+ "name": "Humidity as Float",
384
+ "showStatusActivities": false,
385
+ "showErrors": true,
386
+ "showWarnings": true,
387
+ "unitid": "",
388
+ "dataType": "MHoldingRegisters",
389
+ "adr": "10",
390
+ "quantity": "2",
391
+ "server": "533869ad9b3eb5c0",
392
+ "emptyMsgOnFail": false,
393
+ "keepMsgProperties": false,
394
+ "delayOnStart": false,
395
+ "startDelayTime": "",
396
+ "x": 1310,
397
+ "y": 560,
398
+ "wires": [
399
+ [],
400
+ []
401
+ ]
402
+ },
403
+ {
404
+ "id": "7c9f73c44d06cca4",
405
+ "type": "LCD-I2C",
406
+ "z": "0080966785d82556",
407
+ "name": "",
408
+ "variant": "PCF8574",
409
+ "size": "20x4",
410
+ "x": 800,
411
+ "y": 440,
412
+ "wires": []
413
+ },
414
+ {
415
+ "id": "b9906b65e15f8f84",
416
+ "type": "rpi-gpio in",
417
+ "z": "0080966785d82556",
418
+ "name": "",
419
+ "pin": "18",
420
+ "intype": "down",
421
+ "debounce": "25",
422
+ "read": true,
423
+ "bcm": true,
424
+ "x": 180,
425
+ "y": 760,
426
+ "wires": [
427
+ [
428
+ "cd2906c54ef314d7"
429
+ ]
430
+ ]
431
+ },
432
+ {
433
+ "id": "cd2906c54ef314d7",
434
+ "type": "modbus-write",
435
+ "z": "0080966785d82556",
436
+ "name": "Push Button",
437
+ "showStatusActivities": false,
438
+ "showErrors": false,
439
+ "showWarnings": true,
440
+ "unitid": "",
441
+ "dataType": "Coil",
442
+ "adr": "2",
443
+ "quantity": "1",
444
+ "server": "533869ad9b3eb5c0",
445
+ "emptyMsgOnFail": false,
446
+ "keepMsgProperties": false,
447
+ "delayOnStart": false,
448
+ "startDelayTime": "",
449
+ "x": 450,
450
+ "y": 760,
451
+ "wires": [
452
+ [],
453
+ []
454
+ ]
455
+ },
456
+ {
457
+ "id": "7bdb610d5c144742",
458
+ "type": "comment",
459
+ "z": "0080966785d82556",
460
+ "name": "Messages to LCD Screen",
461
+ "info": "",
462
+ "x": 750,
463
+ "y": 400,
464
+ "wires": []
465
+ },
466
+ {
467
+ "id": "af0deabb8a935b15",
468
+ "type": "comment",
469
+ "z": "0080966785d82556",
470
+ "name": "RPi GPIO - Push button input written to Modbus Coil 3",
471
+ "info": "Push button input written to Coil, instead of Discrete input",
472
+ "x": 320,
473
+ "y": 720,
474
+ "wires": []
475
+ },
476
+ {
477
+ "id": "11337b3c0fb965c5",
478
+ "type": "modbus-server",
479
+ "z": "0080966785d82556",
480
+ "name": "Server - Port 10502",
481
+ "logEnabled": true,
482
+ "hostname": "10.0.0.161",
483
+ "serverPort": "10502",
484
+ "responseDelay": 100,
485
+ "delayUnit": "ms",
486
+ "coilsBufferSize": "5",
487
+ "holdingBufferSize": "8",
488
+ "inputBufferSize": "20",
489
+ "discreteBufferSize": "5",
490
+ "showErrors": true,
491
+ "showStatusActivities": true,
492
+ "x": 790,
493
+ "y": 740,
494
+ "wires": [
495
+ [],
496
+ [],
497
+ [],
498
+ [],
499
+ []
500
+ ]
501
+ },
502
+ {
503
+ "id": "ebccfd932c2a31f0",
504
+ "type": "modbus-getter",
505
+ "z": "0080966785d82556",
506
+ "name": "Fan Setpoint & Deadband",
507
+ "showStatusActivities": true,
508
+ "showErrors": true,
509
+ "showWarnings": true,
510
+ "logIOActivities": false,
511
+ "unitid": "",
512
+ "dataType": "HoldingRegister",
513
+ "adr": "0",
514
+ "quantity": "3",
515
+ "server": "533869ad9b3eb5c0",
516
+ "useIOFile": false,
517
+ "ioFile": "",
518
+ "useIOForPayload": false,
519
+ "emptyMsgOnFail": false,
520
+ "keepMsgProperties": true,
521
+ "delayOnStart": false,
522
+ "enableDeformedMessages": false,
523
+ "startDelayTime": "",
524
+ "x": 230,
525
+ "y": 620,
526
+ "wires": [
527
+ [
528
+ "274d9f509748bb4b"
529
+ ],
530
+ []
531
+ ]
532
+ },
533
+ {
534
+ "id": "51d651ab66bb93dd",
535
+ "type": "function",
536
+ "z": "0080966785d82556",
537
+ "name": "Fan Control",
538
+ "func": "// *** INPUTS ***\n// Automatic Fan Control\nlet temperature = msg.payload.SHT41.temperature; // Measured temperature from SHT41\nlet setpointFloatWords = msg.payload.Setpoint; // Setpoint at which to turn fan on - From Modbus H.Registers 0 and 1\nlet deadband = {payload: msg.payload.Setpoint[2]}; // Expose deadband variable over Modbus, scaled 10x - From H.Reg 2\n\n// Override Fan Control\nlet fanOverride = msg.payload.Override[0]; // Put fan into override mode - From Modbus Coil 0\nlet fanOverrideCmd = msg.payload.Override[1]; // To override fan off or on - From Modbus Coil 1\n\n//Variable declaration\nlet minDB = 5; // Minimum deadband threshold, scaled 10x\nlet fanRun = {\n payload: context.get(\"fanRun\") || false}; // Creating a variable for fan output - using context.get for memory of variable state\nlet lcd = {payload: \"false\"}; // Creating variable for LCD text generation\nlet units = msg.payload.SHT41.unit; // Receive units of measurement from SHT41 node, displayed on LCD\n\n// Handle parsing fan setpoint\nlet buf = Buffer.alloc(4); // Create 4-byte buffer\nbuf.writeUInt16BE(setpointFloatWords[0], 0); // Write each register as 16-bit BE (Big Endian)\nbuf.writeUInt16BE(setpointFloatWords[1], 2);\nlet setpoint = buf.readFloatBE(0) !== 0 ? buf.readFloatBE(0) : 72; // Read as float, set initial value to 72 if register is empty\n\n// *** CONTROL LOGIC ***\ndeadband.payload = deadband.payload > minDB ? deadband.payload : minDB; // Minimum DB. Written to Modbus H.Reg\nif (fanOverride) {\n fanRun.payload = fanOverrideCmd;\n} else {\n if (temperature >= setpoint) {\n fanRun.payload = true;\n }\n else if (temperature < (setpoint - (deadband.payload/10))) {\n fanRun.payload = false;\n }\n}\ncontext.set(\"fanRun\", fanRun.payload); // Storing fan output state in memory to be retrieved with context.get\n\n// Function Node mini-status update\nnode.status({ fill: \"green\", shape: \"dot\", text: (fanRun.payload ? \"FAN ON\" : \"FAN OFF\") + \" - DB: \" + deadband.payload });\n\n// Update LCD Display\nlcd.payload = [\n { clear: false, text: \"Temperature: \" + temperature.toFixed(1) + \"\\xDF\" + units }, // \\xDF is special character to display ° symbol\n { text: \"Humidity: \" + msg.payload.SHT41.humidity.toFixed(1) + \"%RH\" },\n { text: \"Fan Setpoint: \" + setpoint.toFixed(1) + \"\\xDF\" + units },\n { text: (fanOverride ? \"FAN IN HAND - \" : \"FAN IN AUTO - \") + (fanRun.payload ? \"ON \" : \"OFF\") }\n];\n\n// *** UPDATE OUTPUTS ***\nreturn [lcd, fanRun, deadband];",
539
+ "outputs": 3,
540
+ "timeout": 0,
541
+ "noerr": 0,
542
+ "initialize": "",
543
+ "finalize": "",
544
+ "libs": [],
545
+ "x": 770,
546
+ "y": 620,
547
+ "wires": [
548
+ [
549
+ "7c9f73c44d06cca4"
550
+ ],
551
+ [
552
+ "615e4791407c064f"
553
+ ],
554
+ [
555
+ "5f0c567e6a910f3c"
556
+ ]
557
+ ]
558
+ },
559
+ {
560
+ "id": "e8888c8f40ef02e7",
561
+ "type": "rpi-gpio out",
562
+ "z": "0080966785d82556",
563
+ "name": "",
564
+ "pin": "26",
565
+ "set": true,
566
+ "level": "0",
567
+ "freq": "",
568
+ "out": "out",
569
+ "bcm": true,
570
+ "x": 1240,
571
+ "y": 660,
572
+ "wires": []
573
+ },
574
+ {
575
+ "id": "223b5bb206eecff1",
576
+ "type": "join",
577
+ "z": "0080966785d82556",
578
+ "name": "",
579
+ "mode": "custom",
580
+ "build": "object",
581
+ "property": "payload",
582
+ "propertyType": "msg",
583
+ "key": "topic",
584
+ "joiner": "\\n",
585
+ "joinerType": "str",
586
+ "useparts": false,
587
+ "accumulate": false,
588
+ "timeout": "",
589
+ "count": "3",
590
+ "reduceRight": false,
591
+ "reduceExp": "",
592
+ "reduceInit": "",
593
+ "reduceInitType": "",
594
+ "reduceFixup": "",
595
+ "x": 610,
596
+ "y": 620,
597
+ "wires": [
598
+ [
599
+ "51d651ab66bb93dd"
600
+ ]
601
+ ]
602
+ },
603
+ {
604
+ "id": "274d9f509748bb4b",
605
+ "type": "change",
606
+ "z": "0080966785d82556",
607
+ "name": "",
608
+ "rules": [
609
+ {
610
+ "t": "set",
611
+ "p": "topic",
612
+ "pt": "msg",
613
+ "to": "Setpoint",
614
+ "tot": "str"
615
+ }
616
+ ],
617
+ "action": "",
618
+ "property": "",
619
+ "from": "",
620
+ "to": "",
621
+ "reg": false,
622
+ "x": 450,
623
+ "y": 620,
624
+ "wires": [
625
+ [
626
+ "223b5bb206eecff1"
627
+ ]
628
+ ]
629
+ },
630
+ {
631
+ "id": "2235b3f5884da7d5",
632
+ "type": "change",
633
+ "z": "0080966785d82556",
634
+ "name": "",
635
+ "rules": [
636
+ {
637
+ "t": "set",
638
+ "p": "topic",
639
+ "pt": "msg",
640
+ "to": "SHT41",
641
+ "tot": "str"
642
+ }
643
+ ],
644
+ "action": "",
645
+ "property": "",
646
+ "from": "",
647
+ "to": "",
648
+ "reg": false,
649
+ "x": 450,
650
+ "y": 580,
651
+ "wires": [
652
+ [
653
+ "223b5bb206eecff1"
654
+ ]
655
+ ]
656
+ },
657
+ {
658
+ "id": "4f8b4ec26fd5a71a",
659
+ "type": "modbus-getter",
660
+ "z": "0080966785d82556",
661
+ "name": "Fan Override Coils",
662
+ "showStatusActivities": false,
663
+ "showErrors": true,
664
+ "showWarnings": false,
665
+ "logIOActivities": false,
666
+ "unitid": "",
667
+ "dataType": "Coil",
668
+ "adr": "0",
669
+ "quantity": "2",
670
+ "server": "533869ad9b3eb5c0",
671
+ "useIOFile": false,
672
+ "ioFile": "",
673
+ "useIOForPayload": false,
674
+ "emptyMsgOnFail": false,
675
+ "keepMsgProperties": false,
676
+ "delayOnStart": false,
677
+ "enableDeformedMessages": false,
678
+ "startDelayTime": "",
679
+ "x": 210,
680
+ "y": 660,
681
+ "wires": [
682
+ [
683
+ "06356c23f6b657f2"
684
+ ],
685
+ []
686
+ ]
687
+ },
688
+ {
689
+ "id": "06356c23f6b657f2",
690
+ "type": "change",
691
+ "z": "0080966785d82556",
692
+ "name": "",
693
+ "rules": [
694
+ {
695
+ "t": "set",
696
+ "p": "topic",
697
+ "pt": "msg",
698
+ "to": "Override",
699
+ "tot": "str"
700
+ }
701
+ ],
702
+ "action": "",
703
+ "property": "",
704
+ "from": "",
705
+ "to": "",
706
+ "reg": false,
707
+ "x": 450,
708
+ "y": 660,
709
+ "wires": [
710
+ [
711
+ "223b5bb206eecff1"
712
+ ]
713
+ ]
714
+ },
715
+ {
716
+ "id": "b11d99967f295bce",
717
+ "type": "modbus-write",
718
+ "z": "0080966785d82556",
719
+ "name": "Fan Run Cmd Status",
720
+ "showStatusActivities": false,
721
+ "showErrors": true,
722
+ "showWarnings": true,
723
+ "unitid": "",
724
+ "dataType": "Coil",
725
+ "adr": "3",
726
+ "quantity": "1",
727
+ "server": "533869ad9b3eb5c0",
728
+ "emptyMsgOnFail": false,
729
+ "keepMsgProperties": false,
730
+ "delayOnStart": false,
731
+ "startDelayTime": "",
732
+ "x": 1320,
733
+ "y": 740,
734
+ "wires": [
735
+ [],
736
+ []
737
+ ]
738
+ },
739
+ {
740
+ "id": "874aa929b30dfab7",
741
+ "type": "comment",
742
+ "z": "0080966785d82556",
743
+ "name": "RPi GPIO - Fan Coil Output",
744
+ "info": "",
745
+ "x": 1300,
746
+ "y": 620,
747
+ "wires": []
748
+ },
749
+ {
750
+ "id": "dbedf437bbc1206e",
751
+ "type": "comment",
752
+ "z": "0080966785d82556",
753
+ "name": "Modbus Coil 4",
754
+ "info": "Indicating that ran is commanded to run",
755
+ "x": 1350,
756
+ "y": 700,
757
+ "wires": []
758
+ },
759
+ {
760
+ "id": "7d4acd6f6e02d67a",
761
+ "type": "change",
762
+ "z": "0080966785d82556",
763
+ "name": "",
764
+ "rules": [
765
+ {
766
+ "t": "set",
767
+ "p": "payload",
768
+ "pt": "msg",
769
+ "to": "payload.temperature",
770
+ "tot": "msg"
771
+ }
772
+ ],
773
+ "action": "",
774
+ "property": "",
775
+ "from": "",
776
+ "to": "",
777
+ "reg": false,
778
+ "x": 780,
779
+ "y": 280,
780
+ "wires": [
781
+ [
782
+ "bb5d1f552990cb21",
783
+ "45e72b8c321d62be",
784
+ "857f83c754dcca8b"
785
+ ]
786
+ ]
787
+ },
788
+ {
789
+ "id": "fc58ecc884c93b2a",
790
+ "type": "change",
791
+ "z": "0080966785d82556",
792
+ "name": "",
793
+ "rules": [
794
+ {
795
+ "t": "set",
796
+ "p": "payload",
797
+ "pt": "msg",
798
+ "to": "payload.humidity",
799
+ "tot": "msg"
800
+ }
801
+ ],
802
+ "action": "",
803
+ "property": "",
804
+ "from": "",
805
+ "to": "",
806
+ "reg": false,
807
+ "x": 780,
808
+ "y": 320,
809
+ "wires": [
810
+ [
811
+ "61615f2b34e7a921",
812
+ "303c380f947c865c",
813
+ "c4c0b3c412676c3a"
814
+ ]
815
+ ]
816
+ },
817
+ {
818
+ "id": "5f0c567e6a910f3c",
819
+ "type": "modbus-write",
820
+ "z": "0080966785d82556",
821
+ "name": "Write Effective Deadband",
822
+ "showStatusActivities": false,
823
+ "showErrors": true,
824
+ "showWarnings": true,
825
+ "unitid": "",
826
+ "dataType": "HoldingRegister",
827
+ "adr": "2",
828
+ "quantity": "1",
829
+ "server": "533869ad9b3eb5c0",
830
+ "emptyMsgOnFail": false,
831
+ "keepMsgProperties": false,
832
+ "delayOnStart": false,
833
+ "startDelayTime": "",
834
+ "x": 1330,
835
+ "y": 840,
836
+ "wires": [
837
+ [],
838
+ []
839
+ ]
840
+ },
841
+ {
842
+ "id": "61e80fdc5cdecc15",
843
+ "type": "comment",
844
+ "z": "0080966785d82556",
845
+ "name": "Register 40003",
846
+ "info": "Update writing the effective Deadband to Register 40003",
847
+ "x": 1300,
848
+ "y": 800,
849
+ "wires": []
850
+ },
851
+ {
852
+ "id": "2dad63da89cda072",
853
+ "type": "comment",
854
+ "z": "0080966785d82556",
855
+ "name": "Modbus Server",
856
+ "info": "Modbus Server node just has to be present in the flow\nNot necessary to connect to anything else\n\nRaspberry Pi OS (Linux) sets below 1024 as 'privileged ports'\nwhich require special permissions to access.\nFor demo purposes, easier to set to port 10502 on both client and Server\n\nFor production service, likely want to assign permissions to use Port 502",
857
+ "x": 780,
858
+ "y": 680,
859
+ "wires": []
860
+ },
861
+ {
862
+ "id": "28632a80c0368474",
863
+ "type": "comment",
864
+ "z": "0080966785d82556",
865
+ "name": "README",
866
+ "info": "This is an example flow of a Modbus Server using an SHT41 sensor to execute simple closed-loop fan control based on a temperature setpoint and publishing to a local display.\n\nThe Server accepts fan setpoint and deadband values while outputting the temperature and humidity.\nThree formats of analog values via Modbus are demonstrated: float-truncated integer, scale 100 integer, and 2-word float.\n\nThe SHT41 sensor provides the temperature and humidity values, polled via I2C.\n\nAn optional display information using a 20x4 LCD screen is included.\n\nThe Raspberry Pi uses GPIO to detect a push button input and control a relay output (fan).",
867
+ "x": 180,
868
+ "y": 200,
869
+ "wires": []
870
+ },
871
+ {
872
+ "id": "533869ad9b3eb5c0",
873
+ "type": "modbus-client",
874
+ "name": "",
875
+ "clienttype": "tcp",
876
+ "bufferCommands": true,
877
+ "stateLogEnabled": false,
878
+ "queueLogEnabled": false,
879
+ "failureLogEnabled": true,
880
+ "tcpHost": "10.0.0.161",
881
+ "tcpPort": "10502",
882
+ "tcpType": "DEFAULT",
883
+ "serialPort": "/dev/ttyUSB",
884
+ "serialType": "RTU-BUFFERD",
885
+ "serialBaudrate": 9600,
886
+ "serialDatabits": 8,
887
+ "serialStopbits": 1,
888
+ "serialParity": "none",
889
+ "serialConnectionDelay": 100,
890
+ "serialAsciiResponseStartDelimiter": "0x3A",
891
+ "unit_id": 1,
892
+ "commandDelay": 1,
893
+ "clientTimeout": 1000,
894
+ "reconnectOnTimeout": true,
895
+ "reconnectTimeout": 2000,
896
+ "parallelUnitIdsAllowed": true,
897
+ "showErrors": true,
898
+ "showWarnings": true,
899
+ "showLogs": true
900
+ },
901
+ {
902
+ "id": "bf6ea38839e63328",
903
+ "type": "global-config",
904
+ "env": [],
905
+ "modules": {
906
+ "node-red-contrib-modbus": "5.45.2",
907
+ "node-red-contrib-sht41": "1.0.0",
908
+ "node-red-contrib-pcf8574-lcd": "0.1.0",
909
+ "node-red-node-pi-gpio": "2.0.6"
910
+ }
911
+ }
912
+ ]
@@ -0,0 +1,39 @@
1
+ [
2
+ {
3
+ "id": "sht41",
4
+ "type": "SHT41",
5
+ "name": "",
6
+ "busNum": "1",
7
+ "address": "0x44",
8
+ "precision": "high",
9
+ "unit": "C",
10
+ "x": 720,
11
+ "y": 260,
12
+ "wires": [
13
+ [
14
+ "debug"
15
+ ]
16
+ ]
17
+ },
18
+ {
19
+ "id": "inject",
20
+ "type": "inject",
21
+ "name": "Read Sensor",
22
+ "repeat": "",
23
+ "x": 490,
24
+ "y": 260,
25
+ "wires": [
26
+ [
27
+ "sht41"
28
+ ]
29
+ ]
30
+ },
31
+ {
32
+ "id": "debug",
33
+ "type": "debug",
34
+ "name": "SHT Output",
35
+ "x": 950,
36
+ "y": 260,
37
+ "wires": []
38
+ }
39
+ ]
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "node-red-contrib-sht41",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Node-RED node to read temperature and humidity from Sensirion SHT41 sensors over I2C",
5
+ "dependencies": {
6
+ "i2c-bus": "^5.2.2"
7
+ },
5
8
  "keywords": [
6
9
  "node-red",
7
10
  "sht41",
@@ -10,12 +13,23 @@
10
13
  "i2c",
11
14
  "sensor"
12
15
  ],
13
- "author": "Matt Love <Matt@WigglyWire.com>",
16
+ "author": {
17
+ "name": "Matt Love",
18
+ "email": "Matt@WigglyWire.com"
19
+ },
14
20
  "license": "MIT",
15
- "dependencies": {
16
- "i2c-bus": "^5.2.2"
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/WigglyWire/node-red-contrib-sht41"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/WigglyWire/node-red-contrib-sht41/issues"
27
+ },
28
+ "engines": {
29
+ "node": "*"
17
30
  },
18
31
  "node-red": {
32
+ "version": ">=3",
19
33
  "nodes": {
20
34
  "sht41": "sht41.js"
21
35
  }