From 890197c01979060b06a470b8f0b4d047e9ee9161 Mon Sep 17 00:00:00 2001 From: rxf Date: Fri, 3 Jul 2026 17:05:30 +0200 Subject: [PATCH] Daten in InfluxDB: Anpassung an das neue MQTT-Protokoll der go-e --- flows.json | 212 +++++++++++++++++------------------------------------ 1 file changed, 67 insertions(+), 145 deletions(-) diff --git a/flows.json b/flows.json index 92d4d52..576ac3a 100644 --- a/flows.json +++ b/flows.json @@ -451,7 +451,7 @@ "id": "d28e11d867e00655", "type": "junction", "z": "85bb16dbe6fb391c", - "x": 1320, + "x": 1180, "y": 2180, "wires": [ [ @@ -1841,7 +1841,7 @@ "type": "mqtt in", "z": "86a9e7aa0c304b46", "name": "", - "topic": "go-eCharger/010343/status", + "topic": "go-eCharger/310014/#", "qos": "0", "datatype": "auto-detect", "broker": "c46833d59903b816", @@ -1849,12 +1849,12 @@ "rap": true, "rh": 0, "inputs": 0, - "x": 280, + "x": 260, "y": 1660, "wires": [ [ - "b602d56c5ecdf7fc", - "74e21176399f1d13" + "74e21176399f1d13", + "b602d56c5ecdf7fc" ] ] }, @@ -1863,7 +1863,7 @@ "type": "debug", "z": "86a9e7aa0c304b46", "name": "debug 6", - "active": false, + "active": true, "tosidebar": true, "console": false, "tostatus": false, @@ -1879,8 +1879,9 @@ "type": "function", "z": "86a9e7aa0c304b46", "name": "daten vorbereiten", - "func": "let zustand = parseInt(msg.payload.car)\nif ((zustand > 1) && (zustand <= 4)) {\n let strom = [msg.payload.nrg[4], msg.payload.nrg[5], msg.payload.nrg[6]]\n let power = [msg.payload.nrg[7], msg.payload.nrg[8], msg.payload.nrg[9], msg.payload.nrg[11]]\n msg.payload = { \"I1\": strom[0], \"I2\": strom[1], \"I3\": strom[2], \"P1\": power[0], \"P2\": power[1], \"P3\": power[2], \"Ptot\": power[3], \"gesamt\": parseInt(msg.payload.eto)}\n return msg;\n}", + "func": "// Topic-Teil extrahieren, z.B. \"go-eCharger/310014/nrg\" -> \"nrg\"\nif (![\"car\", \"nrg\", \"eto\"].includes(msg.topic.split(\"/\").pop())) {\n return null;\n} \nlet key = msg.topic.split(\"/\").pop();\n\n// letzten bekannten Wert je Key im Node-Context speichern\nlet daten = context.get(\"daten\") || {};\ndaten[key] = msg.payload;\ncontext.set(\"daten\", daten);\n\n// Nur weitermachen, wenn wir car, nrg und eto schon mindestens einmal gesehen haben\nif (daten.car === undefined || daten.nrg === undefined || daten.eto === undefined) {\n return null;\n}\n\nlet zustand = parseInt(daten.car);\n\nif ((zustand > 1) && (zustand <= 4)) {\n let nrg = daten.nrg;\n\n if (!Array.isArray(nrg) || nrg.length < 12) {\n node.warn(\"nrg unvollständig: \" + JSON.stringify(nrg));\n return null;\n }\n\n msg.payload = {\n I1: nrg[4], I2: nrg[5], I3: nrg[6],\n P1: nrg[7], P2: nrg[8], P3: nrg[9],\n Ptot: nrg[11],\n gesamt: parseInt(daten.eto)\n };\n return msg;\n}\n\nreturn null;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", @@ -3064,7 +3065,8 @@ "tosidebar": true, "console": false, "tostatus": false, - "complete": "false", + "complete": "true", + "targetType": "full", "statusVal": "", "statusType": "auto", "x": 540, @@ -6958,6 +6960,7 @@ "name": "function 34", "func": "msg.debug = { \"down\": flow.get(\"mv_down\"), \"up\": flow.get(\"mv_up\") }\nif (flow.get(\"mv_down\")) {\n flow.set(\"mv_down\", false)\n msg.payload = {\"state\": \"STOP\"}\n} else {\n flow.set(\"mv_down\", true)\n flow.set(\"mv_up\", false)\n msg.payload = { \"state\": \"CLOSE\" }\n}\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", @@ -6994,7 +6997,7 @@ "type": "debug", "z": "85bb16dbe6fb391c", "name": "debug 120", - "active": true, + "active": false, "tosidebar": true, "console": false, "tostatus": false, @@ -7011,7 +7014,7 @@ "type": "debug", "z": "85bb16dbe6fb391c", "name": "debug 121", - "active": true, + "active": false, "tosidebar": true, "console": false, "tostatus": false, @@ -7027,7 +7030,7 @@ "type": "debug", "z": "85bb16dbe6fb391c", "name": "debug 122", - "active": true, + "active": false, "tosidebar": true, "console": false, "tostatus": false, @@ -7186,7 +7189,7 @@ "type": "debug", "z": "85bb16dbe6fb391c", "name": "debug 127", - "active": true, + "active": false, "tosidebar": true, "console": false, "tostatus": false, @@ -7202,7 +7205,7 @@ "type": "debug", "z": "85bb16dbe6fb391c", "name": "debug 128", - "active": true, + "active": false, "tosidebar": true, "console": false, "tostatus": false, @@ -7218,7 +7221,7 @@ "type": "debug", "z": "85bb16dbe6fb391c", "name": "debug 129", - "active": true, + "active": false, "tosidebar": true, "console": false, "tostatus": false, @@ -7291,65 +7294,6 @@ "y": 2020, "wires": [] }, - { - "id": "1b3f2482868d365c", - "type": "mqtt in", - "z": "85bb16dbe6fb391c", - "name": "", - "topic": "hm/status/#", - "qos": "2", - "datatype": "auto-detect", - "broker": "c46833d59903b816", - "nl": false, - "rap": true, - "rh": 0, - "inputs": 0, - "x": 290, - "y": 2200, - "wires": [ - [ - "6d1949c48f1432b0", - "1b13d8e6d4278579" - ] - ] - }, - { - "id": "3289b7e058d79737", - "type": "switch", - "z": "85bb16dbe6fb391c", - "name": "", - "property": "topic", - "propertyType": "msg", - "rules": [ - { - "t": "regex", - "v": "hm/status/Fernbedienung_WZ:4/PRESS_SHORT", - "vt": "str", - "case": false - }, - { - "t": "regex", - "v": "hm/status/Fernbedienung_WZ:3/PRESS_SHORT", - "vt": "str", - "case": false - } - ], - "checkall": "true", - "repair": false, - "outputs": 2, - "x": 830, - "y": 2200, - "wires": [ - [ - "6c1cf4bdaba813e2", - "cda63c1cf0b7f671" - ], - [ - "1819ea0b09240e1c", - "3cb17e998bc9c005" - ] - ] - }, { "id": "8648665e86d3093c", "type": "comment", @@ -7397,12 +7341,13 @@ "name": "function 43", "func": "if (flow.get(\"mv_downWg\")) {\n flow.set(\"mv_downWg\", false)\n msg.payload = {\"state\": \"STOP\"}\n} else {\n flow.set(\"mv_downWg\", true)\n msg.payload = { \"state\": \"CLOSE\" }\n}\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "x": 1110, - "y": 2160, + "x": 970, + "y": 2180, "wires": [ [ "d28e11d867e00655" @@ -7416,12 +7361,13 @@ "name": "function 44", "func": "if (flow.get(\"mv_upWg\")) {\n flow.set(\"mv_upWg\", false)\n msg.payload = {\"state\": \"STOP\"}\n} else {\n flow.set(\"mv_upWg\", true)\n msg.payload = { \"state\": \"OPEN\" }\n}\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "x": 1110, - "y": 2220, + "x": 970, + "y": 2240, "wires": [ [ "d28e11d867e00655" @@ -7444,54 +7390,6 @@ "y": 2080, "wires": [] }, - { - "id": "cda63c1cf0b7f671", - "type": "debug", - "z": "85bb16dbe6fb391c", - "name": "debug 140", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "false", - "statusVal": "", - "statusType": "auto", - "x": 1090, - "y": 2060, - "wires": [] - }, - { - "id": "3cb17e998bc9c005", - "type": "debug", - "z": "85bb16dbe6fb391c", - "name": "debug 141", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "false", - "statusVal": "", - "statusType": "auto", - "x": 1110, - "y": 2300, - "wires": [] - }, - { - "id": "6d1949c48f1432b0", - "type": "debug", - "z": "85bb16dbe6fb391c", - "name": "debug 142", - "active": false, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "false", - "statusVal": "", - "statusType": "auto", - "x": 470, - "y": 2300, - "wires": [] - }, { "id": "c3553c69292506a3", "type": "mqtt out", @@ -7675,25 +7573,6 @@ "y": 20, "wires": [] }, - { - "id": "1b13d8e6d4278579", - "type": "function", - "z": "85bb16dbe6fb391c", - "name": "block first message", - "func": "// function node\nlet alreadySeen = context.get(\"alreadySeen\") || false;\n\nif (!alreadySeen) {\n // erste Message blockieren\n context.set(\"alreadySeen\", true);\n return null;\n} else {\n // alle weiteren durchlassen\n return msg;\n}\n", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 570, - "y": 2200, - "wires": [ - [ - "3289b7e058d79737" - ] - ] - }, { "id": "24f6d467e40e1f52", "type": "mqtt in", @@ -7896,7 +7775,7 @@ "type": "debug", "z": "85bb16dbe6fb391c", "name": "debug 195", - "active": true, + "active": false, "tosidebar": true, "console": false, "tostatus": false, @@ -7939,6 +7818,7 @@ "name": "function 72", "func": "let moving = flow.get(\"szk_move\")\nif (moving) {\n msg.topic = \"hm/set/Rollladen_SZ_klein:1/STOP\"\n msg.payload = true\n} else {\n msg.topic = \"hm/set/Rollladen_SZ_klein:1/LEVEL\"\n}\nreturn msg", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", @@ -7951,6 +7831,48 @@ ] ] }, + { + "id": "23a02845bc2a2190", + "type": "mqtt in", + "z": "85bb16dbe6fb391c", + "name": "", + "topic": "hm/status/Fernbedienung_WZ:3/PRESS_SHORT", + "qos": "2", + "datatype": "auto-detect", + "broker": "c46833d59903b816", + "nl": false, + "rap": true, + "rh": 0, + "inputs": 0, + "x": 420, + "y": 2240, + "wires": [ + [ + "1819ea0b09240e1c" + ] + ] + }, + { + "id": "411d770f1a558990", + "type": "mqtt in", + "z": "85bb16dbe6fb391c", + "name": "", + "topic": "hm/status/Fernbedienung_WZ:4/PRESS_SHORT", + "qos": "2", + "datatype": "auto-detect", + "broker": "c46833d59903b816", + "nl": false, + "rap": true, + "rh": 0, + "inputs": 0, + "x": 420, + "y": 2180, + "wires": [ + [ + "6c1cf4bdaba813e2" + ] + ] + }, { "id": "9e617dec92526da1", "type": "comment",