Created
April 9, 2024 15:53
-
-
Save hj91/aebb39fb2787afedd03d6407dfe460a2 to your computer and use it in GitHub Desktop.
A flow to visualize historic and live data obtained from MQTT broker and stored in InfluxDB. We will be using @flowfuse/node-red-contrib-dashboard and node-red-contrib-influxdb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": "dc1c7f4e5ddc86f8", | |
| "type": "tab", | |
| "label": "MING", | |
| "disabled": false, | |
| "info": "", | |
| "env": [] | |
| }, | |
| { | |
| "id": "1423665d39048eba", | |
| "type": "mqtt in", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "", | |
| "topic": "flowfuse/temp", | |
| "qos": "2", | |
| "datatype": "auto-detect", | |
| "broker": "e8ea838e83035408", | |
| "nl": false, | |
| "rap": true, | |
| "rh": 0, | |
| "inputs": 0, | |
| "x": 190, | |
| "y": 160, | |
| "wires": [ | |
| [ | |
| "7ddcaadd5c43f11d", | |
| "c359b55bc77165c2" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "993651c073e7659c", | |
| "type": "mqtt in", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "", | |
| "topic": "flowfuse/RH", | |
| "qos": "2", | |
| "datatype": "auto-detect", | |
| "broker": "e8ea838e83035408", | |
| "nl": false, | |
| "rap": true, | |
| "rh": 0, | |
| "inputs": 0, | |
| "x": 190, | |
| "y": 220, | |
| "wires": [ | |
| [ | |
| "01f4e507e7deaaea", | |
| "33e5c2e4a61d01e3" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "7ddcaadd5c43f11d", | |
| "type": "change", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Temp", | |
| "rules": [ | |
| { | |
| "t": "set", | |
| "p": "topic", | |
| "pt": "msg", | |
| "to": "temp", | |
| "tot": "str" | |
| } | |
| ], | |
| "action": "", | |
| "property": "", | |
| "from": "", | |
| "to": "", | |
| "reg": false, | |
| "x": 350, | |
| "y": 160, | |
| "wires": [ | |
| [ | |
| "f39435df2b4db94f" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "01f4e507e7deaaea", | |
| "type": "change", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "RH", | |
| "rules": [ | |
| { | |
| "t": "set", | |
| "p": "topic", | |
| "pt": "msg", | |
| "to": "RH", | |
| "tot": "str" | |
| } | |
| ], | |
| "action": "", | |
| "property": "", | |
| "from": "", | |
| "to": "", | |
| "reg": false, | |
| "x": 350, | |
| "y": 220, | |
| "wires": [ | |
| [ | |
| "f39435df2b4db94f" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "f39435df2b4db94f", | |
| "type": "join", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "", | |
| "mode": "custom", | |
| "build": "object", | |
| "property": "payload", | |
| "propertyType": "msg", | |
| "key": "topic", | |
| "joiner": "\\n", | |
| "joinerType": "str", | |
| "accumulate": false, | |
| "timeout": "", | |
| "count": "2", | |
| "reduceRight": false, | |
| "reduceExp": "", | |
| "reduceInit": "", | |
| "reduceInitType": "", | |
| "reduceFixup": "", | |
| "x": 550, | |
| "y": 180, | |
| "wires": [ | |
| [ | |
| "fa067011fa3f705f", | |
| "c9d37220d787ac92", | |
| "681b2e5009ec5e1e" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "fa067011fa3f705f", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Send it to InfluxDB", | |
| "func": "var temp = Number(msg.payload.temp);\nvar RH = Number(msg.payload.RH);\n\nmsg.measurement = \"room1\";\nmsg.payload = {Temperature:temp,RH:RH};\n\nreturn msg;", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 770, | |
| "y": 180, | |
| "wires": [ | |
| [ | |
| "0e86e1bd4bf8b9f6" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "0e86e1bd4bf8b9f6", | |
| "type": "influxdb out", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "influxdb": "cb09abcd8b693ca8", | |
| "name": "", | |
| "measurement": "", | |
| "precision": "", | |
| "retentionPolicy": "", | |
| "database": "database", | |
| "precisionV18FluxV20": "ms", | |
| "retentionPolicyV18Flux": "", | |
| "org": "organisation", | |
| "bucket": "bucket", | |
| "x": 1080, | |
| "y": 180, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "c359b55bc77165c2", | |
| "type": "ui-text", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "11df00492fb20acd", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "name": "", | |
| "label": "Temperature", | |
| "format": "{{msg.payload}}", | |
| "layout": "row-spread", | |
| "style": true, | |
| "font": "Verdana,Verdana,Geneva,sans-serif", | |
| "fontSize": 16, | |
| "color": "#717171", | |
| "className": "", | |
| "x": 530, | |
| "y": 100, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "33e5c2e4a61d01e3", | |
| "type": "ui-text", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "11df00492fb20acd", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "name": "", | |
| "label": "RH", | |
| "format": "{{msg.payload}}", | |
| "layout": "row-spread", | |
| "style": true, | |
| "font": "Verdana,Verdana,Geneva,sans-serif", | |
| "fontSize": 16, | |
| "color": "#717171", | |
| "className": "", | |
| "x": 510, | |
| "y": 280, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "c9d37220d787ac92", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Temp", | |
| "func": "var temp = Number(msg.payload.temp);\n\nmsg.payload = temp;\n\nreturn msg;", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 730, | |
| "y": 120, | |
| "wires": [ | |
| [ | |
| "432850955a867e1e", | |
| "28d0b846fd2a48ab" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "681b2e5009ec5e1e", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "RH", | |
| "func": "var RH = Number(msg.payload.RH);\nmsg.payload = RH;\n\nreturn msg;", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 730, | |
| "y": 240, | |
| "wires": [ | |
| [ | |
| "a41e65a351476137", | |
| "80b1312f88e4f656" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "432850955a867e1e", | |
| "type": "ui-chart", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "aa70ec0abc058d78", | |
| "name": "", | |
| "label": "Live Temperature ", | |
| "order": 9007199254740991, | |
| "chartType": "line", | |
| "category": "Temperature", | |
| "categoryType": "str", | |
| "xAxisProperty": "", | |
| "xAxisPropertyType": "msg", | |
| "xAxisType": "time", | |
| "yAxisProperty": "", | |
| "ymin": "0", | |
| "ymax": "50", | |
| "action": "append", | |
| "pointShape": "line", | |
| "pointRadius": 4, | |
| "showLegend": true, | |
| "removeOlder": 1, | |
| "removeOlderUnit": "3600", | |
| "removeOlderPoints": "", | |
| "colors": [ | |
| "#1f77b4", | |
| "#aec7e8", | |
| "#ff7f0e", | |
| "#2ca02c", | |
| "#98df8a", | |
| "#d62728", | |
| "#ff9896", | |
| "#9467bd", | |
| "#c5b0d5" | |
| ], | |
| "width": "6", | |
| "height": "8", | |
| "className": "", | |
| "x": 950, | |
| "y": 120, | |
| "wires": [ | |
| [] | |
| ] | |
| }, | |
| { | |
| "id": "a41e65a351476137", | |
| "type": "ui-chart", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "aa70ec0abc058d78", | |
| "name": "", | |
| "label": "Live RH", | |
| "order": 9007199254740991, | |
| "chartType": "line", | |
| "category": "RH", | |
| "categoryType": "str", | |
| "xAxisProperty": "", | |
| "xAxisPropertyType": "msg", | |
| "xAxisType": "time", | |
| "yAxisProperty": "", | |
| "ymin": "0", | |
| "ymax": "100", | |
| "action": "append", | |
| "pointShape": "line", | |
| "pointRadius": 4, | |
| "showLegend": true, | |
| "removeOlder": 1, | |
| "removeOlderUnit": "3600", | |
| "removeOlderPoints": "", | |
| "colors": [ | |
| "#1f77b4", | |
| "#aec7e8", | |
| "#ff7f0e", | |
| "#2ca02c", | |
| "#98df8a", | |
| "#d62728", | |
| "#ff9896", | |
| "#9467bd", | |
| "#c5b0d5" | |
| ], | |
| "width": "6", | |
| "height": "8", | |
| "className": "", | |
| "x": 940, | |
| "y": 240, | |
| "wires": [ | |
| [] | |
| ] | |
| }, | |
| { | |
| "id": "87ebfee665b784ee", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Min", | |
| "func": "// Construct the query using the provided start and stop timestamps\nmsg.query = `SELECT min(Temperature) FROM room1`;\n\n// Pass the modified message object to the next node\nreturn msg;\n", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 450, | |
| "y": 500, | |
| "wires": [ | |
| [ | |
| "7d727f5a7723a73d" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "7d727f5a7723a73d", | |
| "type": "influxdb in", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "influxdb": "cb09abcd8b693ca8", | |
| "name": "Read Temp", | |
| "query": "", | |
| "rawOutput": false, | |
| "precision": "", | |
| "retentionPolicy": "", | |
| "org": "organisation", | |
| "x": 610, | |
| "y": 540, | |
| "wires": [ | |
| [ | |
| "fe9230e31884d82b" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "1da5df166734acac", | |
| "type": "switch", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Temp", | |
| "property": "payload", | |
| "propertyType": "msg", | |
| "rules": [ | |
| { | |
| "t": "eq", | |
| "v": "Min", | |
| "vt": "str" | |
| }, | |
| { | |
| "t": "eq", | |
| "v": "Max", | |
| "vt": "str" | |
| }, | |
| { | |
| "t": "eq", | |
| "v": "Total", | |
| "vt": "str" | |
| } | |
| ], | |
| "checkall": "true", | |
| "repair": false, | |
| "outputs": 3, | |
| "x": 310, | |
| "y": 540, | |
| "wires": [ | |
| [ | |
| "87ebfee665b784ee" | |
| ], | |
| [ | |
| "1322af95dd29b8c3" | |
| ], | |
| [ | |
| "717e1a07222ec348" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "1322af95dd29b8c3", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Max", | |
| "func": "// Construct the query using the provided start and stop timestamps\nmsg.query = `SELECT max(Temperature) FROM room1`;\n\n// Pass the modified message object to the next node\nreturn msg;\n", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 450, | |
| "y": 540, | |
| "wires": [ | |
| [ | |
| "7d727f5a7723a73d" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "88e2e00b4e5f5fd6", | |
| "type": "ui-dropdown", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "f02746ad7e1ab68c", | |
| "name": "", | |
| "label": "Select Option:", | |
| "tooltip": "", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "passthru": false, | |
| "multiple": false, | |
| "options": [ | |
| { | |
| "label": "Min", | |
| "value": "Min", | |
| "type": "str" | |
| }, | |
| { | |
| "label": "Max", | |
| "value": "Max", | |
| "type": "str" | |
| }, | |
| { | |
| "label": "Total", | |
| "value": "Total", | |
| "type": "str" | |
| } | |
| ], | |
| "payload": "", | |
| "topic": "topic", | |
| "topicType": "msg", | |
| "className": "", | |
| "x": 160, | |
| "y": 540, | |
| "wires": [ | |
| [ | |
| "1da5df166734acac" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "57a7757bf943bce5", | |
| "type": "ui-text", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "f02746ad7e1ab68c", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "name": "", | |
| "label": "Temp Stats", | |
| "format": "{{msg.payload}}", | |
| "layout": "row-spread", | |
| "style": true, | |
| "font": "Verdana,Verdana,Geneva,sans-serif", | |
| "fontSize": 16, | |
| "color": "#717171", | |
| "className": "", | |
| "x": 1290, | |
| "y": 540, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "cac36785f12f3bf5", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Min", | |
| "func": "var min = msg.payload[0].min\nmsg.payload = \"Minimum is \" + min;\nreturn (msg)", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 1090, | |
| "y": 500, | |
| "wires": [ | |
| [ | |
| "57a7757bf943bce5" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "fc6330b5fcc33acc", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Max", | |
| "func": "var avg = msg.payload[0].max;\nmsg.payload = \"Max is \" + avg;\nreturn msg;", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 1090, | |
| "y": 540, | |
| "wires": [ | |
| [ | |
| "57a7757bf943bce5" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "6453914fa7bdd751", | |
| "type": "switch", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Temp", | |
| "property": "payload[0]", | |
| "propertyType": "msg", | |
| "rules": [ | |
| { | |
| "t": "hask", | |
| "v": "min", | |
| "vt": "str" | |
| }, | |
| { | |
| "t": "hask", | |
| "v": "max", | |
| "vt": "str" | |
| }, | |
| { | |
| "t": "hask", | |
| "v": "count", | |
| "vt": "str" | |
| } | |
| ], | |
| "checkall": "true", | |
| "repair": false, | |
| "outputs": 3, | |
| "x": 950, | |
| "y": 540, | |
| "wires": [ | |
| [ | |
| "cac36785f12f3bf5" | |
| ], | |
| [ | |
| "fc6330b5fcc33acc" | |
| ], | |
| [ | |
| "d29294d236bef25c" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "717e1a07222ec348", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Count", | |
| "func": "// Construct the query using the provided start and stop timestamps\nmsg.query = `SELECT count(Temperature) FROM room1`;\n\n// Pass the modified message object to the next node\nreturn msg;\n", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 450, | |
| "y": 580, | |
| "wires": [ | |
| [ | |
| "7d727f5a7723a73d" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "d29294d236bef25c", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Count", | |
| "func": "var count = msg.payload[0].count;\nmsg.payload = \"Total Record is \" + count;\nreturn msg;", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 1090, | |
| "y": 580, | |
| "wires": [ | |
| [ | |
| "57a7757bf943bce5" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "e7465ddb4fd72e6a", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Min", | |
| "func": "// Construct the query using the provided start and stop timestamps\nmsg.query = `SELECT min(RH) FROM room1`;\n\n// Pass the modified message object to the next node\nreturn msg;\n", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 450, | |
| "y": 620, | |
| "wires": [ | |
| [ | |
| "db0873d1bbef089a" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "db0873d1bbef089a", | |
| "type": "influxdb in", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "influxdb": "cb09abcd8b693ca8", | |
| "name": "Read RH", | |
| "query": "", | |
| "rawOutput": false, | |
| "precision": "", | |
| "retentionPolicy": "", | |
| "org": "organisation", | |
| "x": 600, | |
| "y": 660, | |
| "wires": [ | |
| [ | |
| "f14e43cc318fa92b" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "a27e50703cb15e38", | |
| "type": "switch", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "RH", | |
| "property": "payload", | |
| "propertyType": "msg", | |
| "rules": [ | |
| { | |
| "t": "eq", | |
| "v": "Min", | |
| "vt": "str" | |
| }, | |
| { | |
| "t": "eq", | |
| "v": "Max", | |
| "vt": "str" | |
| }, | |
| { | |
| "t": "eq", | |
| "v": "Total", | |
| "vt": "str" | |
| } | |
| ], | |
| "checkall": "true", | |
| "repair": false, | |
| "outputs": 3, | |
| "x": 310, | |
| "y": 660, | |
| "wires": [ | |
| [ | |
| "e7465ddb4fd72e6a" | |
| ], | |
| [ | |
| "0e8acb8b65e368f6" | |
| ], | |
| [ | |
| "7402a7eec1245643" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "0e8acb8b65e368f6", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Max", | |
| "func": "// Construct the query using the provided start and stop timestamps\nmsg.query = `SELECT max(RH) FROM room1`;\n\n// Pass the modified message object to the next node\nreturn msg;\n", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 450, | |
| "y": 660, | |
| "wires": [ | |
| [ | |
| "db0873d1bbef089a" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "a36dafb79f2fce75", | |
| "type": "ui-dropdown", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "f02746ad7e1ab68c", | |
| "name": "", | |
| "label": "Select Option:", | |
| "tooltip": "", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "passthru": false, | |
| "multiple": false, | |
| "options": [ | |
| { | |
| "label": "Min", | |
| "value": "Min", | |
| "type": "str" | |
| }, | |
| { | |
| "label": "Max", | |
| "value": "Max", | |
| "type": "str" | |
| }, | |
| { | |
| "label": "Total", | |
| "value": "Total", | |
| "type": "str" | |
| } | |
| ], | |
| "payload": "", | |
| "topic": "topic", | |
| "topicType": "msg", | |
| "className": "", | |
| "x": 160, | |
| "y": 660, | |
| "wires": [ | |
| [ | |
| "a27e50703cb15e38" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "4800381c4950d245", | |
| "type": "ui-text", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "f02746ad7e1ab68c", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "name": "", | |
| "label": "RH Stats", | |
| "format": "{{msg.payload}}", | |
| "layout": "row-spread", | |
| "style": true, | |
| "font": "Verdana,Verdana,Geneva,sans-serif", | |
| "fontSize": 16, | |
| "color": "#717171", | |
| "className": "", | |
| "x": 1280, | |
| "y": 660, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "4af1d2b0abf0009f", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Min", | |
| "func": "var min = msg.payload[0].min\nmsg.payload = \"Minimum is \" + min;\nreturn (msg)", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 1090, | |
| "y": 620, | |
| "wires": [ | |
| [ | |
| "4800381c4950d245" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "cfc4f16f835d3724", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Max", | |
| "func": "var avg = msg.payload[0].max;\nmsg.payload = \"Max is \" + avg;\nreturn msg;", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 1090, | |
| "y": 660, | |
| "wires": [ | |
| [ | |
| "4800381c4950d245" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "49ac1cdfe4289eac", | |
| "type": "switch", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "RH", | |
| "property": "payload[0]", | |
| "propertyType": "msg", | |
| "rules": [ | |
| { | |
| "t": "hask", | |
| "v": "min", | |
| "vt": "str" | |
| }, | |
| { | |
| "t": "hask", | |
| "v": "max", | |
| "vt": "str" | |
| }, | |
| { | |
| "t": "hask", | |
| "v": "count", | |
| "vt": "str" | |
| } | |
| ], | |
| "checkall": "true", | |
| "repair": false, | |
| "outputs": 3, | |
| "x": 950, | |
| "y": 660, | |
| "wires": [ | |
| [ | |
| "4af1d2b0abf0009f" | |
| ], | |
| [ | |
| "cfc4f16f835d3724" | |
| ], | |
| [ | |
| "57b2d15bae6a4d42" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "7402a7eec1245643", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Count", | |
| "func": "// Construct the query using the provided start and stop timestamps\nmsg.query = `SELECT count(RH) FROM room1`;\n\n// Pass the modified message object to the next node\nreturn msg;\n", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 450, | |
| "y": 700, | |
| "wires": [ | |
| [ | |
| "db0873d1bbef089a" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "57b2d15bae6a4d42", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Count", | |
| "func": "var count = msg.payload[0].count;\nmsg.payload = \"Total Record is \" + count;\nreturn msg;", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 1090, | |
| "y": 700, | |
| "wires": [ | |
| [ | |
| "4800381c4950d245" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "fb1cbe8ec45b5de7", | |
| "type": "comment", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Write Operation", | |
| "info": "", | |
| "x": 100, | |
| "y": 80, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "931c16333d3efcad", | |
| "type": "comment", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Read Operation", | |
| "info": "", | |
| "x": 180, | |
| "y": 340, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "f200e4be2158481e", | |
| "type": "comment", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Read Operation", | |
| "info": "", | |
| "x": 180, | |
| "y": 480, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "80b1312f88e4f656", | |
| "type": "ui-gauge", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Live RH", | |
| "group": "f02746ad7e1ab68c", | |
| "order": 0, | |
| "width": "0", | |
| "height": "0", | |
| "gtype": "gauge-34", | |
| "gstyle": "rounded", | |
| "title": "Live RH", | |
| "units": "%", | |
| "icon": "", | |
| "prefix": "", | |
| "suffix": "", | |
| "segments": [ | |
| { | |
| "from": "0", | |
| "color": "#5cd65c" | |
| }, | |
| { | |
| "from": "40", | |
| "color": "#ffc800" | |
| }, | |
| { | |
| "from": "70", | |
| "color": "#ea5353" | |
| } | |
| ], | |
| "min": 0, | |
| "max": "100", | |
| "sizeThickness": 16, | |
| "sizeGap": 4, | |
| "sizeKeyThickness": 8, | |
| "styleRounded": true, | |
| "styleGlow": false, | |
| "className": "", | |
| "x": 940, | |
| "y": 280, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "28d0b846fd2a48ab", | |
| "type": "ui-gauge", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Live Temperature", | |
| "group": "f02746ad7e1ab68c", | |
| "order": 0, | |
| "width": "0", | |
| "height": "0", | |
| "gtype": "gauge-34", | |
| "gstyle": "rounded", | |
| "title": "Temperature", | |
| "units": "Degrees C", | |
| "icon": "", | |
| "prefix": "", | |
| "suffix": "", | |
| "segments": [ | |
| { | |
| "from": "0", | |
| "color": "#5cd65c" | |
| }, | |
| { | |
| "from": "30", | |
| "color": "#ffc800" | |
| }, | |
| { | |
| "from": "40", | |
| "color": "#ea5353" | |
| } | |
| ], | |
| "min": 0, | |
| "max": "50", | |
| "sizeThickness": 16, | |
| "sizeGap": 4, | |
| "sizeKeyThickness": 8, | |
| "styleRounded": true, | |
| "styleGlow": false, | |
| "className": "", | |
| "x": 950, | |
| "y": 80, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "f22ff292ec2d0964", | |
| "type": "ui-form", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Start Time", | |
| "group": "11df00492fb20acd", | |
| "label": "Select Date and Time", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "options": [ | |
| { | |
| "label": "Start", | |
| "key": "Start Date", | |
| "type": "date", | |
| "required": true, | |
| "rows": null | |
| }, | |
| { | |
| "label": "Start Time", | |
| "key": "Start Time", | |
| "type": "time", | |
| "required": true, | |
| "rows": null | |
| }, | |
| { | |
| "label": "Stop Date", | |
| "key": "Stop Date", | |
| "type": "date", | |
| "required": true, | |
| "rows": null | |
| }, | |
| { | |
| "label": "Stop Time", | |
| "key": "Stop Time", | |
| "type": "time", | |
| "required": true, | |
| "rows": null | |
| } | |
| ], | |
| "formValue": { | |
| "Start Date": "", | |
| "Start Time": "", | |
| "Stop Date": "", | |
| "Stop Time": "" | |
| }, | |
| "payload": "", | |
| "submit": "submit", | |
| "cancel": "clear", | |
| "resetOnSubmit": false, | |
| "topic": "topic", | |
| "topicType": "msg", | |
| "splitLayout": false, | |
| "className": "", | |
| "x": 160, | |
| "y": 420, | |
| "wires": [ | |
| [ | |
| "05dfd0f5d8b97fba" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "05dfd0f5d8b97fba", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "start date and end date", | |
| "func": "var startDate = msg.payload[\"Start Date\"];\nvar startTime = msg.payload[\"Start Time\"];\nvar stopDate = msg.payload[\"Stop Date\"];\nvar stopTime = msg.payload[\"Stop Time\"];\n\n\n\nvar startTimestamp = `${startDate}T${startTime}:00+05:30`; // +05:30 is the offset for IST\nvar stopTimestamp = `${stopDate}T${stopTime}:00+05:30`; // +05:30 is the offset for IST\n\n// Construct the query using the provided start and stop timestamps\nmsg.query = `SELECT * FROM room1 WHERE time >= '${startTimestamp}' AND time <= '${stopTimestamp}'`;\n\nreturn msg;\n", | |
| "outputs": 1, | |
| "timeout": 0, | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 410, | |
| "y": 420, | |
| "wires": [ | |
| [ | |
| "a1d3dda63ad3bd6f" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "a1d3dda63ad3bd6f", | |
| "type": "influxdb in", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "influxdb": "cb09abcd8b693ca8", | |
| "name": "Read", | |
| "query": "", | |
| "rawOutput": false, | |
| "precision": "", | |
| "retentionPolicy": "", | |
| "org": "organisation", | |
| "x": 610, | |
| "y": 420, | |
| "wires": [ | |
| [ | |
| "ad4f278b680749b2" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "024b2830c4183fd1", | |
| "type": "function", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Table", | |
| "func": "var temp=[];\nvar a = msg.payload;\n\na.forEach(function (value,index) {\ntemp.push(value)\n});\n\nmsg.payload=temp\n\nreturn msg;", | |
| "outputs": 1, | |
| "timeout": "", | |
| "noerr": 0, | |
| "initialize": "", | |
| "finalize": "", | |
| "libs": [], | |
| "x": 1650, | |
| "y": 780, | |
| "wires": [ | |
| [] | |
| ] | |
| }, | |
| { | |
| "id": "5bb2164a578330bd", | |
| "type": "ui-table", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "11df00492fb20acd", | |
| "name": "Historic Data", | |
| "label": "text", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "maxrows": 0, | |
| "autocols": true, | |
| "columns": [], | |
| "x": 1050, | |
| "y": 420, | |
| "wires": [] | |
| }, | |
| { | |
| "id": "ad4f278b680749b2", | |
| "type": "copy-array", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Table", | |
| "x": 790, | |
| "y": 420, | |
| "wires": [ | |
| [ | |
| "5bb2164a578330bd" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "dd00c6e47e1480ad", | |
| "type": "ui-button", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "aa70ec0abc058d78", | |
| "name": "", | |
| "label": "Clear Temp", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "passthru": false, | |
| "tooltip": "", | |
| "color": "", | |
| "bgcolor": "", | |
| "className": "", | |
| "icon": "", | |
| "payload": "[]", | |
| "payloadType": "json", | |
| "topic": "topic", | |
| "topicType": "msg", | |
| "x": 730, | |
| "y": 60, | |
| "wires": [ | |
| [ | |
| "432850955a867e1e" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "7e6d8eb54dc0d8aa", | |
| "type": "ui-button", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "group": "aa70ec0abc058d78", | |
| "name": "", | |
| "label": "Clear RH", | |
| "order": 0, | |
| "width": 0, | |
| "height": 0, | |
| "passthru": false, | |
| "tooltip": "", | |
| "color": "", | |
| "bgcolor": "", | |
| "className": "", | |
| "icon": "", | |
| "payload": "[]", | |
| "payloadType": "json", | |
| "topic": "topic", | |
| "topicType": "msg", | |
| "x": 740, | |
| "y": 300, | |
| "wires": [ | |
| [ | |
| "a41e65a351476137" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "fe9230e31884d82b", | |
| "type": "copy-array", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "Temp Data", | |
| "x": 810, | |
| "y": 540, | |
| "wires": [ | |
| [ | |
| "6453914fa7bdd751" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "f14e43cc318fa92b", | |
| "type": "copy-array", | |
| "z": "dc1c7f4e5ddc86f8", | |
| "name": "RH Data", | |
| "x": 800, | |
| "y": 660, | |
| "wires": [ | |
| [ | |
| "49ac1cdfe4289eac" | |
| ] | |
| ] | |
| }, | |
| { | |
| "id": "e8ea838e83035408", | |
| "type": "mqtt-broker", | |
| "name": "", | |
| "broker": "192.168.1.39", | |
| "port": "1883", | |
| "clientid": "", | |
| "autoConnect": true, | |
| "usetls": false, | |
| "protocolVersion": "4", | |
| "keepalive": "60", | |
| "cleansession": true, | |
| "autoUnsubscribe": true, | |
| "birthTopic": "", | |
| "birthQos": "0", | |
| "birthRetain": "false", | |
| "birthPayload": "", | |
| "birthMsg": {}, | |
| "closeTopic": "", | |
| "closeQos": "0", | |
| "closeRetain": "false", | |
| "closePayload": "", | |
| "closeMsg": {}, | |
| "willTopic": "", | |
| "willQos": "0", | |
| "willRetain": "false", | |
| "willPayload": "", | |
| "willMsg": {}, | |
| "userProps": "", | |
| "sessionExpiry": "" | |
| }, | |
| { | |
| "id": "cb09abcd8b693ca8", | |
| "type": "influxdb", | |
| "hostname": "127.0.0.1", | |
| "port": "8086", | |
| "protocol": "http", | |
| "database": "environment", | |
| "name": "", | |
| "usetls": false, | |
| "tls": "cff98b62.009678", | |
| "influxdbVersion": "1.x", | |
| "url": "http://localhost:8086", | |
| "timeout": "10", | |
| "rejectUnauthorized": true | |
| }, | |
| { | |
| "id": "11df00492fb20acd", | |
| "type": "ui-group", | |
| "name": "Room 1", | |
| "page": "6a43b6805a66d2b8", | |
| "width": "6", | |
| "height": "1", | |
| "order": -1, | |
| "showTitle": true, | |
| "className": "", | |
| "visible": "true", | |
| "disabled": "false" | |
| }, | |
| { | |
| "id": "aa70ec0abc058d78", | |
| "type": "ui-group", | |
| "name": "Live Data", | |
| "page": "6a43b6805a66d2b8", | |
| "width": "6", | |
| "height": "1", | |
| "order": -1, | |
| "showTitle": true, | |
| "className": "", | |
| "visible": "true", | |
| "disabled": "false" | |
| }, | |
| { | |
| "id": "f02746ad7e1ab68c", | |
| "type": "ui-group", | |
| "name": "Stat Data", | |
| "page": "6a43b6805a66d2b8", | |
| "width": "6", | |
| "height": "1", | |
| "order": -1, | |
| "showTitle": true, | |
| "className": "", | |
| "visible": "true", | |
| "disabled": "false" | |
| }, | |
| { | |
| "id": "cff98b62.009678", | |
| "type": "tls-config", | |
| "name": "", | |
| "cert": "", | |
| "key": "", | |
| "ca": "", | |
| "certname": "", | |
| "keyname": "", | |
| "caname": "", | |
| "servername": "", | |
| "verifyservercert": false | |
| }, | |
| { | |
| "id": "6a43b6805a66d2b8", | |
| "type": "ui-page", | |
| "name": "Environment Data", | |
| "ui": "20ae73d735a60fbc", | |
| "path": "/page2", | |
| "icon": "home", | |
| "layout": "flex", | |
| "theme": "074b315414230834", | |
| "order": -1, | |
| "className": "", | |
| "visible": "true", | |
| "disabled": "false" | |
| }, | |
| { | |
| "id": "20ae73d735a60fbc", | |
| "type": "ui-base", | |
| "name": "UI Name", | |
| "path": "/dashboard", | |
| "showPathInSidebar": false | |
| }, | |
| { | |
| "id": "074b315414230834", | |
| "type": "ui-theme", | |
| "name": "Theme Name", | |
| "colors": { | |
| "surface": "#ffffff", | |
| "primary": "#0094ce", | |
| "bgPage": "#eeeeee", | |
| "groupBg": "#ffffff", | |
| "groupOutline": "#cccccc" | |
| }, | |
| "sizes": { | |
| "pagePadding": "12px", | |
| "groupGap": "12px", | |
| "groupBorderRadius": "4px", | |
| "widgetGap": "12px" | |
| } | |
| } | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment