[ { "id": "5fbd144406d1efae", "type": "tab", "label": "LAN sensors", "disabled": false, "info": "", "env": [] }, { "id": "88e7b93229470de3", "type": "inject", "z": "5fbd144406d1efae", "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": [ [ "f6dbcae5c4a2d65a" ] ] }, { "id": "f4b57b71c66bba4a", "type": "http request", "z": "5fbd144406d1efae", "name": "", "method": "GET", "ret": "txt", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 550, "y": 140, "wires": [ [ "d76c87b57ebd2e5c" ] ] }, { "id": "427aa279539719b4", "type": "template", "z": "5fbd144406d1efae", "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": [ [ "f4b57b71c66bba4a" ] ] }, { "id": "d76c87b57ebd2e5c", "type": "xml", "z": "5fbd144406d1efae", "name": "XML Parse", "property": "payload", "attr": "", "chr": "", "x": 710, "y": 140, "wires": [ [ "fe7b498914652732", "3404e4667c83b304" ] ] }, { "id": "fe7b498914652732", "type": "debug", "z": "5fbd144406d1efae", "name": "json object", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 710, "y": 200, "wires": [] }, { "id": "46e8271a9a195659", "type": "comment", "z": "5fbd144406d1efae", "name": "XML", "info": "", "x": 90, "y": 100, "wires": [] }, { "id": "3404e4667c83b304", "type": "function", "z": "5fbd144406d1efae", "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": [ [ "b32af1483ac312f7", "158f406b21994ddd" ] ] }, { "id": "b32af1483ac312f7", "type": "debug", "z": "5fbd144406d1efae", "name": "msg.sensors", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "sensors", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 930, "y": 200, "wires": [] }, { "id": "158f406b21994ddd", "type": "link out", "z": "5fbd144406d1efae", "name": "link out 3", "mode": "link", "links": [ "165afb4f0d7f6f02", "d6ca04e5018ff0a7", "dbc56acf81030378", "e32079f2c643a7ca", "b293765f0f51eba7", "5efb9898064b6928" ], "x": 1015, "y": 140, "wires": [] }, { "id": "165afb4f0d7f6f02", "type": "link in", "z": "5fbd144406d1efae", "name": "link in 2", "links": [ "158f406b21994ddd", "0cc129bc83b158a2", "6cbcdff16c9d9f62" ], "x": 65, "y": 460, "wires": [ [ "b12455359f31d5f0" ] ] }, { "id": "27230a085448e494", "type": "ui_gauge", "z": "5fbd144406d1efae", "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": "e1aaee91d9c40ab3", "type": "ui_chart", "z": "5fbd144406d1efae", "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": 290, "y": 680, "wires": [ [] ] }, { "id": "c8306d0323c4d733", "type": "ui_text", "z": "5fbd144406d1efae", "group": "65642e0ee2d0d75f", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": "20", "color": "#000000", "x": 220, "y": 520, "wires": [] }, { "id": "2be577607e8fdacf", "type": "ui_text", "z": "5fbd144406d1efae", "group": "65642e0ee2d0d75f", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 220, "y": 560, "wires": [] }, { "id": "ddcae51ed7d5d3d7", "type": "ui_text", "z": "5fbd144406d1efae", "group": "65642e0ee2d0d75f", "order": 3, "width": 0, "height": 0, "name": "state", "label": "State:", "format": "{{msg.state}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 220, "y": 600, "wires": [] }, { "id": "f6dbcae5c4a2d65a", "type": "change", "z": "5fbd144406d1efae", "name": "CONFIG", "rules": [ { "t": "set", "p": "ip_address", "pt": "flow", "to": "192.168.103.6", "tot": "str" }, { "t": "set", "p": "g1_id", "pt": "flow", "to": "2648", "tot": "str" }, { "t": "set", "p": "g2_id", "pt": "flow", "to": "13441", "tot": "str" }, { "t": "set", "p": "g3_id", "pt": "flow", "to": "20840", "tot": "str" }, { "t": "set", "p": "g4_id", "pt": "flow", "to": "33896", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 260, "y": 140, "wires": [ [ "427aa279539719b4" ] ] }, { "id": "0cd875c0111938f1", "type": "ui_text", "z": "5fbd144406d1efae", "group": "be44cf59598d0b39", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": "20", "color": "#000000", "x": 220, "y": 740, "wires": [] }, { "id": "489d3f5b6299403e", "type": "ui_text", "z": "5fbd144406d1efae", "group": "be44cf59598d0b39", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 220, "y": 780, "wires": [] }, { "id": "9597f6935a740299", "type": "ui_text", "z": "5fbd144406d1efae", "group": "be44cf59598d0b39", "order": 5, "width": 0, "height": 0, "name": "value", "label": "Value: ", "format": "{{msg.value}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 220, "y": 820, "wires": [] }, { "id": "afa837bd61bb825c", "type": "ui_text", "z": "5fbd144406d1efae", "group": "be44cf59598d0b39", "order": 6, "width": 0, "height": 0, "name": "alarm", "label": "Alarm: ", "format": "{{msg.alarm}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 220, "y": 860, "wires": [] }, { "id": "74a95ed4ccd3b7cc", "type": "ui_ui_control", "z": "5fbd144406d1efae", "name": "hide/show groups", "events": "all", "x": 210, "y": 400, "wires": [ [] ] }, { "id": "5c9d5d86942fb42b", "type": "link out", "z": "5fbd144406d1efae", "name": "G1 sen out", "mode": "link", "links": [ "0a8d58f016a66f65" ], "x": 265, "y": 440, "wires": [] }, { "id": "795212fadc059428", "type": "link out", "z": "5fbd144406d1efae", "name": "G1 di out", "mode": "link", "links": [ "f885d9f9084ae745" ], "x": 265, "y": 480, "wires": [] }, { "id": "f885d9f9084ae745", "type": "link in", "z": "5fbd144406d1efae", "name": "G1 di in", "links": [ "795212fadc059428" ], "x": 115, "y": 800, "wires": [ [ "0cd875c0111938f1", "489d3f5b6299403e", "9597f6935a740299", "afa837bd61bb825c" ] ] }, { "id": "0a8d58f016a66f65", "type": "link in", "z": "5fbd144406d1efae", "name": "G1 sen in", "links": [ "5c9d5d86942fb42b" ], "x": 115, "y": 600, "wires": [ [ "ddcae51ed7d5d3d7", "c8306d0323c4d733", "2be577607e8fdacf", "87a075cd448c6e3a", "9194c44b2fc93284" ] ] }, { "id": "f5907f4665da4585", "type": "comment", "z": "5fbd144406d1efae", "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": "87a075cd448c6e3a", "type": "function", "z": "5fbd144406d1efae", "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": [ [ "27230a085448e494" ] ] }, { "id": "c829dfc6a4ee2631", "type": "comment", "z": "5fbd144406d1efae", "name": "Fetch data", "info": "", "x": 560, "y": 40, "wires": [] }, { "id": "b12455359f31d5f0", "type": "function", "z": "5fbd144406d1efae", "name": "func 1", "func": "var sensor = new Object\nvar di = new Object\nvar element\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);\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(\"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 // 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 // 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} 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(\"g1_dat\", {\"ID\": \"x\"})", "finalize": "", "libs": [], "x": 150, "y": 460, "wires": [ [ "74a95ed4ccd3b7cc" ], [ "5c9d5d86942fb42b" ], [ "795212fadc059428" ] ] }, { "id": "d6ca04e5018ff0a7", "type": "link in", "z": "5fbd144406d1efae", "name": "link in 3", "links": [ "158f406b21994ddd", "0cc129bc83b158a2", "6cbcdff16c9d9f62" ], "x": 435, "y": 460, "wires": [ [ "7d0c6275afe88cdf" ] ] }, { "id": "cc50a8fe1805f7cd", "type": "ui_gauge", "z": "5fbd144406d1efae", "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": "78daf9ab45bf0adb", "type": "ui_chart", "z": "5fbd144406d1efae", "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": 660, "y": 680, "wires": [ [] ] }, { "id": "8974347504b9175d", "type": "ui_text", "z": "5fbd144406d1efae", "group": "bf9fb114ff813409", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": "20", "color": "#000000", "x": 590, "y": 520, "wires": [] }, { "id": "5fd95ea5e2811762", "type": "ui_text", "z": "5fbd144406d1efae", "group": "bf9fb114ff813409", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 590, "y": 560, "wires": [] }, { "id": "9dac72343ecb6176", "type": "ui_text", "z": "5fbd144406d1efae", "group": "bf9fb114ff813409", "order": 3, "width": 0, "height": 0, "name": "state", "label": "State:", "format": "{{msg.state}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 590, "y": 600, "wires": [] }, { "id": "711a05be4bce1981", "type": "ui_text", "z": "5fbd144406d1efae", "group": "d2d67ce276992359", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": "20", "color": "#000000", "x": 590, "y": 740, "wires": [] }, { "id": "ade4116b18a5382f", "type": "ui_text", "z": "5fbd144406d1efae", "group": "d2d67ce276992359", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 590, "y": 780, "wires": [] }, { "id": "e345f4bfe9c1ed14", "type": "ui_text", "z": "5fbd144406d1efae", "group": "d2d67ce276992359", "order": 5, "width": 0, "height": 0, "name": "value", "label": "Value: ", "format": "{{msg.value}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 590, "y": 820, "wires": [] }, { "id": "de36fe681e1e2e50", "type": "ui_text", "z": "5fbd144406d1efae", "group": "d2d67ce276992359", "order": 6, "width": 0, "height": 0, "name": "alarm", "label": "Alarm: ", "format": "{{msg.alarm}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 590, "y": 860, "wires": [] }, { "id": "f694771019ed53f4", "type": "ui_ui_control", "z": "5fbd144406d1efae", "name": "hide/show groups", "events": "all", "x": 580, "y": 400, "wires": [ [] ] }, { "id": "0c112d06dd2feb3b", "type": "link out", "z": "5fbd144406d1efae", "name": "G1 sen out", "mode": "link", "links": [ "54f277af61c540f3" ], "x": 635, "y": 440, "wires": [] }, { "id": "7821549c420f8d39", "type": "link out", "z": "5fbd144406d1efae", "name": "G1 di out", "mode": "link", "links": [ "c622b17583678f4f", "3e9e430f41b9bde2" ], "x": 635, "y": 480, "wires": [] }, { "id": "c622b17583678f4f", "type": "link in", "z": "5fbd144406d1efae", "name": "G1 di in", "links": [ "7821549c420f8d39" ], "x": 485, "y": 800, "wires": [ [ "711a05be4bce1981", "ade4116b18a5382f", "e345f4bfe9c1ed14", "de36fe681e1e2e50" ] ] }, { "id": "54f277af61c540f3", "type": "link in", "z": "5fbd144406d1efae", "name": "G1 sen in", "links": [ "0c112d06dd2feb3b" ], "x": 485, "y": 600, "wires": [ [ "9dac72343ecb6176", "8974347504b9175d", "5fd95ea5e2811762", "ff308219ee44d1a4", "50abcd02ed907265" ] ] }, { "id": "ff308219ee44d1a4", "type": "function", "z": "5fbd144406d1efae", "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": [ [ "cc50a8fe1805f7cd" ] ] }, { "id": "7d0c6275afe88cdf", "type": "function", "z": "5fbd144406d1efae", "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": [ [ "f694771019ed53f4" ], [ "0c112d06dd2feb3b" ], [ "7821549c420f8d39" ] ] }, { "id": "e32079f2c643a7ca", "type": "link in", "z": "5fbd144406d1efae", "name": "link in 4", "links": [ "158f406b21994ddd", "0cc129bc83b158a2", "6cbcdff16c9d9f62" ], "x": 785, "y": 460, "wires": [ [ "851313f8383d57d1" ] ] }, { "id": "1a49b9b6179196c5", "type": "ui_gauge", "z": "5fbd144406d1efae", "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": "09d06518592d644b", "type": "ui_chart", "z": "5fbd144406d1efae", "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": 1010, "y": 680, "wires": [ [] ] }, { "id": "a61325931d838129", "type": "ui_text", "z": "5fbd144406d1efae", "group": "59385d573e6d1985", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": "20", "color": "#000000", "x": 940, "y": 520, "wires": [] }, { "id": "9786f12c1a4bd3ab", "type": "ui_text", "z": "5fbd144406d1efae", "group": "59385d573e6d1985", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 940, "y": 560, "wires": [] }, { "id": "ad1c0697f563f6f0", "type": "ui_text", "z": "5fbd144406d1efae", "group": "59385d573e6d1985", "order": 3, "width": 0, "height": 0, "name": "state", "label": "State:", "format": "{{msg.state}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 940, "y": 600, "wires": [] }, { "id": "dcfa4d5317dc76b4", "type": "ui_text", "z": "5fbd144406d1efae", "group": "eeb47be4eed519e9", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": "20", "color": "#000000", "x": 940, "y": 740, "wires": [] }, { "id": "a7acbe75d92a90be", "type": "ui_text", "z": "5fbd144406d1efae", "group": "eeb47be4eed519e9", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 940, "y": 780, "wires": [] }, { "id": "536c810c7ecdf7aa", "type": "ui_text", "z": "5fbd144406d1efae", "group": "eeb47be4eed519e9", "order": 5, "width": 0, "height": 0, "name": "value", "label": "Value: ", "format": "{{msg.value}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 940, "y": 820, "wires": [] }, { "id": "9a1f19e0d16934c8", "type": "ui_text", "z": "5fbd144406d1efae", "group": "eeb47be4eed519e9", "order": 6, "width": 0, "height": 0, "name": "alarm", "label": "Alarm: ", "format": "{{msg.alarm}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 940, "y": 860, "wires": [] }, { "id": "54391bb0b01a3d6e", "type": "ui_ui_control", "z": "5fbd144406d1efae", "name": "hide/show groups", "events": "all", "x": 930, "y": 400, "wires": [ [] ] }, { "id": "0036825f16c16b5a", "type": "link out", "z": "5fbd144406d1efae", "name": "G1 sen out", "mode": "link", "links": [ "4c2812a95d888a19" ], "x": 985, "y": 440, "wires": [] }, { "id": "ef9bcce2c6d753d8", "type": "link out", "z": "5fbd144406d1efae", "name": "G1 di out", "mode": "link", "links": [ "b62f52ece0cde689" ], "x": 985, "y": 480, "wires": [] }, { "id": "b62f52ece0cde689", "type": "link in", "z": "5fbd144406d1efae", "name": "G1 di in", "links": [ "ef9bcce2c6d753d8" ], "x": 835, "y": 800, "wires": [ [ "dcfa4d5317dc76b4", "a7acbe75d92a90be", "536c810c7ecdf7aa", "9a1f19e0d16934c8" ] ] }, { "id": "4c2812a95d888a19", "type": "link in", "z": "5fbd144406d1efae", "name": "G1 sen in", "links": [ "0036825f16c16b5a" ], "x": 835, "y": 600, "wires": [ [ "ad1c0697f563f6f0", "a61325931d838129", "9786f12c1a4bd3ab", "d401ad0739ec9f9e", "99a8a366b9d7d0c5" ] ] }, { "id": "d401ad0739ec9f9e", "type": "function", "z": "5fbd144406d1efae", "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": [ [ "1a49b9b6179196c5" ] ] }, { "id": "851313f8383d57d1", "type": "function", "z": "5fbd144406d1efae", "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": [ [ "54391bb0b01a3d6e" ], [ "0036825f16c16b5a" ], [ "ef9bcce2c6d753d8" ] ] }, { "id": "dbc56acf81030378", "type": "link in", "z": "5fbd144406d1efae", "name": "link in 5", "links": [ "158f406b21994ddd", "0cc129bc83b158a2", "6cbcdff16c9d9f62" ], "x": 1145, "y": 460, "wires": [ [ "acbe5ee542873028" ] ] }, { "id": "2008324b6d42a67d", "type": "ui_gauge", "z": "5fbd144406d1efae", "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": "9f08e9344b819e1c", "type": "ui_chart", "z": "5fbd144406d1efae", "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": 1370, "y": 680, "wires": [ [] ] }, { "id": "06caaf9abaac4d4c", "type": "ui_text", "z": "5fbd144406d1efae", "group": "196f15e50b444ed4", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": "20", "color": "#000000", "x": 1300, "y": 520, "wires": [] }, { "id": "ea7f69af4d0c92cb", "type": "ui_text", "z": "5fbd144406d1efae", "group": "196f15e50b444ed4", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 1300, "y": 560, "wires": [] }, { "id": "21f4abccdbe7d4c3", "type": "ui_text", "z": "5fbd144406d1efae", "group": "196f15e50b444ed4", "order": 3, "width": 0, "height": 0, "name": "state", "label": "State:", "format": "{{msg.state}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 1300, "y": 600, "wires": [] }, { "id": "c15b03af8ada1b8e", "type": "ui_text", "z": "5fbd144406d1efae", "group": "28be5788d8898f7a", "order": 1, "width": 0, "height": 0, "name": "name", "label": "", "format": "{{msg.name}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": "20", "color": "#000000", "x": 1300, "y": 740, "wires": [] }, { "id": "653db549287b4131", "type": "ui_text", "z": "5fbd144406d1efae", "group": "28be5788d8898f7a", "order": 2, "width": 0, "height": 0, "name": "id", "label": "ID:", "format": "{{msg.id}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 1300, "y": 780, "wires": [] }, { "id": "0fff7e7e873d44f2", "type": "ui_text", "z": "5fbd144406d1efae", "group": "28be5788d8898f7a", "order": 5, "width": 0, "height": 0, "name": "value", "label": "Value: ", "format": "{{msg.value}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 1300, "y": 820, "wires": [] }, { "id": "c6af9da774de29e0", "type": "ui_text", "z": "5fbd144406d1efae", "group": "28be5788d8898f7a", "order": 6, "width": 0, "height": 0, "name": "alarm", "label": "Alarm: ", "format": "{{msg.alarm}}", "layout": "row-center", "className": "", "style": false, "font": "", "fontSize": 16, "color": "#000000", "x": 1300, "y": 860, "wires": [] }, { "id": "2eca5aaa2361aa5d", "type": "ui_ui_control", "z": "5fbd144406d1efae", "name": "hide/show groups", "events": "all", "x": 1290, "y": 400, "wires": [ [] ] }, { "id": "5fbe61048ae34627", "type": "link out", "z": "5fbd144406d1efae", "name": "G1 sen out", "mode": "link", "links": [ "180d0ba2ed569dda" ], "x": 1345, "y": 440, "wires": [] }, { "id": "6ab532990702bff2", "type": "link out", "z": "5fbd144406d1efae", "name": "G1 di out", "mode": "link", "links": [ "68f446faf94143de" ], "x": 1345, "y": 480, "wires": [] }, { "id": "68f446faf94143de", "type": "link in", "z": "5fbd144406d1efae", "name": "G1 di in", "links": [ "6ab532990702bff2" ], "x": 1195, "y": 800, "wires": [ [ "c15b03af8ada1b8e", "653db549287b4131", "0fff7e7e873d44f2", "c6af9da774de29e0" ] ] }, { "id": "180d0ba2ed569dda", "type": "link in", "z": "5fbd144406d1efae", "name": "G1 sen in", "links": [ "5fbe61048ae34627" ], "x": 1195, "y": 600, "wires": [ [ "21f4abccdbe7d4c3", "06caaf9abaac4d4c", "ea7f69af4d0c92cb", "0ffaabe8d9163e96", "891156c8cda201c2" ] ] }, { "id": "0ffaabe8d9163e96", "type": "function", "z": "5fbd144406d1efae", "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": [ [ "2008324b6d42a67d" ] ] }, { "id": "acbe5ee542873028", "type": "function", "z": "5fbd144406d1efae", "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": [ [ "2eca5aaa2361aa5d" ], [ "5fbe61048ae34627" ], [ "6ab532990702bff2" ] ] }, { "id": "50abcd02ed907265", "type": "function", "z": "5fbd144406d1efae", "name": "func", "func": "if (msg.reset_chart) {\n msg.payload = []\n} else {\n msg.payload = msg.value\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 530, "y": 680, "wires": [ [ "78daf9ab45bf0adb" ] ] }, { "id": "9194c44b2fc93284", "type": "function", "z": "5fbd144406d1efae", "name": "func", "func": "if (msg.reset_chart) {\n msg.payload = []\n} else {\n msg.payload = msg.value\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 170, "y": 680, "wires": [ [ "e1aaee91d9c40ab3" ] ] }, { "id": "99a8a366b9d7d0c5", "type": "function", "z": "5fbd144406d1efae", "name": "func", "func": "if (msg.reset_chart) {\n msg.payload = []\n} else {\n msg.payload = msg.value\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 680, "wires": [ [ "09d06518592d644b" ] ] }, { "id": "891156c8cda201c2", "type": "function", "z": "5fbd144406d1efae", "name": "func", "func": "if (msg.reset_chart) {\n msg.payload = []\n} else {\n msg.payload = msg.value\n}\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1250, "y": 680, "wires": [ [ "9f08e9344b819e1c" ] ] }, { "id": "e740cccb9a4d808d", "type": "comment", "z": "5fbd144406d1efae", "name": "Group 1", "info": "", "x": 180, "y": 340, "wires": [] }, { "id": "1679b29559e680f1", "type": "comment", "z": "5fbd144406d1efae", "name": "Group 2", "info": "", "x": 580, "y": 340, "wires": [] }, { "id": "6e84ed16f0d6a2d4", "type": "comment", "z": "5fbd144406d1efae", "name": "Group 3", "info": "", "x": 900, "y": 340, "wires": [] }, { "id": "303121339628c117", "type": "comment", "z": "5fbd144406d1efae", "name": "Group 4", "info": "", "x": 1300, "y": 340, "wires": [] }, { "id": "4c986a9e4f2f5c95", "type": "catch", "z": "5fbd144406d1efae", "name": "", "scope": [ "f4b57b71c66bba4a", "d76c87b57ebd2e5c" ], "uncaught": false, "x": 630, "y": 100, "wires": [ [ "62bec116d80963fa" ] ] }, { "id": "62bec116d80963fa", "type": "change", "z": "5fbd144406d1efae", "name": "", "rules": [ { "t": "set", "p": "sensors", "pt": "msg", "to": "[]", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 780, "y": 100, "wires": [ [ "158f406b21994ddd" ] ] }, { "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 } ]