Node-RED – Voorbeeld – Modbus uitlezen en visualiseren (multisensor)
Voorbeelden voor het uitlezen van onze multisensors op node-red
Multisensor HW v1.10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
var temp1 = parseFloat(msg.payload[0] + "." + msg.payload[1]); var temp2 = parseFloat(msg.payload[2] + "." + msg.payload[3]); var temp3 = parseFloat(msg.payload[4] + "." + msg.payload[5]); var hum = parseFloat(msg.payload[6] + "." + msg.payload[7]); var bar = parseFloat(msg.payload[8] + "." + msg.payload[9]); var co2 = parseFloat(msg.payload[10]); var lux = parseFloat(msg.payload[11]); var hw = msg.payload[15] + "." + msg.payload[16]; var mod = msg.payload[17]; var fw = msg.payload[18] + "." + msg.payload[19]; var msg1 = {payload:temp1}; var msg2 = {payload:temp2}; var msg3 = {payload:temp3}; var msg4 = {payload:hum}; var msg5 = {payload:bar}; var msg6 = {payload:co2}; var msg7 = {payload:lux}; var msg8 = {payload:hw}; var msg9 = {payload:mod}; var msg10 = {payload:fw}; return [msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,msg10]; |
1 |
[{"id":"8e4709da.ff3438","type":"function","z":"72ca7ddb.f1fef4","name":"Array Parser","func":"var temp1 = parseFloat(msg.payload[0] + \".\" + msg.payload[1]);\nvar temp2 = parseFloat(msg.payload[2] + \".\" + msg.payload[3]);\nvar temp3 = parseFloat(msg.payload[4] + \".\" + msg.payload[5]);\nvar hum = parseFloat(msg.payload[6] + \".\" + msg.payload[7]);\nvar bar = parseFloat(msg.payload[8] + \".\" + msg.payload[9]);\nvar co2 = parseFloat(msg.payload[10]);\nvar lux = parseFloat(msg.payload[11]);\nvar hw = msg.payload[15] + \".\" + msg.payload[16];\nvar mod = msg.payload[17];\nvar fw = msg.payload[18] + \".\" + msg.payload[19];\n\nvar msg1 = {payload:temp1};\nvar msg2 = {payload:temp2};\nvar msg3 = {payload:temp3};\nvar msg4 = {payload:hum};\nvar msg5 = {payload:bar};\nvar msg6 = {payload:co2};\nvar msg7 = {payload:lux};\nvar msg8 = {payload:hw};\nvar msg9 = {payload:mod};\nvar msg10 = {payload:fw};\n\nreturn [msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,msg10];","outputs":10,"noerr":0,"x":430,"y":340,"wires":[["74fad254.999e6c","9d30a15.79e5d6"],["3f6f89ca.9744d6","fd4a3cd3.a7826"],["cd157f85.13fde","7a5a8d32.dbfb14"],["8f42bf2b.987a8","10e05759.2d4e19"],["b8539fae.022d1","29a8885c.b0a468"],["2212dc2a.a66964","dc972f2.7ce30d"],["89f376c0.1fdeb8","d62073dc.3188c"],["7b7790ab.9c1e3"],["aa1a0305.03ba2"],["82ddd3da.7db21"]],"inputLabels":["msg"],"outputLabels":["temp","","","","","","","","",""]},{"id":"74fad254.999e6c","type":"ui_gauge","z":"72ca7ddb.f1fef4","name":"Temp DS18B20","group":"fab0db25.fb55b8","order":3,"width":0,"height":0,"gtype":"gage","title":"Temp DS18B20","label":"Graden C","format":"{{value}}","min":"5","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"15","seg2":"30","x":760,"y":60,"wires":[]},{"id":"91d6bdd6.ab9f4","type":"modbus-read","z":"72ca7ddb.f1fef4","name":"MODBUS LEZEN","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"1","dataType":"HoldingRegister","adr":"0","quantity":"24","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"5dffa21.0a6fe5c","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":170,"y":260,"wires":[["8e4709da.ff3438","92a24fc7.f32b8"],[]]},{"id":"92a24fc7.f32b8","type":"debug","z":"72ca7ddb.f1fef4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":430,"y":200,"wires":[]},{"id":"9d30a15.79e5d6","type":"ui_chart","z":"72ca7ddb.f1fef4","name":"Temp DS18B20 chart","group":"fab0db25.fb55b8","order":4,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"40","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":780,"y":100,"wires":[[],[]]},{"id":"10e05759.2d4e19","type":"ui_chart","z":"72ca7ddb.f1fef4","name":"HumChart","group":"ed5e1c9c.66396","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"20","ymax":"100","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":750,"y":400,"wires":[[],[]]},{"id":"8f42bf2b.987a8","type":"ui_gauge","z":"72ca7ddb.f1fef4","name":"HumMeter","group":"ed5e1c9c.66396","order":1,"width":0,"height":0,"gtype":"gage","title":"Luchtvochtigheid","label":"%","format":"{{value}}","min":"20","max":"100","colors":["#0080ff","#0000ff","#0000a0"],"seg1":"40","seg2":"80","x":750,"y":360,"wires":[]},{"id":"29a8885c.b0a468","type":"ui_chart","z":"72ca7ddb.f1fef4","name":"BarChart","group":"81c9e14d.0b0e","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"950","ymax":"1080","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":740,"y":500,"wires":[[],[]]},{"id":"b8539fae.022d1","type":"ui_gauge","z":"72ca7ddb.f1fef4","name":"BarMeter","group":"81c9e14d.0b0e","order":1,"width":"5","height":"4","gtype":"gage","title":"Luchtdruk","label":"hPa","format":"{{value}}","min":"950","max":"1080","colors":["#0080ff","#0080ff","#0080ff"],"seg1":"","seg2":"","x":740,"y":460,"wires":[]},{"id":"dc972f2.7ce30d","type":"ui_chart","z":"72ca7ddb.f1fef4","name":"CO2Chart","group":"763642a9.9cd5fc","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"410","ymax":"5000","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":740,"y":600,"wires":[[],[]]},{"id":"2212dc2a.a66964","type":"ui_gauge","z":"72ca7ddb.f1fef4","name":"CO2Meter","group":"763642a9.9cd5fc","order":1,"width":"0","height":"0","gtype":"gage","title":"CO2","label":"PPM","format":"{{value}}","min":"410","max":"5000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"1000","seg2":"2500","x":750,"y":560,"wires":[]},{"id":"82ddd3da.7db21","type":"ui_text","z":"72ca7ddb.f1fef4","group":"763642a9.9cd5fc","order":5,"width":0,"height":0,"name":"Firmware","label":"Firmware:","format":"{{msg.payload}}","layout":"row-spread","x":740,"y":840,"wires":[]},{"id":"aa1a0305.03ba2","type":"ui_text","z":"72ca7ddb.f1fef4","group":"763642a9.9cd5fc","order":4,"width":0,"height":0,"name":"Model","label":"Model:","format":"{{msg.payload}}","layout":"row-spread","x":730,"y":800,"wires":[]},{"id":"7b7790ab.9c1e3","type":"ui_text","z":"72ca7ddb.f1fef4","group":"763642a9.9cd5fc","order":3,"width":0,"height":0,"name":"Hardware","label":"Hardware:","format":"{{msg.payload}}","layout":"row-spread","x":740,"y":760,"wires":[]},{"id":"3f6f89ca.9744d6","type":"ui_gauge","z":"72ca7ddb.f1fef4","name":"Temp BME280","group":"ed5e1c9c.66396","order":3,"width":0,"height":0,"gtype":"gage","title":"Temp BME280","label":"Graden C","format":"{{value}}","min":"5","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"15","seg2":"30","x":760,"y":160,"wires":[]},{"id":"fd4a3cd3.a7826","type":"ui_chart","z":"72ca7ddb.f1fef4","name":"Temp BME280 chart","group":"ed5e1c9c.66396","order":4,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"40","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":780,"y":200,"wires":[[],[]]},{"id":"cd157f85.13fde","type":"ui_gauge","z":"72ca7ddb.f1fef4","name":"Temp GEM","group":"fab0db25.fb55b8","order":1,"width":0,"height":0,"gtype":"gage","title":"Temp GEM","label":"Graden C","format":"{{value}}","min":"5","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"15","seg2":"30","x":750,"y":260,"wires":[]},{"id":"7a5a8d32.dbfb14","type":"ui_chart","z":"72ca7ddb.f1fef4","name":"Temp GEM chart","group":"fab0db25.fb55b8","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"40","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":770,"y":300,"wires":[[],[]]},{"id":"d62073dc.3188c","type":"ui_chart","z":"72ca7ddb.f1fef4","name":"LUXChart","group":"81c9e14d.0b0e","order":4,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"3000","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":740,"y":700,"wires":[[],[]]},{"id":"89f376c0.1fdeb8","type":"ui_gauge","z":"72ca7ddb.f1fef4","name":"LUXMeter","group":"81c9e14d.0b0e","order":3,"width":"0","height":"0","gtype":"gage","title":"Licht","label":"LUX","format":"{{value}}","min":"5","max":"3000","colors":["#d9d900","#ffff00","#ffff80"],"seg1":"","seg2":"","x":740,"y":660,"wires":[]},{"id":"fab0db25.fb55b8","type":"ui_group","z":"","name":"DATA","tab":"12acef78.d57cc1","disp":true,"width":"6","collapse":false},{"id":"5dffa21.0a6fe5c","type":"modbus-client","z":"","name":"UNIT 1","clienttype":"simpleser","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"2000","reconnectTimeout":"4000"},{"id":"ed5e1c9c.66396","type":"ui_group","z":"","name":"DATA","tab":"12acef78.d57cc1","order":2,"disp":true,"width":"6","collapse":false},{"id":"81c9e14d.0b0e","type":"ui_group","z":"","name":"DATA","tab":"12acef78.d57cc1","order":3,"disp":true,"width":"6","collapse":false},{"id":"763642a9.9cd5fc","type":"ui_group","z":"","name":"DATA","tab":"12acef78.d57cc1","order":4,"disp":true,"width":"6","collapse":false},{"id":"12acef78.d57cc1","type":"ui_tab","z":"","name":"MODBUS SENSOR TEST","icon":"dashboard"}] |
Multisensor HW v1.10 –Â Groter en slimmer voorbeeld
In dit voorbeeld de functie veel overzichtelijker gemaakt, tevens meerdere gegevens in 1 grafiek gezet.
Ik heb het idee opgedaan van deze pagina @ noderedguide.com
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 |
var temp1 = {}; temp1.payload = parseFloat(msg.payload[0] + "." + msg.payload[1]); temp1.topic = "Temp DS18B20"; var temp2 = {}; temp2.payload = parseFloat(msg.payload[2] + "." + msg.payload[3]); temp2.topic = "Temp BME280"; var temp3 = {}; temp3.payload = parseFloat(msg.payload[4] + "." + msg.payload[5]); temp3.topic = "Temp GEM"; var hum = {}; hum.payload = parseFloat(msg.payload[6] + "." + msg.payload[7]); var bar = {}; bar.payload = parseFloat(msg.payload[8] + "." + msg.payload[9]); var co2 = {}; co2.payload = parseFloat(msg.payload[10]); var lux = {}; lux.payload = parseFloat(msg.payload[11]); var hw = {}; hw.payload = msg.payload[15] + "." + msg.payload[16]; var mod = {}; mod.payload = msg.payload[17]; var fw = {}; fw.payload = msg.payload[18] + "." + msg.payload[19]; return [temp1,temp2,temp3,hum,bar,co2,lux,hw,mod,fw]; |
1 |
[{"id":"20b714f4.51ae2c","type":"function","z":"f760b16f.50ad7","name":"Array Parser Multisensor","func":"var temp1 = {};\ntemp1.payload = parseFloat(msg.payload[0] + \".\" + msg.payload[1]);\ntemp1.topic = \"Temp DS18B20\";\n\nvar temp2 = {};\ntemp2.payload = parseFloat(msg.payload[2] + \".\" + msg.payload[3]);\ntemp2.topic = \"Temp BME280\";\n\nvar temp3 = {};\ntemp3.payload = parseFloat(msg.payload[4] + \".\" + msg.payload[5]);\ntemp3.topic = \"Temp GEM\";\n\nvar hum = {};\nhum.payload = parseFloat(msg.payload[6] + \".\" + msg.payload[7]);\n\nvar bar = {};\nbar.payload = parseFloat(msg.payload[8] + \".\" + msg.payload[9]);\n\nvar co2 = {};\nco2.payload = parseFloat(msg.payload[10]);\n\nvar lux = {};\nlux.payload = parseFloat(msg.payload[11]);\n\nvar hw = {};\nhw.payload = msg.payload[15] + \".\" + msg.payload[16];\n\nvar mod = {};\nmod.payload = msg.payload[17];\n\nvar fw = {};\nfw.payload = msg.payload[18] + \".\" + msg.payload[19];\n\nreturn [temp1,temp2,temp3,hum,bar,co2,lux,hw,mod,fw];","outputs":10,"noerr":0,"x":550,"y":260,"wires":[["4bfe92eb.dff96c"],["4bfe92eb.dff96c"],["37fa1733.04dde8","4bfe92eb.dff96c"],["a19490bc.e687b","4373b001.21432"],["b85a06c2.05eda8","b54d72da.bef31"],["50e3c4a9.1dd9fc","762a08e5.620d48"],["67c257fb.f72d08","2adfacf3.79ac14"],["1471a221.419dde"],["f8f46cbd.2778d"],["edc0c9df.56f068"]],"inputLabels":["msg"],"outputLabels":["temp","","","","","","","","",""]},{"id":"a1b211b.92fa9f","type":"debug","z":"f760b16f.50ad7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":490,"y":160,"wires":[]},{"id":"4373b001.21432","type":"ui_chart","z":"f760b16f.50ad7","name":"HumChart","group":"a60442e7.44e31","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"20","ymax":"100","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":870,"y":220,"wires":[[],[]]},{"id":"a19490bc.e687b","type":"ui_gauge","z":"f760b16f.50ad7","name":"HumMeter","group":"a60442e7.44e31","order":1,"width":0,"height":0,"gtype":"gage","title":"Luchtvochtigheid","label":"%","format":"{{value}}","min":"20","max":"100","colors":["#0080ff","#0000ff","#0000a0"],"seg1":"40","seg2":"80","x":870,"y":180,"wires":[]},{"id":"b54d72da.bef31","type":"ui_chart","z":"f760b16f.50ad7","name":"BarChart","group":"fb562ea2.a0987","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"950","ymax":"1080","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":860,"y":320,"wires":[[],[]]},{"id":"b85a06c2.05eda8","type":"ui_gauge","z":"f760b16f.50ad7","name":"BarMeter","group":"fb562ea2.a0987","order":1,"width":"5","height":"4","gtype":"gage","title":"Luchtdruk","label":"hPa","format":"{{value}}","min":"950","max":"1080","colors":["#0080ff","#0080ff","#0080ff"],"seg1":"","seg2":"","x":860,"y":280,"wires":[]},{"id":"762a08e5.620d48","type":"ui_chart","z":"f760b16f.50ad7","name":"CO2Chart","group":"607d4ce1.6625f4","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"410","ymax":"5000","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":860,"y":420,"wires":[[],[]]},{"id":"50e3c4a9.1dd9fc","type":"ui_gauge","z":"f760b16f.50ad7","name":"CO2Meter","group":"607d4ce1.6625f4","order":1,"width":"0","height":"0","gtype":"gage","title":"CO2","label":"PPM","format":"{{value}}","min":"410","max":"5000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"1000","seg2":"2500","x":870,"y":380,"wires":[]},{"id":"edc0c9df.56f068","type":"ui_text","z":"f760b16f.50ad7","group":"607d4ce1.6625f4","order":5,"width":0,"height":0,"name":"Firmware","label":"Firmware:","format":"{{msg.payload}}","layout":"row-spread","x":860,"y":660,"wires":[]},{"id":"f8f46cbd.2778d","type":"ui_text","z":"f760b16f.50ad7","group":"607d4ce1.6625f4","order":4,"width":0,"height":0,"name":"Model","label":"Model:","format":"{{msg.payload}}","layout":"row-spread","x":850,"y":620,"wires":[]},{"id":"1471a221.419dde","type":"ui_text","z":"f760b16f.50ad7","group":"607d4ce1.6625f4","order":3,"width":0,"height":0,"name":"Hardware","label":"Hardware:","format":"{{msg.payload}}","layout":"row-spread","x":860,"y":580,"wires":[]},{"id":"2adfacf3.79ac14","type":"ui_chart","z":"f760b16f.50ad7","name":"LUXChart","group":"fb562ea2.a0987","order":4,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"3000","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":860,"y":520,"wires":[[],[]]},{"id":"67c257fb.f72d08","type":"ui_gauge","z":"f760b16f.50ad7","name":"LUXMeter","group":"fb562ea2.a0987","order":3,"width":"0","height":"0","gtype":"gage","title":"Licht","label":"LUX","format":"{{value}}","min":"5","max":"3000","colors":["#d9d900","#ffff00","#ffff80"],"seg1":"","seg2":"","x":860,"y":480,"wires":[]},{"id":"b173d518.eb61f8","type":"inject","z":"f760b16f.50ad7","name":"","topic":"","payload":"","payloadType":"date","repeat":"2","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":140,"wires":[["c4704249.f7309"]]},{"id":"c4704249.f7309","type":"function","z":"f760b16f.50ad7","name":"read multi sensor","func":"msg.payload = {\n 'fc': 3,\n 'unitid': 1,\n 'address': 0, \n 'quantity': 24\n};\nmsg.topic = \"multisensor\"\nreturn msg;","outputs":1,"noerr":0,"x":230,"y":200,"wires":[["a12f548c.e58898"]]},{"id":"a12f548c.e58898","type":"modbus-flex-getter","z":"f760b16f.50ad7","name":"Modbus reader","showStatusActivities":false,"showErrors":false,"server":"69b2e5f0.b4dc7c","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":220,"y":260,"wires":[["a1b211b.92fa9f","20b714f4.51ae2c"],[]]},{"id":"37fa1733.04dde8","type":"ui_gauge","z":"f760b16f.50ad7","name":"Temp GEM","group":"f656ad81.2aeb9","order":3,"width":0,"height":0,"gtype":"gage","title":"Temp GEM","label":"Graden C","format":"{{value}}","min":"5","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"15","seg2":"30","x":870,"y":80,"wires":[]},{"id":"4bfe92eb.dff96c","type":"ui_chart","z":"f760b16f.50ad7","name":"Temp DS18B20 chart","group":"f656ad81.2aeb9","order":4,"width":"6","height":"8","label":"","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"40","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#0080ff","#ff0000","#008000","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":900,"y":120,"wires":[[],[]]},{"id":"a60442e7.44e31","type":"ui_group","z":"","name":"DATA","tab":"b9335fa.71b5aa","order":2,"disp":true,"width":"6","collapse":false},{"id":"fb562ea2.a0987","type":"ui_group","z":"","name":"DATA","tab":"b9335fa.71b5aa","order":3,"disp":true,"width":"6","collapse":false},{"id":"607d4ce1.6625f4","type":"ui_group","z":"","name":"DATA","tab":"b9335fa.71b5aa","order":4,"disp":true,"width":"6","collapse":false},{"id":"69b2e5f0.b4dc7c","type":"modbus-client","z":"","name":"Serial_9600_8_N_1","clienttype":"serial","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"30","clientTimeout":"2000","reconnectTimeout":"5000"},{"id":"f656ad81.2aeb9","type":"ui_group","z":"","name":"DATA","tab":"b9335fa.71b5aa","order":1,"disp":true,"width":"6","collapse":false},{"id":"b9335fa.71b5aa","type":"ui_tab","z":"","name":"MODBUS SENSOR TEST","icon":"dashboard"}] |
Multisensor HW v1.20
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 |
var temp1 = {}; temp1.payload = parseFloat(msg.payload[0] + "." + msg.payload[1]); temp1.topic = "Temp DS18B20"; var temp2 = {}; temp2.payload = parseFloat(msg.payload[2] + "." + msg.payload[3]); temp2.topic = "Temp BME280"; var temp3 = {}; temp3.payload = parseFloat(msg.payload[4] + "." + msg.payload[5]); temp3.topic = "Temp GEM"; var hum = {}; hum.payload = parseFloat(msg.payload[6] + "." + msg.payload[7]); var bar = {}; bar.payload = parseFloat(msg.payload[8] + "." + msg.payload[9]); var co2 = {}; co2.payload = parseFloat(msg.payload[10]); var lux = {}; lux.payload = parseFloat(msg.payload[11]); var pir = {}; pir.payload = parseFloat(msg.payload[12]); var alarmtemp = {}; alarmtemp.payload = parseFloat(msg.payload[13]); var alarmco2 = {}; alarmco2.payload = parseFloat(msg.payload[14]); var buzzertrig = {}; buzzertrig.payload = parseFloat(msg.payload[15]); var gpiouit1 = {}; gpiouit1.payload = parseFloat(msg.payload[16]); var gpiouit2 = {}; gpiouit2.payload = parseFloat(msg.payload[17]); var gpioin1 = {}; gpioin1.payload = parseFloat(msg.payload[18]); var gpioin2 = {}; gpioin2.payload = parseFloat(msg.payload[19]); var hw = {}; hw.payload = msg.payload[30] + "." + msg.payload[31]; var mod = {}; mod.payload = msg.payload[32]; var fw = {}; fw.payload = msg.payload[33] + "." + msg.payload[34]; return [temp1,temp2,temp3,hum,bar,co2,lux,pir,alarmtemp,alarmco2,buzzertrig,gpiouit1,gpiouit2,gpioin1,gpioin2,hw,mod,fw]; |
1 |
[{"id":"20b714f4.51ae2c","type":"function","z":"f760b16f.50ad7","name":"Array Parser Multisensor","func":"var temp1 = {};\ntemp1.payload = parseFloat(msg.payload[0] + \".\" + msg.payload[1]);\ntemp1.topic = \"Temp DS18B20\";\n\nvar temp2 = {};\ntemp2.payload = parseFloat(msg.payload[2] + \".\" + msg.payload[3]);\ntemp2.topic = \"Temp BME280\";\n\nvar temp3 = {};\ntemp3.payload = parseFloat(msg.payload[4] + \".\" + msg.payload[5]);\ntemp3.topic = \"Temp GEM\";\n\nvar hum = {};\nhum.payload = parseFloat(msg.payload[6] + \".\" + msg.payload[7]);\n\nvar bar = {};\nbar.payload = parseFloat(msg.payload[8] + \".\" + msg.payload[9]);\n\nvar co2 = {};\nco2.payload = parseFloat(msg.payload[10]);\n\nvar lux = {};\nlux.payload = parseFloat(msg.payload[11]);\n\nvar pir = {};\npir.payload = parseFloat(msg.payload[12]);\n\nvar alarmtemp = {};\nalarmtemp.payload = parseFloat(msg.payload[13]);\n\nvar alarmco2 = {};\nalarmco2.payload = parseFloat(msg.payload[14]);\n\nvar buzzertrig = {};\nbuzzertrig.payload = parseFloat(msg.payload[15]);\n\nvar gpiouit1 = {};\ngpiouit1.payload = parseFloat(msg.payload[16]);\n\nvar gpiouit2 = {};\ngpiouit2.payload = parseFloat(msg.payload[17]);\n\nvar gpioin1 = {};\ngpioin1.payload = parseFloat(msg.payload[18]);\n\nvar gpioin2 = {};\ngpioin2.payload = parseFloat(msg.payload[19]);\n\nvar hw = {};\nhw.payload = msg.payload[30] + \".\" + msg.payload[31];\n\nvar mod = {};\nmod.payload = msg.payload[32];\n\nvar fw = {};\nfw.payload = msg.payload[33] + \".\" + msg.payload[34];\n\nreturn [temp1,temp2,temp3,hum,bar,co2,lux,pir,alarmtemp,alarmco2,buzzertrig,gpiouit1,gpiouit2,gpioin1,gpioin2,hw,mod,fw];","outputs":18,"noerr":0,"x":870,"y":480,"wires":[["4bfe92eb.dff96c"],["4bfe92eb.dff96c"],["37fa1733.04dde8","4bfe92eb.dff96c"],["a19490bc.e687b","4373b001.21432"],["b85a06c2.05eda8","b54d72da.bef31"],["50e3c4a9.1dd9fc","762a08e5.620d48"],["67c257fb.f72d08","2adfacf3.79ac14"],["d12bbbea.5fb7b8"],["df771d93.ac6a5"],["e4c8c8ce.803fc8"],["74b0af8a.378ec"],["c4426d6.2882e9"],["42506ec7.055a"],["abdcfb6.3066908"],["11a441a9.40d02e"],["1471a221.419dde"],["f8f46cbd.2778d"],["edc0c9df.56f068"]],"inputLabels":["msg"],"outputLabels":["temp","","","","","","","","","","","","","","","","",""]},{"id":"a1b211b.92fa9f","type":"debug","z":"f760b16f.50ad7","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":510,"y":320,"wires":[]},{"id":"4373b001.21432","type":"ui_chart","z":"f760b16f.50ad7","name":"HumChart","group":"a60442e7.44e31","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"20","ymax":"100","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1230,"y":220,"wires":[[],[]]},{"id":"a19490bc.e687b","type":"ui_gauge","z":"f760b16f.50ad7","name":"HumMeter","group":"a60442e7.44e31","order":1,"width":0,"height":0,"gtype":"gage","title":"Luchtvochtigheid","label":"%","format":"{{value}}","min":"20","max":"100","colors":["#0080ff","#0000ff","#0000a0"],"seg1":"40","seg2":"80","x":1230,"y":180,"wires":[]},{"id":"b54d72da.bef31","type":"ui_chart","z":"f760b16f.50ad7","name":"BarChart","group":"fb562ea2.a0987","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"950","ymax":"1080","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1220,"y":320,"wires":[[],[]]},{"id":"b85a06c2.05eda8","type":"ui_gauge","z":"f760b16f.50ad7","name":"BarMeter","group":"fb562ea2.a0987","order":1,"width":"5","height":"4","gtype":"gage","title":"Luchtdruk","label":"hPa","format":"{{value}}","min":"950","max":"1080","colors":["#0080ff","#0080ff","#0080ff"],"seg1":"","seg2":"","x":1220,"y":280,"wires":[]},{"id":"762a08e5.620d48","type":"ui_chart","z":"f760b16f.50ad7","name":"CO2Chart","group":"607d4ce1.6625f4","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"410","ymax":"5000","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1220,"y":420,"wires":[[],[]]},{"id":"50e3c4a9.1dd9fc","type":"ui_gauge","z":"f760b16f.50ad7","name":"CO2Meter","group":"607d4ce1.6625f4","order":1,"width":"0","height":"0","gtype":"gage","title":"CO2","label":"PPM","format":"{{value}}","min":"410","max":"5000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"1000","seg2":"2500","x":1230,"y":380,"wires":[]},{"id":"edc0c9df.56f068","type":"ui_text","z":"f760b16f.50ad7","group":"607d4ce1.6625f4","order":5,"width":0,"height":0,"name":"Firmware","label":"Firmware:","format":"{{msg.payload}}","layout":"row-spread","x":1220,"y":1020,"wires":[]},{"id":"f8f46cbd.2778d","type":"ui_text","z":"f760b16f.50ad7","group":"607d4ce1.6625f4","order":4,"width":0,"height":0,"name":"Model","label":"Model:","format":"{{msg.payload}}","layout":"row-spread","x":1210,"y":980,"wires":[]},{"id":"1471a221.419dde","type":"ui_text","z":"f760b16f.50ad7","group":"607d4ce1.6625f4","order":3,"width":0,"height":0,"name":"Hardware","label":"Hardware:","format":"{{msg.payload}}","layout":"row-spread","x":1220,"y":940,"wires":[]},{"id":"2adfacf3.79ac14","type":"ui_chart","z":"f760b16f.50ad7","name":"LUXChart","group":"fb562ea2.a0987","order":4,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"3000","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1220,"y":520,"wires":[[],[]]},{"id":"67c257fb.f72d08","type":"ui_gauge","z":"f760b16f.50ad7","name":"LUXMeter","group":"fb562ea2.a0987","order":3,"width":"0","height":"0","gtype":"gage","title":"Licht","label":"LUX","format":"{{value}}","min":"5","max":"3000","colors":["#d9d900","#ffff00","#ffff80"],"seg1":"","seg2":"","x":1220,"y":480,"wires":[]},{"id":"b173d518.eb61f8","type":"inject","z":"f760b16f.50ad7","name":"READOUT INTERVAL","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":280,"wires":[["c4704249.f7309"]]},{"id":"c4704249.f7309","type":"function","z":"f760b16f.50ad7","name":"read multi sensor","func":"msg.payload = {\n 'fc': 3,\n 'unitid': 1,\n 'address': 0, \n 'quantity': 40\n};\nmsg.topic = \"multisensor\"\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":320,"wires":[["a12f548c.e58898"]]},{"id":"a12f548c.e58898","type":"modbus-flex-getter","z":"f760b16f.50ad7","name":"Modbus reader","showStatusActivities":true,"showErrors":true,"server":"69b2e5f0.b4dc7c","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":320,"y":360,"wires":[["a1b211b.92fa9f","20b714f4.51ae2c","562d281b.6d6c18"],[]]},{"id":"37fa1733.04dde8","type":"ui_gauge","z":"f760b16f.50ad7","name":"Temp GEM","group":"f656ad81.2aeb9","order":1,"width":0,"height":0,"gtype":"gage","title":"Temp GEM","label":"Graden C","format":"{{value}}","min":"5","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"15","seg2":"30","x":1230,"y":80,"wires":[]},{"id":"4bfe92eb.dff96c","type":"ui_chart","z":"f760b16f.50ad7","name":"Temp DS18B20 chart","group":"f656ad81.2aeb9","order":2,"width":"6","height":"8","label":"","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"40","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#0080ff","#ff0000","#008000","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1260,"y":120,"wires":[[],[]]},{"id":"d12bbbea.5fb7b8","type":"ui_chart","z":"f760b16f.50ad7","name":"PIRChart","group":"a60442e7.44e31","order":3,"width":0,"height":0,"label":"PIR","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"1","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1220,"y":560,"wires":[[],[]]},{"id":"1d2ae422.2e258c","type":"function","z":"f760b16f.50ad7","name":"write multi sensor","func":"msg.payload = {\n 'value': 1,\n 'fc': 6,\n 'unitid': 1,\n 'address': 15, \n 'quantity': 1\n};\nmsg.topic = \"multisensor\"\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":160,"wires":[["d8657e86.878c4"]]},{"id":"d8657e86.878c4","type":"modbus-flex-write","z":"f760b16f.50ad7","name":"","showStatusActivities":false,"showErrors":false,"server":"69b2e5f0.b4dc7c","x":750,"y":180,"wires":[[],[]]},{"id":"562d281b.6d6c18","type":"modbus-response","z":"f760b16f.50ad7","name":"","registerShowMax":"40","x":510,"y":620,"wires":[]},{"id":"74b0af8a.378ec","type":"ui_text","z":"f760b16f.50ad7","group":"a60442e7.44e31","order":6,"width":0,"height":0,"name":"Buzzer Trigger","label":"Buzzer Trigger:","format":"{{msg.payload}}","layout":"row-spread","x":1240,"y":700,"wires":[]},{"id":"e7cf4bdd.d74f98","type":"inject","z":"f760b16f.50ad7","name":"ALARM AAN","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":160,"wires":[["1d2ae422.2e258c"]]},{"id":"b48a5bd7.f72e68","type":"function","z":"f760b16f.50ad7","name":"write multi sensor","func":"msg.payload = {\n 'fc': 6,\n 'unitid': 1,\n 'address': 15, \n 'quantity': 1,\n 'value': 0\n};\nmsg.topic = \"multisensor\"\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":200,"wires":[["d8657e86.878c4"]]},{"id":"899d6bab.34f058","type":"inject","z":"f760b16f.50ad7","name":"ALARM UIT","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":200,"wires":[["b48a5bd7.f72e68"]]},{"id":"e4c8c8ce.803fc8","type":"ui_text","z":"f760b16f.50ad7","group":"a60442e7.44e31","order":5,"width":0,"height":0,"name":"ALARM CO2:","label":"ALARM CO2:","format":"{{msg.payload}}","layout":"row-spread","x":1240,"y":660,"wires":[]},{"id":"df771d93.ac6a5","type":"ui_text","z":"f760b16f.50ad7","group":"a60442e7.44e31","order":4,"width":0,"height":0,"name":"ALARM Temp","label":"ALARM Temp:","format":"{{msg.payload}}","layout":"row-spread","x":1240,"y":620,"wires":[]},{"id":"c4426d6.2882e9","type":"ui_text","z":"f760b16f.50ad7","group":"f656ad81.2aeb9","order":3,"width":0,"height":0,"name":"GPIO UIT 1","label":"GPIO UIT 1:","format":"{{msg.payload}}","layout":"row-spread","x":1230,"y":760,"wires":[]},{"id":"42506ec7.055a","type":"ui_text","z":"f760b16f.50ad7","group":"f656ad81.2aeb9","order":4,"width":0,"height":0,"name":"GPIO UIT 2","label":"GPIO UIT 2:","format":"{{msg.payload}}","layout":"row-spread","x":1230,"y":800,"wires":[]},{"id":"abdcfb6.3066908","type":"ui_text","z":"f760b16f.50ad7","group":"f656ad81.2aeb9","order":6,"width":0,"height":0,"name":"GPIO IN 1","label":"GPIO IN 1:","format":"{{msg.payload}}","layout":"row-spread","x":1230,"y":840,"wires":[]},{"id":"11a441a9.40d02e","type":"ui_text","z":"f760b16f.50ad7","group":"f656ad81.2aeb9","order":6,"width":0,"height":0,"name":"GPIO IN 2","label":"GPIO IN 2:","format":"{{msg.payload}}","layout":"row-spread","x":1230,"y":880,"wires":[]},{"id":"a60442e7.44e31","type":"ui_group","z":"","name":"DATA","tab":"b9335fa.71b5aa","order":2,"disp":true,"width":"6","collapse":false},{"id":"fb562ea2.a0987","type":"ui_group","z":"","name":"DATA","tab":"b9335fa.71b5aa","order":3,"disp":true,"width":"6","collapse":false},{"id":"607d4ce1.6625f4","type":"ui_group","z":"","name":"DATA","tab":"b9335fa.71b5aa","order":4,"disp":true,"width":"6","collapse":false},{"id":"69b2e5f0.b4dc7c","type":"modbus-client","z":"","name":"Serial_9600_8_N_1","clienttype":"serial","bufferCommands":true,"stateLogEnabled":true,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"100","clientTimeout":"4000","reconnectTimeout":"2000"},{"id":"f656ad81.2aeb9","type":"ui_group","z":"","name":"DATA","tab":"b9335fa.71b5aa","order":1,"disp":true,"width":"6","collapse":false},{"id":"b9335fa.71b5aa","type":"ui_tab","z":"","name":"MODBUS SENSOR TEST","icon":"dashboard"}] |