[ { "id": "2f3715811758b5d1", "type": "tab", "label": "LAN sensors", "disabled": false, "info": "", "env": [] }, { "id": "de120dd8050bfe20", "type": "inject", "z": "2f3715811758b5d1", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "3", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 110, "y": 140, "wires": [ [ "2de69773847632ef" ] ] }, { "id": "84fbef4c1b84142c", "type": "http request", "z": "2f3715811758b5d1", "name": "", "method": "GET", "ret": "txt", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 550, "y": 140, "wires": [ [ "47b79866fd8c70d7" ] ] }, { "id": "3ef75b54fe5546eb", "type": "template", "z": "2f3715811758b5d1", "name": "values url", "field": "url", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "http://{{flow.ip_address}}/values.xml", "output": "str", "x": 400, "y": 140, "wires": [ [ "84fbef4c1b84142c" ] ] }, { "id": "47b79866fd8c70d7", "type": "xml", "z": "2f3715811758b5d1", "name": "XML Parse", "property": "payload", "attr": "", "chr": "", "x": 710, "y": 140, "wires": [ [ "425abb89c1c2ea50", "b486b059595d9a60" ] ] }, { "id": "425abb89c1c2ea50", "type": "debug", "z": "2f3715811758b5d1", "name": "json object", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 710, "y": 200, "wires": [] }, { "id": "f3ab232a12d12d42", "type": "comment", "z": "2f3715811758b5d1", "name": "XML", "info": "", "x": 90, "y": 100, "wires": [] }, { "id": "b486b059595d9a60", "type": "function", "z": "2f3715811758b5d1", "name": "format data", "func": "var data = msg.payload[\"val:Root\"]\n\nmsg.sensors = [] // includes digital inputs\n\n\n/* append all sensors and digital inputs to an array */\n// sensors\nfor (let i = 0; i < data[\"SenSet\"].length; i++) {\n const device = data[\"SenSet\"][i];\n for (let j = 0; j < device[\"Entry\"].length; j++) {\n const element = device[\"Entry\"][j];\n msg.sensors.push(element)\n }\n}\n\n\n// digital inputs \nfor (let i = 0; i < data[\"BinaryInSet\"].length; i++) {\n const device = data[\"BinaryInSet\"][i];\n for (let j = 0; j < device[\"Entry\"].length; j++) {\n const element = device[\"Entry\"][j];\n msg.sensors.push(element)\n }\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 140, "wires": [ [ "11a3df2f378978b8", "eac030cd70ec418e" ] ] }, { "id": "11a3df2f378978b8", "type": "debug", "z": "2f3715811758b5d1", "name": "msg.sensors", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "sensors", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 930, "y": 200, "wires": [] }, { "id": "eac030cd70ec418e", "type": "link out", "z": "2f3715811758b5d1", "name": "link out 3", "mode": "link", "links": [ "db87ec290fde1944", "250d71498ae1ef5d", "bb134baf3ce65ffe", "c90e71767d42f576", "b293765f0f51eba7", "5efb9898064b6928" ], "x": 1015, "y": 140, "wires": [] }, { "id": "db87ec290fde1944", "type": "link in", "z": "2f3715811758b5d1", "name": "link in 2", "links": [ "eac030cd70ec418e", "0cc129bc83b158a2", "6cbcdff16c9d9f62" ], "x": 65, "y": 460, "wires": [ [ "5aeed24afea26c59" ] ] }, { "id": "2e7b538be3e36485", "type": "ui_gauge", "z": "2f3715811758b5d1", "name": "", "group": "65642e0ee2d0d75f", "order": 4, "width": 0, "height": 0, "gtype": "gage", "title": "{{msg.name}}", "label": "", "format": "{{value}} {{units}}", "min": "0", "max": "10", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "diff": false, "className": "", "x": 310, "y": 640, "wires": [] }, { "id": "f46e468825b39ce3", "type": "ui_chart", "z": "2f3715811758b5d1", "name": "chart", "group": "65642e0ee2d0d75f", "order": 4, "width": 0, "height": 0, "label": "{{msg.name}}", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "waiting for data", "dot": false, "ymin": "", "ymax": "", "removeOlder": 1, "removeOlderPoints": "", "removeOlderUnit": "604800", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 310, "y": 720, "wires": [ [] ] }, { "id": "7281bd256212a2dc", "type": "ui_text", "z": "2f3715811758b5d1", "group": "65642e0ee2d0d75f", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "x": 220, "y": 520, "wires": [] }, { "id": "8d6590b30ba8998f", "type": "ui_text", "z": "2f3715811758b5d1", "group": "65642e0ee2d0d75f", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "x": 220, "y": 560, "wires": [] }, { "id": "08aac15044daf4c0", "type": "ui_text", "z": "2f3715811758b5d1", "group": "65642e0ee2d0d75f", "order": 3, "width": 0, "height": 0, "name": "state", "label": "State:", "format": "{{msg.state}}", "layout": "row-center", "className": "", "x": 220, "y": 600, "wires": [] }, { "id": "2de69773847632ef", "type": "change", "z": "2f3715811758b5d1", "name": "CONFIG", "rules": [ { "t": "set", "p": "ip_address", "pt": "flow", "to": "paste your ip here", "tot": "str" }, { "t": "set", "p": "g1_id", "pt": "flow", "to": "33896", "tot": "str" }, { "t": "set", "p": "g2_id", "pt": "flow", "to": "13441", "tot": "str" }, { "t": "set", "p": "g3_id", "pt": "flow", "to": "2648", "tot": "str" }, { "t": "set", "p": "g4_id", "pt": "flow", "to": "20840", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 260, "y": 140, "wires": [ [ "3ef75b54fe5546eb" ] ] }, { "id": "e7104ab23e11aac6", "type": "ui_text", "z": "2f3715811758b5d1", "group": "be44cf59598d0b39", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "x": 210, "y": 780, "wires": [] }, { "id": "0755a7073bd2e53f", "type": "ui_text", "z": "2f3715811758b5d1", "group": "be44cf59598d0b39", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "x": 210, "y": 820, "wires": [] }, { "id": "88f37f976de6a57e", "type": "ui_text", "z": "2f3715811758b5d1", "group": "be44cf59598d0b39", "order": 5, "width": 0, "height": 0, "name": "value", "label": "Value: ", "format": "{{msg.value}}", "layout": "row-center", "className": "", "x": 210, "y": 860, "wires": [] }, { "id": "bb55696cc9669943", "type": "ui_text", "z": "2f3715811758b5d1", "group": "be44cf59598d0b39", "order": 6, "width": 0, "height": 0, "name": "alarm", "label": "Alarm: ", "format": "{{msg.alarm}}", "layout": "row-center", "className": "", "x": 210, "y": 900, "wires": [] }, { "id": "c12d271251f8e473", "type": "ui_ui_control", "z": "2f3715811758b5d1", "name": "hide/show groups", "events": "all", "x": 210, "y": 400, "wires": [ [] ] }, { "id": "1fca6368a040aa05", "type": "link out", "z": "2f3715811758b5d1", "name": "G1 sen out", "mode": "link", "links": [ "19c751f93749a34e" ], "x": 265, "y": 440, "wires": [] }, { "id": "fb1afa082e3297ad", "type": "link out", "z": "2f3715811758b5d1", "name": "G1 di out", "mode": "link", "links": [ "89e5dee4bb048781" ], "x": 265, "y": 460, "wires": [] }, { "id": "89e5dee4bb048781", "type": "link in", "z": "2f3715811758b5d1", "name": "G1 di in", "links": [ "fb1afa082e3297ad" ], "x": 105, "y": 840, "wires": [ [ "e7104ab23e11aac6", "0755a7073bd2e53f", "88f37f976de6a57e", "bb55696cc9669943" ] ] }, { "id": "19c751f93749a34e", "type": "link in", "z": "2f3715811758b5d1", "name": "G1 sen in", "links": [ "1fca6368a040aa05" ], "x": 115, "y": 600, "wires": [ [ "08aac15044daf4c0", "7281bd256212a2dc", "8d6590b30ba8998f", "361bd40f64b86530", "a8455dbfb5e4b1ad" ] ] }, { "id": "56c427df19a5ce2e", "type": "comment", "z": "2f3715811758b5d1", "name": "SET CONFIG DATA HERE", "info": "flow.ip_address\n set the ip address of the targeted device\n\nflow.g1_id\n set the ID of the sensor/digital input that will be displayed in group 1\n\nflow.g2_id\n set the ID of the sensor/digital input that will be displayed in group 2\n\nflow.g3_id\n set the ID of the sensor/digital input that will be displayed in group 3\n\nflow.g4_id\n set the ID of the sensor/digital input that will be displayed in group 4", "x": 270, "y": 100, "wires": [] }, { "id": "361bd40f64b86530", "type": "function", "z": "2f3715811758b5d1", "name": "range", "func": "msg.ui_control = { \n \"min\": msg.min, \n \"max\": msg.max, \n \"name\": msg.name,\n }\n\nmsg.payload = msg.value\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 190, "y": 640, "wires": [ [ "2e7b538be3e36485" ] ] }, { "id": "4925f1dd7159ff60", "type": "comment", "z": "2f3715811758b5d1", "name": "Fetch data", "info": "", "x": 560, "y": 40, "wires": [] }, { "id": "5aeed24afea26c59", "type": "function", "z": "2f3715811758b5d1", "name": "func 1", "func": "var sensor = new Object\nvar di = new Object\nvar element\nvar debug = new Object\nvar group_id = flow.get(\"g1_id\")\n\n// get index of desired sensor/digital input\nconst i = msg.sensors.findIndex(e => e.ID[0] === group_id);\n\n// debug.i = i\n// debug.value = msg.sensors[i][\"Value\"][0]\n// if the id is found\nif (i > -1) {\n if (msg.sensors[i][\"Value\"][0] !== -999.9) { // check for ivalid/disconnected sensors\n element = msg.sensors[i]\n\n // check if the ID has changed, if yes reset the chart\n if (element.ID[0] !== flow.get(\"g1_dat\").ID[0]) {\n sensor.reset_chart = true\n } else {\n sensor.reset_chart = false\n }\n\n sensor.enabled = true\n flow.set(\"g1_dat\", element)\n } else {\n // if the sensor is disconnected, get historic values and grey out the Group\n sensor.enabled = false\n element = flow.get(\"g1_dat\")\n\n }\n\n\n // get data for sensors\n if (element.hasOwnProperty(\"State\")) {\n sensor.name = element[\"Name\"][0]\n sensor.id = element[\"ID\"][0]\n sensor.state = element[\"State\"][0]\n sensor.value = element[\"Value\"][0]\n try {\n sensor.units = element[\"Units\"][0]\n sensor.min = element[\"Min\"][0] - 10\n sensor.max = element[\"Max\"][0] + 10\n } catch (e) {\n sensor.min = 0\n sensor.max = 100\n sensor.units = \"%\"\n }\n msg.payload = { \"group\": { \"hide\": [\"LAN_sensors_G1_di\"], \"show\": [\"LAN_sensors_G1_sen\"], \"focus\": true } }\n \n // get data for digital inputs\n } else if (element.hasOwnProperty(\"AlarmState\")) {\n di.name = element[\"Name\"][0]\n di.id = element[\"ID\"][0]\n di.value = element[\"Value\"][0]\n di.alarm = element[\"AlarmState\"][0]\n di.enabled = true\n msg.payload = { \"group\": { \"hide\": [\"LAN_sensors_G1_sen\"], \"show\": [\"LAN_sensors_G1_di\"], \"focus\": true } }\n }\n\n// if the id is not found\n} else {\n sensor.name = \"INVALID ID\"\n sensor.enabled = false\n}\n\n\nreturn [msg, sensor, di, debug];", "outputs": 4, "noerr": 0, "initialize": "// Code added here will be run once\n// whenever the node is started.\n\nflow.set(\"g1_dat\", {\"ID\": \"x\"})", "finalize": "", "libs": [], "x": 150, "y": 460, "wires": [ [ "c12d271251f8e473" ], [ "1fca6368a040aa05" ], [ "fb1afa082e3297ad" ], [ "ed6694134033443e" ] ] }, { "id": "250d71498ae1ef5d", "type": "link in", "z": "2f3715811758b5d1", "name": "link in 3", "links": [ "eac030cd70ec418e", "0cc129bc83b158a2", "6cbcdff16c9d9f62" ], "x": 435, "y": 460, "wires": [ [ "1ff8bbe1bf5235a2" ] ] }, { "id": "6298bc50b7d7702b", "type": "ui_gauge", "z": "2f3715811758b5d1", "name": "", "group": "bf9fb114ff813409", "order": 4, "width": 0, "height": 0, "gtype": "gage", "title": "{{msg.name}}", "label": "", "format": "{{value}} {{units}}", "min": "0", "max": "10", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "diff": false, "className": "", "x": 680, "y": 640, "wires": [] }, { "id": "c7ad8d81a1f9b722", "type": "ui_chart", "z": "2f3715811758b5d1", "name": "chart", "group": "bf9fb114ff813409", "order": 4, "width": 0, "height": 0, "label": "{{msg.name}}", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "waiting for data", "dot": false, "ymin": "", "ymax": "", "removeOlder": 1, "removeOlderPoints": "", "removeOlderUnit": "604800", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 670, "y": 720, "wires": [ [] ] }, { "id": "c8ad1c349195b9d9", "type": "ui_text", "z": "2f3715811758b5d1", "group": "bf9fb114ff813409", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "x": 590, "y": 520, "wires": [] }, { "id": "abdccb2c71c2a2bb", "type": "ui_text", "z": "2f3715811758b5d1", "group": "bf9fb114ff813409", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "x": 590, "y": 560, "wires": [] }, { "id": "7530724c0855c1cb", "type": "ui_text", "z": "2f3715811758b5d1", "group": "bf9fb114ff813409", "order": 3, "width": 0, "height": 0, "name": "state", "label": "State:", "format": "{{msg.state}}", "layout": "row-center", "className": "", "x": 590, "y": 600, "wires": [] }, { "id": "53d24c8be631444b", "type": "ui_text", "z": "2f3715811758b5d1", "group": "d2d67ce276992359", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "x": 550, "y": 780, "wires": [] }, { "id": "e21df8f57a017381", "type": "ui_text", "z": "2f3715811758b5d1", "group": "d2d67ce276992359", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "x": 550, "y": 820, "wires": [] }, { "id": "89f0f6d923779b2c", "type": "ui_text", "z": "2f3715811758b5d1", "group": "d2d67ce276992359", "order": 5, "width": 0, "height": 0, "name": "value", "label": "Value: ", "format": "{{msg.value}}", "layout": "row-center", "className": "", "x": 550, "y": 860, "wires": [] }, { "id": "b3269fec29d90525", "type": "ui_text", "z": "2f3715811758b5d1", "group": "d2d67ce276992359", "order": 6, "width": 0, "height": 0, "name": "alarm", "label": "Alarm: ", "format": "{{msg.alarm}}", "layout": "row-center", "className": "", "x": 550, "y": 900, "wires": [] }, { "id": "c746c5322426f725", "type": "ui_ui_control", "z": "2f3715811758b5d1", "name": "hide/show groups", "events": "all", "x": 580, "y": 400, "wires": [ [] ] }, { "id": "ad26dd4d9a39c61b", "type": "link out", "z": "2f3715811758b5d1", "name": "G1 sen out", "mode": "link", "links": [ "d77313dd711ad10d" ], "x": 635, "y": 440, "wires": [] }, { "id": "245a527f80146d38", "type": "link out", "z": "2f3715811758b5d1", "name": "G1 di out", "mode": "link", "links": [ "6fecec26a164680d", "3e9e430f41b9bde2" ], "x": 635, "y": 480, "wires": [] }, { "id": "6fecec26a164680d", "type": "link in", "z": "2f3715811758b5d1", "name": "G1 di in", "links": [ "245a527f80146d38" ], "x": 445, "y": 840, "wires": [ [ "53d24c8be631444b", "e21df8f57a017381", "89f0f6d923779b2c", "b3269fec29d90525" ] ] }, { "id": "d77313dd711ad10d", "type": "link in", "z": "2f3715811758b5d1", "name": "G1 sen in", "links": [ "ad26dd4d9a39c61b" ], "x": 485, "y": 600, "wires": [ [ "7530724c0855c1cb", "c8ad1c349195b9d9", "abdccb2c71c2a2bb", "1d7e07bd8acf3b8a", "64737f20351450e9" ] ] }, { "id": "1d7e07bd8acf3b8a", "type": "function", "z": "2f3715811758b5d1", "name": "range", "func": "msg.ui_control = { \n \"min\": msg.min, \n \"max\": msg.max, \n \"name\": msg.name,\n }\nmsg.payload = msg.value\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 560, "y": 640, "wires": [ [ "6298bc50b7d7702b" ] ] }, { "id": "1ff8bbe1bf5235a2", "type": "function", "z": "2f3715811758b5d1", "name": "func 2", "func": "var sensor = new Object\nvar di = new Object\nvar element\nvar group_id = flow.get(\"g2_id\")\n\n// get index of desired sensor/digital input\nconst i = msg.sensors.findIndex(e => e.ID[0] === group_id);\n\nif (i > -1) {\n if (msg.sensors[i][\"Value\"][0] > -100) { // check for ivalid/disconnected sensors\n element = msg.sensors[i]\n\n // check if the ID has changed, if yes reset the chart\n if (element.ID[0] !== flow.get(\"g2_dat\").ID[0]) {\n sensor.reset_chart = true\n } else {\n sensor.reset_chart = false\n }\n \n sensor.enabled = true\n flow.set(\"g2_dat\", element)\n } else { \n // if the sensor is disconnected, get historic values and grey out the Group\n sensor.enabled = false\n element = flow.get(\"g2_dat\")\n \n }\n\n // get data for sensors\n if (element.hasOwnProperty(\"State\")) {\n sensor.name = element[\"Name\"][0]\n sensor.id = element[\"ID\"][0]\n sensor.state = element[\"State\"][0]\n sensor.value = element[\"Value\"][0]\n try {\n sensor.units = element[\"Units\"][0]\n sensor.min = element[\"Min\"][0] - 10\n sensor.max = element[\"Max\"][0] + 10\n } catch (e) {\n sensor.min = 0\n sensor.max = 100\n sensor.units = \"%\"\n }\n msg.payload = { \"group\": { \"hide\": [\"LAN_sensors_G2_di\"], \"show\": [\"LAN_sensors_G2_sen\"], \"focus\": true } }\n // get data for digital inputs\n } else if (element.hasOwnProperty(\"AlarmState\")) { \n di.name = element[\"Name\"][0]\n di.id = element[\"ID\"][0]\n di.value = element[\"Value\"][0]\n di.alarm = element[\"AlarmState\"][0]\n di.enabled = true\n msg.payload = { \"group\": { \"hide\": [\"LAN_sensors_G2_sen\"], \"show\": [\"LAN_sensors_G2_di\"], \"focus\": true } }\n }\n} else {\n sensor.name = \"INVALID ID\"\n sensor.enabled = false\n}\nreturn [msg, sensor, di];", "outputs": 3, "noerr": 0, "initialize": "// Code added here will be run once\n// whenever the node is started.\n\nflow.set(\"g2_dat\", { \"ID\": \"x\" })", "finalize": "", "libs": [], "x": 520, "y": 460, "wires": [ [ "c746c5322426f725" ], [ "ad26dd4d9a39c61b" ], [ "245a527f80146d38" ] ] }, { "id": "c90e71767d42f576", "type": "link in", "z": "2f3715811758b5d1", "name": "link in 4", "links": [ "eac030cd70ec418e", "0cc129bc83b158a2", "6cbcdff16c9d9f62" ], "x": 785, "y": 460, "wires": [ [ "278fd636396c710b" ] ] }, { "id": "b1eed95e49b9e57e", "type": "ui_gauge", "z": "2f3715811758b5d1", "name": "", "group": "59385d573e6d1985", "order": 4, "width": 0, "height": 0, "gtype": "gage", "title": "{{msg.name}}", "label": "", "format": "{{value}} {{units}}", "min": "0", "max": "10", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "diff": false, "className": "", "x": 1030, "y": 640, "wires": [] }, { "id": "a0a94aca7eac83ec", "type": "ui_chart", "z": "2f3715811758b5d1", "name": "chart", "group": "59385d573e6d1985", "order": 4, "width": 0, "height": 0, "label": "{{msg.name}}", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "waiting for data", "dot": false, "ymin": "", "ymax": "", "removeOlder": 1, "removeOlderPoints": "", "removeOlderUnit": "604800", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1030, "y": 720, "wires": [ [] ] }, { "id": "6365770840bfcf73", "type": "ui_text", "z": "2f3715811758b5d1", "group": "59385d573e6d1985", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "x": 940, "y": 520, "wires": [] }, { "id": "5f33c21b8d1431f8", "type": "ui_text", "z": "2f3715811758b5d1", "group": "59385d573e6d1985", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "x": 940, "y": 560, "wires": [] }, { "id": "b2ee365fb365d2df", "type": "ui_text", "z": "2f3715811758b5d1", "group": "59385d573e6d1985", "order": 3, "width": 0, "height": 0, "name": "state", "label": "State:", "format": "{{msg.state}}", "layout": "row-center", "className": "", "x": 940, "y": 600, "wires": [] }, { "id": "c7cd50ac45388f64", "type": "ui_text", "z": "2f3715811758b5d1", "group": "eeb47be4eed519e9", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "x": 930, "y": 780, "wires": [] }, { "id": "bf687f1ec3160019", "type": "ui_text", "z": "2f3715811758b5d1", "group": "eeb47be4eed519e9", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "x": 930, "y": 820, "wires": [] }, { "id": "f50897ccb36358f0", "type": "ui_text", "z": "2f3715811758b5d1", "group": "eeb47be4eed519e9", "order": 5, "width": 0, "height": 0, "name": "value", "label": "Value: ", "format": "{{msg.value}}", "layout": "row-center", "className": "", "x": 930, "y": 860, "wires": [] }, { "id": "ee24fe0a2f862fd0", "type": "ui_text", "z": "2f3715811758b5d1", "group": "eeb47be4eed519e9", "order": 6, "width": 0, "height": 0, "name": "alarm", "label": "Alarm: ", "format": "{{msg.alarm}}", "layout": "row-center", "className": "", "x": 930, "y": 900, "wires": [] }, { "id": "323b2b90b2d427e5", "type": "ui_ui_control", "z": "2f3715811758b5d1", "name": "hide/show groups", "events": "all", "x": 930, "y": 400, "wires": [ [] ] }, { "id": "bd3f45359bbb5e99", "type": "link out", "z": "2f3715811758b5d1", "name": "G1 sen out", "mode": "link", "links": [ "53e98403141841d8" ], "x": 985, "y": 440, "wires": [] }, { "id": "17fd9b1c46ceb450", "type": "link out", "z": "2f3715811758b5d1", "name": "G1 di out", "mode": "link", "links": [ "7bb88e89d2f7babf" ], "x": 985, "y": 480, "wires": [] }, { "id": "7bb88e89d2f7babf", "type": "link in", "z": "2f3715811758b5d1", "name": "G1 di in", "links": [ "17fd9b1c46ceb450" ], "x": 825, "y": 840, "wires": [ [ "c7cd50ac45388f64", "bf687f1ec3160019", "f50897ccb36358f0", "ee24fe0a2f862fd0" ] ] }, { "id": "53e98403141841d8", "type": "link in", "z": "2f3715811758b5d1", "name": "G1 sen in", "links": [ "bd3f45359bbb5e99" ], "x": 835, "y": 600, "wires": [ [ "b2ee365fb365d2df", "6365770840bfcf73", "5f33c21b8d1431f8", "38c1c7444acfbdee", "832aa22f6eeec422" ] ] }, { "id": "38c1c7444acfbdee", "type": "function", "z": "2f3715811758b5d1", "name": "range", "func": "msg.ui_control = { \n \"min\": msg.min, \n \"max\": msg.max, \n \"name\": msg.name,\n }\n\nmsg.payload = msg.value\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 910, "y": 640, "wires": [ [ "b1eed95e49b9e57e" ] ] }, { "id": "278fd636396c710b", "type": "function", "z": "2f3715811758b5d1", "name": "func 3", "func": "var sensor = new Object\nvar di = new Object\nvar element\nvar group_id = flow.get(\"g3_id\")\n\n// get index of desired sensor/digital input\nconst i = msg.sensors.findIndex(e => e.ID[0] === group_id);\n\nif (i > -1) {\n if (msg.sensors[i][\"Value\"][0] > -100) { // check for ivalid/disconnected sensors\n element = msg.sensors[i]\n\n // check if the ID has changed, if yes reset the chart\n if (element.ID[0] !== flow.get(\"g3_dat\").ID[0]) {\n sensor.reset_chart = true\n } else {\n sensor.reset_chart = false\n }\n\n sensor.enabled = true\n flow.set(\"g3_dat\", element)\n } else {\n // if the sensor is disconnected, get historic values and grey out the Group\n sensor.enabled = false\n element = flow.get(\"g3_dat\")\n\n }\n\n // get data for sensors\n if (element.hasOwnProperty(\"State\")) {\n sensor.name = element[\"Name\"][0]\n sensor.id = element[\"ID\"][0]\n sensor.state = element[\"State\"][0]\n sensor.value = element[\"Value\"][0]\n try {\n sensor.units = element[\"Units\"][0]\n sensor.min = element[\"Min\"][0] - 10\n sensor.max = element[\"Max\"][0] + 10\n } catch (e) {\n sensor.min = 0\n sensor.max = 100\n sensor.units = \"%\"\n }\n msg.payload = { \"group\": { \"hide\": [\"LAN_sensors_G3_di\"], \"show\": [\"LAN_sensors_G3_sen\"], \"focus\": true } }\n // get data for digital inputs\n } else if (element.hasOwnProperty(\"AlarmState\")) {\n di.name = element[\"Name\"][0]\n di.id = element[\"ID\"][0]\n di.value = element[\"Value\"][0]\n di.alarm = element[\"AlarmState\"][0]\n di.enabled = true\n msg.payload = { \"group\": { \"hide\": [\"LAN_sensors_G3_sen\"], \"show\": [\"LAN_sensors_G3_di\"], \"focus\": true } }\n }\n} else {\n sensor.name = \"INVALID ID\"\n sensor.enabled = false\n}\n\nreturn [msg, sensor, di];", "outputs": 3, "noerr": 0, "initialize": "// Code added here will be run once\n// whenever the node is started.\n\nflow.set(\"g3_dat\", { \"ID\": \"x\" })", "finalize": "", "libs": [], "x": 870, "y": 460, "wires": [ [ "323b2b90b2d427e5" ], [ "bd3f45359bbb5e99" ], [ "17fd9b1c46ceb450" ] ] }, { "id": "bb134baf3ce65ffe", "type": "link in", "z": "2f3715811758b5d1", "name": "link in 5", "links": [ "eac030cd70ec418e", "0cc129bc83b158a2", "6cbcdff16c9d9f62" ], "x": 1145, "y": 460, "wires": [ [ "04ba65a432b181e7" ] ] }, { "id": "3dd651c00e47384e", "type": "ui_gauge", "z": "2f3715811758b5d1", "name": "", "group": "196f15e50b444ed4", "order": 4, "width": 0, "height": 0, "gtype": "gage", "title": "{{msg.name}}", "label": "", "format": "{{value}} {{units}}", "min": "0", "max": "10", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "diff": false, "className": "", "x": 1390, "y": 640, "wires": [] }, { "id": "1c2a748051189c4a", "type": "ui_chart", "z": "2f3715811758b5d1", "name": "chart", "group": "196f15e50b444ed4", "order": 4, "width": 0, "height": 0, "label": "{{msg.name}}", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "waiting for data", "dot": false, "ymin": "", "ymax": "", "removeOlder": 1, "removeOlderPoints": "", "removeOlderUnit": "604800", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1390, "y": 720, "wires": [ [] ] }, { "id": "bfb66a3a0de18080", "type": "ui_text", "z": "2f3715811758b5d1", "group": "196f15e50b444ed4", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "x": 1300, "y": 520, "wires": [] }, { "id": "99264a5382a53690", "type": "ui_text", "z": "2f3715811758b5d1", "group": "196f15e50b444ed4", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "x": 1300, "y": 560, "wires": [] }, { "id": "b3216002cd6b1919", "type": "ui_text", "z": "2f3715811758b5d1", "group": "196f15e50b444ed4", "order": 3, "width": 0, "height": 0, "name": "state", "label": "State:", "format": "{{msg.state}}", "layout": "row-center", "className": "", "x": 1300, "y": 600, "wires": [] }, { "id": "ddd213a201f1cf06", "type": "ui_text", "z": "2f3715811758b5d1", "group": "28be5788d8898f7a", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "x": 1290, "y": 780, "wires": [] }, { "id": "6116ab19ab5ba659", "type": "ui_text", "z": "2f3715811758b5d1", "group": "28be5788d8898f7a", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "x": 1290, "y": 820, "wires": [] }, { "id": "e32d8704e1bd4800", "type": "ui_text", "z": "2f3715811758b5d1", "group": "28be5788d8898f7a", "order": 5, "width": 0, "height": 0, "name": "value", "label": "Value: ", "format": "{{msg.value}}", "layout": "row-center", "className": "", "x": 1290, "y": 860, "wires": [] }, { "id": "1b0389d29183d21e", "type": "ui_text", "z": "2f3715811758b5d1", "group": "28be5788d8898f7a", "order": 6, "width": 0, "height": 0, "name": "alarm", "label": "Alarm: ", "format": "{{msg.alarm}}", "layout": "row-center", "className": "", "x": 1290, "y": 900, "wires": [] }, { "id": "3e154121d0f19502", "type": "ui_ui_control", "z": "2f3715811758b5d1", "name": "hide/show groups", "events": "all", "x": 1290, "y": 400, "wires": [ [] ] }, { "id": "33ac8705efcbc693", "type": "link out", "z": "2f3715811758b5d1", "name": "G1 sen out", "mode": "link", "links": [ "0f95911764a2b13d" ], "x": 1345, "y": 440, "wires": [] }, { "id": "3b3b8c3c3f05378e", "type": "link out", "z": "2f3715811758b5d1", "name": "G1 di out", "mode": "link", "links": [ "f97e65fbb1476704" ], "x": 1345, "y": 480, "wires": [] }, { "id": "f97e65fbb1476704", "type": "link in", "z": "2f3715811758b5d1", "name": "G1 di in", "links": [ "3b3b8c3c3f05378e" ], "x": 1185, "y": 840, "wires": [ [ "ddd213a201f1cf06", "6116ab19ab5ba659", "e32d8704e1bd4800", "1b0389d29183d21e" ] ] }, { "id": "0f95911764a2b13d", "type": "link in", "z": "2f3715811758b5d1", "name": "G1 sen in", "links": [ "33ac8705efcbc693" ], "x": 1195, "y": 600, "wires": [ [ "b3216002cd6b1919", "bfb66a3a0de18080", "99264a5382a53690", "5ff2e04eed3a6747", "161beda58beaeee5" ] ] }, { "id": "5ff2e04eed3a6747", "type": "function", "z": "2f3715811758b5d1", "name": "range", "func": "msg.ui_control = { \n \"min\": msg.min, \n \"max\": msg.max, \n \"name\": msg.name,\n }\n\nmsg.payload = msg.value\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1270, "y": 640, "wires": [ [ "3dd651c00e47384e" ] ] }, { "id": "04ba65a432b181e7", "type": "function", "z": "2f3715811758b5d1", "name": "func 4", "func": "var sensor = new Object\nvar di = new Object\nvar element\nvar group_id = flow.get(\"g4_id\")\n\n// get index of desired sensor/digital input\nconst i = msg.sensors.findIndex(e => e.ID[0] === group_id);\n\nif (i > -1) {\n if (msg.sensors[i][\"Value\"][0] > -100) { // check for ivalid/disconnected sensors\n element = msg.sensors[i]\n\n // check if the ID has changed, if yes reset the chart\n if (element.ID[0] !== flow.get(\"g4_dat\").ID[0]) {\n sensor.reset_chart = true\n } else {\n sensor.reset_chart = false\n }\n\n sensor.enabled = true\n flow.set(\"g4_dat\", element)\n } else {\n // if the sensor is disconnected, get historic values and grey out the Group\n sensor.enabled = false\n element = flow.get(\"g4_dat\")\n\n }\n\n // get data for sensors\n if (element.hasOwnProperty(\"State\")) {\n sensor.name = element[\"Name\"][0]\n sensor.id = element[\"ID\"][0]\n sensor.state = element[\"State\"][0]\n sensor.value = element[\"Value\"][0]\n try {\n sensor.units = element[\"Units\"][0]\n sensor.min = element[\"Min\"][0] - 10\n sensor.max = element[\"Max\"][0] + 10\n } catch (e) {\n sensor.min = 0\n sensor.max = 100\n sensor.units = \"%\"\n }\n msg.payload = { \"group\": { \"hide\": [\"LAN_sensors_G4_di\"], \"show\": [\"LAN_sensors_G4_sen\"], \"focus\": true } }\n // get data for digital inputs\n } else if (element.hasOwnProperty(\"AlarmState\")) {\n di.name = element[\"Name\"][0]\n di.id = element[\"ID\"][0]\n di.value = element[\"Value\"][0]\n di.alarm = element[\"AlarmState\"][0]\n di.enabled = true\n msg.payload = { \"group\": { \"hide\": [\"LAN_sensors_G4_sen\"], \"show\": [\"LAN_sensors_G4_di\"], \"focus\": true } }\n }\n} else {\n sensor.name = \"INVALID ID\"\n sensor.enabled = false\n}\nreturn [msg, sensor, di];", "outputs": 3, "noerr": 0, "initialize": "// Code added here will be run once\n// whenever the node is started.\n\nflow.set(\"g4_dat\", { \"ID\": \"x\" })", "finalize": "", "libs": [], "x": 1230, "y": 460, "wires": [ [ "3e154121d0f19502" ], [ "33ac8705efcbc693" ], [ "3b3b8c3c3f05378e" ] ] }, { "id": "a8455dbfb5e4b1ad", "type": "function", "z": "2f3715811758b5d1", "name": "func", "func": "var reset = new Object\n\nif (msg.reset_chart) {\n reset.payload = []\n msg.reset = \" \"\n} else {\n msg.payload = msg.value\n}\nreturn [msg, reset];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 170, "y": 680, "wires": [ [ "cac26f32f3028e10" ], [ "f46e468825b39ce3" ] ] }, { "id": "f42af1e95fe18b59", "type": "comment", "z": "2f3715811758b5d1", "name": "Group 1", "info": "", "x": 180, "y": 340, "wires": [] }, { "id": "1e16156fc547df81", "type": "comment", "z": "2f3715811758b5d1", "name": "Group 2", "info": "", "x": 580, "y": 340, "wires": [] }, { "id": "f7d5e898d92146f4", "type": "comment", "z": "2f3715811758b5d1", "name": "Group 3", "info": "", "x": 900, "y": 340, "wires": [] }, { "id": "abdc5cb8906c0cf9", "type": "comment", "z": "2f3715811758b5d1", "name": "Group 4", "info": "", "x": 1300, "y": 340, "wires": [] }, { "id": "f414d781fda4c792", "type": "catch", "z": "2f3715811758b5d1", "name": "", "scope": [ "84fbef4c1b84142c", "47b79866fd8c70d7" ], "uncaught": false, "x": 630, "y": 100, "wires": [ [ "052b0eff2b6e9706" ] ] }, { "id": "052b0eff2b6e9706", "type": "change", "z": "2f3715811758b5d1", "name": "", "rules": [ { "t": "set", "p": "sensors", "pt": "msg", "to": "[]", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 780, "y": 100, "wires": [ [ "eac030cd70ec418e" ] ] }, { "id": "ed6694134033443e", "type": "debug", "z": "2f3715811758b5d1", "name": "debug 13", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "value", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 400, "y": 360, "wires": [] }, { "id": "cac26f32f3028e10", "type": "smooth", "z": "2f3715811758b5d1", "name": "", "property": "payload", "action": "mean", "count": "60", "round": "2", "mult": "single", "reduce": true, "x": 300, "y": 680, "wires": [ [ "f46e468825b39ce3" ] ] }, { "id": "64737f20351450e9", "type": "function", "z": "2f3715811758b5d1", "name": "func", "func": "var reset = new Object\n\nif (msg.reset_chart) {\n reset.payload = []\n msg.reset = \" \"\n} else {\n msg.payload = msg.value\n}\nreturn [msg, reset];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 550, "y": 680, "wires": [ [ "2d0774b38c204c4f" ], [ "c7ad8d81a1f9b722" ] ] }, { "id": "2d0774b38c204c4f", "type": "smooth", "z": "2f3715811758b5d1", "name": "", "property": "payload", "action": "mean", "count": "60", "round": "2", "mult": "single", "reduce": true, "x": 680, "y": 680, "wires": [ [ "c7ad8d81a1f9b722" ] ] }, { "id": "832aa22f6eeec422", "type": "function", "z": "2f3715811758b5d1", "name": "func", "func": "var reset = new Object\n\nif (msg.reset_chart) {\n reset.payload = []\n msg.reset = \" \"\n} else {\n msg.payload = msg.value\n}\nreturn [msg, reset];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 910, "y": 680, "wires": [ [ "6d45138e08bab24f" ], [ "a0a94aca7eac83ec" ] ] }, { "id": "6d45138e08bab24f", "type": "smooth", "z": "2f3715811758b5d1", "name": "", "property": "payload", "action": "mean", "count": "60", "round": "2", "mult": "single", "reduce": true, "x": 1040, "y": 680, "wires": [ [ "a0a94aca7eac83ec" ] ] }, { "id": "161beda58beaeee5", "type": "function", "z": "2f3715811758b5d1", "name": "func", "func": "var reset = new Object\n\nif (msg.reset_chart) {\n reset.payload = []\n msg.reset = \" \"\n} else {\n msg.payload = msg.value\n}\nreturn [msg, reset];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1270, "y": 680, "wires": [ [ "40d322170d9b2953" ], [ "1c2a748051189c4a" ] ] }, { "id": "40d322170d9b2953", "type": "smooth", "z": "2f3715811758b5d1", "name": "", "property": "payload", "action": "mean", "count": "60", "round": "2", "mult": "single", "reduce": true, "x": 1400, "y": 680, "wires": [ [ "1c2a748051189c4a" ] ] }, { "id": "65642e0ee2d0d75f", "type": "ui_group", "name": "G1_sen", "tab": "cffd459c561d4510", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "be44cf59598d0b39", "type": "ui_group", "name": "G1_di", "tab": "cffd459c561d4510", "order": 2, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "bf9fb114ff813409", "type": "ui_group", "name": "G2_sen", "tab": "cffd459c561d4510", "order": 3, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "d2d67ce276992359", "type": "ui_group", "name": "G2_di", "tab": "cffd459c561d4510", "order": 4, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "59385d573e6d1985", "type": "ui_group", "name": "G3_sen", "tab": "cffd459c561d4510", "order": 5, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "eeb47be4eed519e9", "type": "ui_group", "name": "G3_di", "tab": "cffd459c561d4510", "order": 6, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "196f15e50b444ed4", "type": "ui_group", "name": "G4_sen", "tab": "cffd459c561d4510", "order": 7, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "28be5788d8898f7a", "type": "ui_group", "name": "G4_di", "tab": "cffd459c561d4510", "order": 8, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "cffd459c561d4510", "type": "ui_tab", "name": "LAN sensors", "icon": "fa-sitemap", "order": 3, "disabled": false, "hidden": false } ]