Nulleinspeisung OpenDTU-NodeRed-IObroker

Hallo zusammen,

ich bin ganz neu hier, versuche aber schon seit einer Weile einer Nulleinspeisung mit Node Red - OpenDTU - Shelly3EM und dem IObroker umzusetzen.
Bislang jedoch erfolglos…

Den Shelly kann ich problemlos über NodeRed auslesen, das klappt. Ich lasse mir so positive (also Netzbezug) und negative (also Einspeisung) ausgeben. Die Werte passen soweit auch.
Die nächste Funktion schaut dann, ob der Wert positiv oder negativ ist und passt das das Limit absolut entsprechend an. Der Ausgang erfolgt über den MQTT out Befehl.

Ich hab absolut keine Ahnung, warum das so noch nicht funktioniert, ggf habt Ihr ja ne Idee oder findet meinen Gedankenfehler!

hier mal mein Flow dazu:

 [
    {
        "id": "7cdac530d32ba507",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "8e176a220e935989",
        "type": "shelly-gen2",
        "z": "7cdac530d32ba507",
        "hostname": "192.168.178.36",
        "description": "",
        "mode": "polling",
        "server": "",
        "outputmode": "event",
        "uploadretryinterval": 5000,
        "pollinginterval": "10000",
        "pollstatus": true,
        "getstatusoncommand": true,
        "devicetype": "Measure",
        "outputs": 1,
        "x": 340,
        "y": 280,
        "wires": [
            [
                "83bded644316d034"
            ]
        ]
    },
    {
        "id": "83bded644316d034",
        "type": "change",
        "z": "7cdac530d32ba507",
        "name": "Gesamtbezug Haus",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.em0.total_act_power",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 280,
        "wires": [
            [
                "4377c2003e48c9f5",
                "3f0ef3e6ef837c5c"
            ]
        ]
    },
    {
        "id": "4377c2003e48c9f5",
        "type": "debug",
        "z": "7cdac530d32ba507",
        "name": "debug 8",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 840,
        "y": 180,
        "wires": []
    },
    {
        "id": "862de5812d352aab",
        "type": "mqtt out",
        "z": "7cdac530d32ba507",
        "name": "",
        "topic": "hm1600/116491954071/status/limit_absolute",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "1467dfeaad9c21b5",
        "x": 1430,
        "y": 280,
        "wires": []
    },
    {
        "id": "3f0ef3e6ef837c5c",
        "type": "switch",
        "z": "7cdac530d32ba507",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gt",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "lt",
                "v": "0",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 870,
        "y": 280,
        "wires": [
            [
                "0f811dc91d812035"
            ],
            [
                "3300786202218c43"
            ]
        ]
    },
    {
        "id": "0f811dc91d812035",
        "type": "trigger",
        "z": "7cdac530d32ba507",
        "name": "",
        "op1": "1000",
        "op2": "800",
        "op1type": "num",
        "op2type": "flow",
        "duration": "-5",
        "extend": false,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 1100,
        "y": 240,
        "wires": [
            [
                "862de5812d352aab"
            ]
        ]
    },
    {
        "id": "47f400e78a038d25",
        "type": "mqtt in",
        "z": "7cdac530d32ba507",
        "name": "",
        "topic": "hm1600/116491954071/status/limit_absolute",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "1467dfeaad9c21b5",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 290,
        "y": 480,
        "wires": [
            [
                "18a6d95c2b4c3c28"
            ]
        ]
    },
    {
        "id": "18a6d95c2b4c3c28",
        "type": "debug",
        "z": "7cdac530d32ba507",
        "name": "debug 9",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 620,
        "y": 480,
        "wires": []
    },
    {
        "id": "3300786202218c43",
        "type": "trigger",
        "z": "7cdac530d32ba507",
        "name": "",
        "op1": "500",
        "op2": "500",
        "op1type": "num",
        "op2type": "flow",
        "duration": "-5",
        "extend": false,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 1100,
        "y": 320,
        "wires": [
            [
                "862de5812d352aab"
            ]
        ]
    },
    {
        "id": "0371ca652c2afdf4",
        "type": "delay",
        "z": "7cdac530d32ba507",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 200,
        "y": 160,
        "wires": [
            [
                "8e176a220e935989"
            ]
        ]
    },
    {
        "id": "1467dfeaad9c21b5",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.178.93",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

:crayon:by HarryP: Codezeilen formatiert (bitte immer über </> einbinden)

Moin mien Jung (oder mien Deern),
zum Thema Nulleinspeisung mit Open- oder Ahoy-DTU und NodeRed gibt es hier schon einiges, einfach die SuFu mal bemühen.
Ob das Ganze dann auch im IOBroker funktioniert kann ich dir aber nicht sagen.

Grüße
LL

Der Mqtt-Befehl müsste “hm1600/116491954071/cmd/limit_nonpersistent_absolute” heißen.
Auch wird das Ganze über den Broker versendet, nicht direkt an die DTU. Also die IP muss vom IoBroker sein, nicht von der DTU. Wenn du Sicherheitsdaten für den Mqtt-Broker vergeben hast, musst du diese auch in den Mqtt-Befehl eintragen.

Des weiteren würde ich eine dynamische Regelung machen und keine festen Werte.
Noch einfacher wäre auf Homeassistant umzusteigen, oder das Ganze komplett umgehen und die Nulleinspeisung direkt mit der DTU machen. Siehe hier.: helgeerbe/OpenDTU-OnBattery: Software for ESP32 to talk to Hoymiles Inverters and Victrons MPPT battery chargers (Ve.Direct) (github.com)

Guten Abend zusammen,

vielen Dank dafür, das setzen des Limits klappt nun schon mal.
Solange ich nun einen positiven Netzbezug habe, also etwas “ziehe”, wird das Limit auf max. also 1.600 Watt gesetzt.
Nun möchte ich, sobald ich “einspeise” folgendes machen:

  • Abfrage, wieviel aktuell eingespeist wird → Wert 1
  • Abfrage, wieviel Leistung die PV-Anlage aktuell bringt → Wert 2
  • Berechung Limit NEU: Wert 2 - Wert 1

Das Ganze soll z.B. einmal pro Minute erfolgen.

Was ich aktuell nicht hinbekomme ist die werte 1 und 2 zu berechnen bzw. in einer msg zu speichern. Über die Inject Funktion klappt die Berechnung jedoch.
Könnt Ihr mir hier evtl. weiterhelfen?
Ich glaube, dass ich die Werte falsch von den Vorgängern übernehme, habe jedoch auch nach vielem probieren keine Idee woran es liegen könnte.

Im folgenden mal mein Flow:

[
    {
        "id": "7cdac530d32ba507",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "8e176a220e935989",
        "type": "shelly-gen2",
        "z": "7cdac530d32ba507",
        "hostname": "192.168.178.36",
        "description": "",
        "mode": "polling",
        "server": "",
        "outputmode": "event",
        "uploadretryinterval": 5000,
        "pollinginterval": "10000",
        "pollstatus": true,
        "getstatusoncommand": true,
        "devicetype": "Measure",
        "outputs": 1,
        "x": 160,
        "y": 280,
        "wires": [
            [
                "4cfeba5c6545fa13",
                "ad6d58fafc3f123b"
            ]
        ]
    },
    {
        "id": "4377c2003e48c9f5",
        "type": "debug",
        "z": "7cdac530d32ba507",
        "name": "Netzbezug Shelly",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 690,
        "y": 180,
        "wires": []
    },
    {
        "id": "862de5812d352aab",
        "type": "mqtt out",
        "z": "7cdac530d32ba507",
        "name": "",
        "topic": "hm1600/116491954071/cmd/limit_nonpersistent_absolute",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "1467dfeaad9c21b5",
        "x": 1410,
        "y": 340,
        "wires": []
    },
    {
        "id": "3f0ef3e6ef837c5c",
        "type": "switch",
        "z": "7cdac530d32ba507",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gt",
                "v": "0",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 670,
        "y": 280,
        "wires": [
            [
                "0f811dc91d812035"
            ]
        ]
    },
    {
        "id": "0f811dc91d812035",
        "type": "trigger",
        "z": "7cdac530d32ba507",
        "name": "Netzbezug >0",
        "op1": "1600",
        "op2": "1600",
        "op1type": "num",
        "op2type": "num",
        "duration": "0",
        "extend": false,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 840,
        "y": 280,
        "wires": [
            [
                "0371ca652c2afdf4"
            ]
        ]
    },
    {
        "id": "47f400e78a038d25",
        "type": "mqtt in",
        "z": "7cdac530d32ba507",
        "name": "",
        "topic": "hm1600/116491954071/status/limit_absolute",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "1467dfeaad9c21b5",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 270,
        "y": 720,
        "wires": [
            [
                "18a6d95c2b4c3c28"
            ]
        ]
    },
    {
        "id": "18a6d95c2b4c3c28",
        "type": "debug",
        "z": "7cdac530d32ba507",
        "name": "WR Limit",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 720,
        "wires": []
    },
    {
        "id": "0371ca652c2afdf4",
        "type": "delay",
        "z": "7cdac530d32ba507",
        "name": "",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "minutes",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "minute",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1080,
        "y": 340,
        "wires": [
            [
                "862de5812d352aab"
            ]
        ]
    },
    {
        "id": "f0aeb123484ad392",
        "type": "mqtt in",
        "z": "7cdac530d32ba507",
        "name": "",
        "topic": "hm1600/116491954071/0/power",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "1467dfeaad9c21b5",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 230,
        "y": 660,
        "wires": [
            [
                "aaba7262ed295e76",
                "785901583d166055"
            ]
        ]
    },
    {
        "id": "aaba7262ed295e76",
        "type": "debug",
        "z": "7cdac530d32ba507",
        "name": "debug 14",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 660,
        "wires": []
    },
    {
        "id": "fc19eefeb14a356e",
        "type": "function",
        "z": "7cdac530d32ba507",
        "name": "function 3",
        "func": "// Eingabevariablen definieren\n// den absoluten Wert von value2 nehmen\nvar value1 = Math.abs(msg.payload.value1);\nvar value2 = Math.abs(msg.payload.value2); \n\n// Subtraktion durchführen\nvar result = value2 - value1;\n\n// Ergebnis zurückgeben\nmsg.payload = result;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600,
        "y": 480,
        "wires": [
            [
                "f6c8a4c8d7befd15",
                "4995b704c7e22f34"
            ]
        ]
    },
    {
        "id": "f6c8a4c8d7befd15",
        "type": "debug",
        "z": "7cdac530d32ba507",
        "name": "debug 15",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1160,
        "y": 480,
        "wires": []
    },
    {
        "id": "4cfeba5c6545fa13",
        "type": "change",
        "z": "7cdac530d32ba507",
        "name": "Gesamtbezug Haus",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.em0.total_act_power",
                "tot": "msg",
                "dc": true
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 400,
        "y": 280,
        "wires": [
            [
                "3f0ef3e6ef837c5c",
                "4377c2003e48c9f5"
            ]
        ]
    },
    {
        "id": "a5edc8dd149b4c45",
        "type": "inject",
        "z": "7cdac530d32ba507",
        "name": "",
        "props": [
            {
                "p": "payload.value2",
                "v": "300",
                "vt": "num"
            },
            {
                "p": "payload.value1",
                "v": "200",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 590,
        "y": 560,
        "wires": [
            [
                "fc19eefeb14a356e"
            ]
        ]
    },
    {
        "id": "ad6d58fafc3f123b",
        "type": "change",
        "z": "7cdac530d32ba507",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload.value1",
                "pt": "msg",
                "to": "payload.em0.total_act_power",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 350,
        "y": 400,
        "wires": [
            [
                "fc19eefeb14a356e"
            ]
        ]
    },
    {
        "id": "785901583d166055",
        "type": "change",
        "z": "7cdac530d32ba507",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload.value2",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 350,
        "y": 500,
        "wires": [
            [
                "fc19eefeb14a356e"
            ]
        ]
    },
    {
        "id": "4995b704c7e22f34",
        "type": "trigger",
        "z": "7cdac530d32ba507",
        "name": "Netzbezug <0",
        "op1": "",
        "op2": "1600",
        "op1type": "pay",
        "op2type": "num",
        "duration": "0",
        "extend": false,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 840,
        "y": 400,
        "wires": [
            [
                "0371ca652c2afdf4"
            ]
        ]
    },
    {
        "id": "1467dfeaad9c21b5",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.178.93",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

Besten Dank!