Created
January 3, 2019 20:18
-
-
Save Programie/6bc6739a6cd1b5761ea273a3e82e91d3 to your computer and use it in GitHub Desktop.
Node-RED Flow for sending data from Loxone Miniserver to InfluxDB
This file contains 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": "77643d95.63b8d4", | |
"type": "tab", | |
"label": "Loxone", | |
"disabled": false, | |
"info": "" | |
}, | |
{ | |
"id": "c7f2764c.9bda68", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Store data in context", | |
"func": "var data = context.get(\"data\") || {};\n\nif (msg.topic == \"TriggerFlow\") {\n return {\n payload: data\n };\n} else {\n if (msg.state == \"value\" && msg.type == \"InfoOnlyAnalog\") {\n if (msg.room == \"Outside\") {\n area = \"Outside\";\n room = \"\";\n } else {\n area = \"OG\";\n room = msg.room;\n }\n \n if (!data.hasOwnProperty(area)) {\n data[area] = {};\n }\n \n if (!data[area].hasOwnProperty(room)) {\n data[area][room] = {};\n }\n \n data[area][room][msg.topic] = msg.payload;\n \n context.set(\"data\", data);\n }\n \n return null;\n}", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 560, | |
"y": 60, | |
"wires": [ | |
[ | |
"c4a2cb66.011d98" | |
] | |
] | |
}, | |
{ | |
"id": "4154e867.b0cfa8", | |
"type": "inject", | |
"z": "77643d95.63b8d4", | |
"name": "Trigger", | |
"topic": "TriggerFlow", | |
"payload": "", | |
"payloadType": "date", | |
"repeat": "60", | |
"crontab": "", | |
"once": false, | |
"x": 360, | |
"y": 40, | |
"wires": [ | |
[ | |
"c7f2764c.9bda68" | |
] | |
] | |
}, | |
{ | |
"id": "e60470d9.6d8b2", | |
"type": "loxone-stream-in", | |
"z": "77643d95.63b8d4", | |
"name": "Temperature", | |
"miniserver": "1809d785.776fc8", | |
"category": "0bb1a8a0-00cc-0293-ffff504f94000000", | |
"room": "", | |
"x": 350, | |
"y": 80, | |
"wires": [ | |
[ | |
"c7f2764c.9bda68" | |
] | |
] | |
}, | |
{ | |
"id": "a7ae7cc9.4f1a", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Store data in context", | |
"func": "var data = context.get(\"data\") || {};\n\nif (msg.topic == \"TriggerFlow\") {\n return {\n payload: data\n };\n} else {\n if (msg.state == \"value\" && msg.type == \"InfoOnlyAnalog\") {\n if (msg.room == \"Outside\") {\n area = \"Outside\";\n room = \"\";\n } else {\n area = \"EG\";\n room = msg.room;\n }\n \n if (!data.hasOwnProperty(area)) {\n data[area] = {};\n }\n \n if (!data[area].hasOwnProperty(room)) {\n data[area][room] = {};\n }\n \n data[area][room][msg.topic] = msg.payload;\n \n context.set(\"data\", data);\n }\n \n return null;\n}", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 560, | |
"y": 180, | |
"wires": [ | |
[ | |
"c4a2cb66.011d98" | |
] | |
] | |
}, | |
{ | |
"id": "e89d0426.e2b848", | |
"type": "loxone-stream-in", | |
"z": "77643d95.63b8d4", | |
"name": "Temperature", | |
"miniserver": "d347e4df.ac7098", | |
"category": "104e86a3-03c1-07a9-ffffeaf8dac44729", | |
"room": "", | |
"x": 350, | |
"y": 200, | |
"wires": [ | |
[ | |
"a7ae7cc9.4f1a" | |
] | |
] | |
}, | |
{ | |
"id": "5cb271c1.83042", | |
"type": "inject", | |
"z": "77643d95.63b8d4", | |
"name": "Trigger", | |
"topic": "TriggerFlow", | |
"payload": "", | |
"payloadType": "date", | |
"repeat": "60", | |
"crontab": "", | |
"once": false, | |
"x": 360, | |
"y": 160, | |
"wires": [ | |
[ | |
"a7ae7cc9.4f1a" | |
] | |
] | |
}, | |
{ | |
"id": "d5dabe29.c033f", | |
"type": "influxdb out", | |
"z": "77643d95.63b8d4", | |
"influxdb": "6cabc6b4.5c3a58", | |
"name": "Temperature", | |
"measurement": "Temperature", | |
"precision": "", | |
"retentionPolicy": "", | |
"x": 970, | |
"y": 120, | |
"wires": [] | |
}, | |
{ | |
"id": "c4a2cb66.011d98", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Tag Payload", | |
"func": "var points = [];\n\nfor (var area in msg.payload) {\n for (var room in msg.payload[area]) {\n for (var name in msg.payload[area][room]) {\n points.push([\n {\n value: msg.payload[area][room][name]\n },\n {\n \"area\": area,\n \t \"room\": room === \"\" ? null : room,\n \t \"name\": name\n }\n ]);\n }\n }\n}\n\nreturn {\n payload: points\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 790, | |
"y": 120, | |
"wires": [ | |
[ | |
"d5dabe29.c033f" | |
] | |
] | |
}, | |
{ | |
"id": "ca824668.ae04d8", | |
"type": "loxone-stream-in", | |
"z": "77643d95.63b8d4", | |
"name": "Temperature", | |
"miniserver": "d347e4df.ac7098", | |
"category": "104e86a3-03c1-07b9-ffffeaf8dac44729", | |
"room": "10b09479-0301-d7f0-ffffeaf8dac44729", | |
"x": 150, | |
"y": 260, | |
"wires": [ | |
[ | |
"25d9044a.231bbc" | |
] | |
] | |
}, | |
{ | |
"id": "25d9044a.231bbc", | |
"type": "change", | |
"z": "77643d95.63b8d4", | |
"name": "", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "room", | |
"pt": "msg", | |
"to": "Electric distribution", | |
"tot": "str" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 340, | |
"y": 260, | |
"wires": [ | |
[ | |
"a7ae7cc9.4f1a" | |
] | |
] | |
}, | |
{ | |
"id": "3b9e5e6.0534fa2", | |
"type": "loxone-stream-in", | |
"z": "77643d95.63b8d4", | |
"name": "Heating", | |
"miniserver": "1809d785.776fc8", | |
"category": "0bb1a8a0-00bc-027f-ffff504f94000000", | |
"room": "", | |
"x": 110, | |
"y": 420, | |
"wires": [ | |
[ | |
"ac999f0.b2ad26" | |
] | |
] | |
}, | |
{ | |
"id": "ac999f0.b2ad26", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Store data in context", | |
"func": "var area = \"OG\";\n\nvar wantedStates = [\n \"tempTarget\",\n \"valveCool\",\n \"valveHeat\"\n];\n\nvar data = context.get(\"data\") || {};\n\nif (msg.topic == \"TriggerFlow\") {\n return {\n payload: data\n };\n} else {\n if (wantedStates.indexOf(msg.state) != -1 && msg.type == \"IRoomController\") {\n if (!data.hasOwnProperty(area)) {\n data[area] = {};\n }\n \n if (!data[area].hasOwnProperty(msg.room)) {\n data[area][msg.room] = {};\n }\n \n if (!data[area][msg.room].hasOwnProperty(msg.topic)) {\n data[area][msg.room][msg.topic] = {};\n }\n \n data[area][msg.room][msg.topic][msg.state] = msg.payload;\n \n context.set(\"data\", data);\n }\n \n return null;\n}", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 320, | |
"y": 400, | |
"wires": [ | |
[ | |
"dae34be.a49b4b8" | |
] | |
] | |
}, | |
{ | |
"id": "6957ed33.24bc44", | |
"type": "inject", | |
"z": "77643d95.63b8d4", | |
"name": "Trigger", | |
"topic": "TriggerFlow", | |
"payload": "", | |
"payloadType": "date", | |
"repeat": "60", | |
"crontab": "", | |
"once": false, | |
"x": 100, | |
"y": 380, | |
"wires": [ | |
[ | |
"ac999f0.b2ad26" | |
] | |
] | |
}, | |
{ | |
"id": "dae34be.a49b4b8", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Tag Payload", | |
"func": "var points = [];\n\nfor (var area in msg.payload) {\n for (var room in msg.payload[area]) {\n for (var name in msg.payload[area][room]) {\n for (var type in msg.payload[area][room][name]) {\n points.push([\n {\n value: msg.payload[area][room][name][type]\n },\n {\n \"area\": area,\n \t \"room\": room,\n \t \"name\": name,\n \t \"type\": type\n }\n ]);\n }\n }\n }\n}\n\nreturn {\n payload: points\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 530, | |
"y": 460, | |
"wires": [ | |
[ | |
"4c2f0698.96ea58" | |
] | |
] | |
}, | |
{ | |
"id": "4c2f0698.96ea58", | |
"type": "influxdb out", | |
"z": "77643d95.63b8d4", | |
"influxdb": "6cabc6b4.5c3a58", | |
"name": "Heating", | |
"measurement": "Heating", | |
"precision": "", | |
"retentionPolicy": "", | |
"x": 700, | |
"y": 460, | |
"wires": [] | |
}, | |
{ | |
"id": "bb3c4a49.0816f8", | |
"type": "loxone-stream-in", | |
"z": "77643d95.63b8d4", | |
"name": "Heating", | |
"miniserver": "d347e4df.ac7098", | |
"category": "104e86a3-03c1-07a9-ffffeaf8dac44729", | |
"room": "", | |
"x": 110, | |
"y": 540, | |
"wires": [ | |
[ | |
"5c8f95d7.4d7fec" | |
] | |
] | |
}, | |
{ | |
"id": "5c8f95d7.4d7fec", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Store data in context", | |
"func": "var area = \"EG\";\n\nvar wantedStates = [\n \"tempTarget\",\n \"valveCool\",\n \"valveHeat\"\n];\n\nvar data = context.get(\"data\") || {};\n\nif (msg.topic == \"TriggerFlow\") {\n return {\n payload: data\n };\n} else {\n if (wantedStates.indexOf(msg.state) != -1 && msg.type == \"IRoomController\") {\n if (!data.hasOwnProperty(area)) {\n data[area] = {};\n }\n \n if (!data[area].hasOwnProperty(msg.room)) {\n data[area][msg.room] = {};\n }\n \n if (!data[area][msg.room].hasOwnProperty(msg.topic)) {\n data[area][msg.room][msg.topic] = {};\n }\n \n data[area][msg.room][msg.topic][msg.state] = msg.payload;\n \n context.set(\"data\", data);\n }\n \n return null;\n}", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 320, | |
"y": 520, | |
"wires": [ | |
[ | |
"dae34be.a49b4b8" | |
] | |
] | |
}, | |
{ | |
"id": "c150c041.e3bbf", | |
"type": "inject", | |
"z": "77643d95.63b8d4", | |
"name": "Trigger", | |
"topic": "TriggerFlow", | |
"payload": "", | |
"payloadType": "date", | |
"repeat": "60", | |
"crontab": "", | |
"once": false, | |
"x": 100, | |
"y": 500, | |
"wires": [ | |
[ | |
"5c8f95d7.4d7fec" | |
] | |
] | |
}, | |
{ | |
"id": "38751a8c.b61f86", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Store data in context", | |
"func": "var data = context.get(\"data\") || {};\n\nif (msg.topic == \"TriggerFlow\") {\n return {\n payload: data\n };\n} else {\n var location;\n \n switch (msg.topic) {\n case \"Brightness (Solar Sensor)\":\n location = \"Garage roof\";\n break;\n case \"Brightness\":\n location = \"Balcony\";\n break;\n default:\n return null;\n }\n \n data[location] = msg.payload;\n \n context.set(\"data\", data);\n \n return null;\n}", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 400, | |
"y": 940, | |
"wires": [ | |
[ | |
"dbf26dc5.ee3c5" | |
] | |
] | |
}, | |
{ | |
"id": "b800d11.107263", | |
"type": "inject", | |
"z": "77643d95.63b8d4", | |
"name": "Trigger", | |
"topic": "TriggerFlow", | |
"payload": "", | |
"payloadType": "date", | |
"repeat": "60", | |
"crontab": "", | |
"once": false, | |
"x": 180, | |
"y": 900, | |
"wires": [ | |
[ | |
"38751a8c.b61f86" | |
] | |
] | |
}, | |
{ | |
"id": "6cfffd36.71afd4", | |
"type": "loxone-control-in", | |
"z": "77643d95.63b8d4", | |
"name": "Solar radiation", | |
"miniserver": "1809d785.776fc8", | |
"control": "0fd65419-017e-4bad-ffff504f94000000", | |
"state": "0fd65419-017e-4bad-ffff504f94000000", | |
"x": 170, | |
"y": 660, | |
"wires": [ | |
[ | |
"528ccddf.1339f4" | |
] | |
] | |
}, | |
{ | |
"id": "c8580a00.bbef78", | |
"type": "loxone-control-in", | |
"z": "77643d95.63b8d4", | |
"name": "Brightness (Balcony)", | |
"miniserver": "1809d785.776fc8", | |
"control": "0f6b11d8-009c-dc13-ffff504f94000000", | |
"state": "0f6b11d8-009c-dc13-ffff504f94000000", | |
"x": 150, | |
"y": 940, | |
"wires": [ | |
[ | |
"38751a8c.b61f86" | |
] | |
] | |
}, | |
{ | |
"id": "d1fbe124.d691a", | |
"type": "loxone-control-in", | |
"z": "77643d95.63b8d4", | |
"name": "Brightness (Garage roof)", | |
"miniserver": "1809d785.776fc8", | |
"control": "0fd68a6b-0388-6d23-ffff504f94000000", | |
"state": "0fd68a6b-0388-6d23-ffff504f94000000", | |
"x": 130, | |
"y": 980, | |
"wires": [ | |
[ | |
"38751a8c.b61f86" | |
] | |
] | |
}, | |
{ | |
"id": "dbf26dc5.ee3c5", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Tag Payload", | |
"func": "var points = [];\n\nfor (var location in msg.payload) {\n points.push([\n {\n value: msg.payload[location]\n },\n {\n \"location\": location\n }\n ]);\n}\n\nreturn {\n payload: points\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 610, | |
"y": 940, | |
"wires": [ | |
[ | |
"b6a99c52.66e08" | |
] | |
] | |
}, | |
{ | |
"id": "b6a99c52.66e08", | |
"type": "influxdb out", | |
"z": "77643d95.63b8d4", | |
"influxdb": "6cabc6b4.5c3a58", | |
"name": "Brightness", | |
"measurement": "Brightness", | |
"precision": "", | |
"retentionPolicy": "", | |
"x": 790, | |
"y": 940, | |
"wires": [] | |
}, | |
{ | |
"id": "528ccddf.1339f4", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Store data in context", | |
"func": "var data = context.get(\"data\") || {};\n\nif (msg.topic == \"TriggerFlow\") {\n return {\n payload: data\n };\n} else {\n var type;\n \n switch (msg.topic) {\n case \"Solar radiation\":\n type = \"current\";\n break;\n case \"Corrected solar radiation\":\n type = \"current_corrected\";\n break;\n default:\n return null;\n }\n \n data[type] = msg.payload;\n \n context.set(\"data\", data);\n \n return null;\n}", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 400, | |
"y": 660, | |
"wires": [ | |
[ | |
"697a99e3.fdbbd8" | |
] | |
] | |
}, | |
{ | |
"id": "ba1da8f4.58fd78", | |
"type": "influxdb out", | |
"z": "77643d95.63b8d4", | |
"influxdb": "6cabc6b4.5c3a58", | |
"name": "Solar radiation", | |
"measurement": "Solar_radiation", | |
"precision": "", | |
"retentionPolicy": "", | |
"x": 800, | |
"y": 660, | |
"wires": [] | |
}, | |
{ | |
"id": "af081374.cb1d7", | |
"type": "inject", | |
"z": "77643d95.63b8d4", | |
"name": "Trigger", | |
"topic": "TriggerFlow", | |
"payload": "", | |
"payloadType": "date", | |
"repeat": "60", | |
"crontab": "", | |
"once": false, | |
"x": 180, | |
"y": 620, | |
"wires": [ | |
[ | |
"528ccddf.1339f4" | |
] | |
] | |
}, | |
{ | |
"id": "e585caf4.ffeb88", | |
"type": "loxone-control-in", | |
"z": "77643d95.63b8d4", | |
"name": "Corrected solar radiation", | |
"miniserver": "1809d785.776fc8", | |
"control": "11ceb001-01a9-05e4-ffff504f94000000", | |
"state": "11ceb001-01a9-05e4-ffff504f94000000", | |
"x": 130, | |
"y": 700, | |
"wires": [ | |
[ | |
"528ccddf.1339f4" | |
] | |
] | |
}, | |
{ | |
"id": "697a99e3.fdbbd8", | |
"type": "function", | |
"z": "77643d95.63b8d4", | |
"name": "Tag Payload", | |
"func": "var points = [];\n\nfor (var type in msg.payload) {\n points.push([\n {\n value: msg.payload[type]\n },\n {\n \"type\": type\n }\n ]);\n}\n\nreturn {\n payload: points\n};", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 610, | |
"y": 660, | |
"wires": [ | |
[ | |
"ba1da8f4.58fd78" | |
] | |
] | |
}, | |
{ | |
"id": "1809d785.776fc8", | |
"type": "loxone-miniserver", | |
"z": "", | |
"host": "miniserver-1", | |
"port": "80", | |
"enctype": "0", | |
"active": true | |
}, | |
{ | |
"id": "d347e4df.ac7098", | |
"type": "loxone-miniserver", | |
"z": "", | |
"host": "miniserver-2", | |
"port": "80", | |
"enctype": "0", | |
"active": true | |
}, | |
{ | |
"id": "6cabc6b4.5c3a58", | |
"type": "influxdb", | |
"z": "", | |
"hostname": "influxdb-host", | |
"port": "8086", | |
"protocol": "http", | |
"database": "loxone", | |
"name": "Loxone", | |
"usetls": false, | |
"tls": "" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment