@gemini86/node-red-ds18b20
Version:
Node-RED node for ds18b20 sensors connected on GPIO (fork of iiot2k, which was removed from NPM)
1 lines • 3.46 kB
JSON
[{"id":"87346f5ff53c3252","type":"tab","label":"DS18B20 Demo","disabled":false,"info":"","env":[]},{"id":"e1ec18db8209d467","type":"iiot2k-ds18b20","z":"87346f5ff53c3252","gpio":"21","tupdate":"5","resolution":"12","onchange":true,"fahrenheit":false,"name":"","x":400,"y":200,"wires":[["f5b1e6f7b4efd28f"]]},{"id":"f5b1e6f7b4efd28f","type":"function","z":"87346f5ff53c3252","name":"split temp","func":"// Rounds number to fix decimal after point.\n// https://www.jacklmoore.com/notes/rounding-in-javascript/\nfunction toFix(value, decimals) {\n return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);\n}\n\n// send input array to outputs\nreturn [\n { payload: toFix(msg.payload[0], 2), topic: msg.topic[0] }, // output 1\n { payload: toFix(msg.payload[1], 2), topic: msg.topic[1] }, // output 2\n { payload: toFix(msg.payload[2], 2), topic: msg.topic[2] }, // output 3 \n { payload: toFix(msg.payload[3], 1), topic: msg.topic[3] }, // output 4 \n { payload: toFix(msg.payload[4], 2), topic: msg.topic[4] } // output 5 \n];\n","outputs":5,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":200,"wires":[["67936945cb4d34aa"],["b416c1d7dca9ae19"],["deca52f7488b402f"],["d952297542775397"],["b013a279fa217fe0"]]},{"id":"b013a279fa217fe0","type":"ui_gauge","z":"87346f5ff53c3252","name":"","group":"e18b9c1342198edb","order":0,"width":0,"height":0,"gtype":"gage","title":"{{msg.topic}}","label":"°C","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":810,"y":280,"wires":[]},{"id":"67936945cb4d34aa","type":"ui_gauge","z":"87346f5ff53c3252","name":"","group":"e18b9c1342198edb","order":0,"width":0,"height":0,"gtype":"gage","title":"{{msg.topic}}","label":"°C","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":810,"y":120,"wires":[]},{"id":"b416c1d7dca9ae19","type":"ui_gauge","z":"87346f5ff53c3252","name":"","group":"e18b9c1342198edb","order":0,"width":0,"height":0,"gtype":"gage","title":"{{msg.topic}}","label":"°C","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":810,"y":160,"wires":[]},{"id":"deca52f7488b402f","type":"ui_gauge","z":"87346f5ff53c3252","name":"","group":"e18b9c1342198edb","order":0,"width":0,"height":0,"gtype":"gage","title":"{{msg.topic}}","label":"°C","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":810,"y":200,"wires":[]},{"id":"d952297542775397","type":"ui_gauge","z":"87346f5ff53c3252","name":"","group":"e18b9c1342198edb","order":0,"width":0,"height":0,"gtype":"gage","title":"{{msg.topic}}","label":"°C","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":810,"y":240,"wires":[]},{"id":"e1fbd864ca97a487","type":"comment","z":"87346f5ff53c3252","name":"Example splits temp. array to single output, adapt to your count of sensors","info":"","x":580,"y":40,"wires":[]},{"id":"e18b9c1342198edb","type":"ui_group","name":"DS18B20 Temperature Demo","tab":"ddacdacec520c94f","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"ddacdacec520c94f","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]