Nulleinspeisung mit Node Red realisieren

Hi, ich hab eine sehr gut funktionierende “Nulleinspeißung” in NR programmiert und kann diese gerne beistellen. Allerdings nutze ich diese so gut wie garnicht, Strom einzuspeißen ist ja grundsätzlich nichts schlechtes…

Ich habe in HA eine kleine Karte, die die aktuelle Leistung des Balkonkraftwerks und den aktuellen Stromverbrauch anzeigt. Zudem kann ich darin den Wechselrichter in 5%-Schritten einstellen und die Nulleinspeißung-Automation ein- und ausschalten

Das ganze sieht so aus. Wenn PV-Schalter an ist bewegt sich die Einspeisung zwischen 0W und -100W, andernfalls wird der Powerfaktor des Wechselrichters automatisch in 5%-Schritten angepasst.

Kurze Erklärung:

  • Shelly-EM liest den aktuellen Stromzähler aus
  • PV-Schalter ist der Ein-Ausschalter auf meiner HA-Karte
  • get Powerfaktor liest den aktuellen Leistungsfaktor des Wechselrichters und schreibt den Wert in den Payload
  • Die Function-Nodes rechnen 5% dazu oder ab.
  • set Value schreibt den neuen Wert in den Wechselrichter.

Hallo, ja gerne bereitstellen. Ich selber bin noch totaler Anfänger. Ich teste es dann einfach mal aus

[
    {
        "id": "28258fb2ba1372ba",
        "type": "tab",
        "label": "PV Powerfaktor Automation",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "9802de013b956733",
        "type": "debug",
        "z": "28258fb2ba1372ba",
        "name": "debug 36",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1100,
        "y": 200,
        "wires": []
    },
    {
        "id": "300a12c66ccf7f8c",
        "type": "api-call-service",
        "z": "28258fb2ba1372ba",
        "name": "set Value Power Faktor",
        "server": "cb7b4a3ce8c4df39",
        "version": 5,
        "debugenabled": false,
        "domain": "number",
        "service": "set_value",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "number.growatt_esphome_power_factor"
        ],
        "data": "{\t   \"value\":msg.payload\t}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 870,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "c57943285edd8e1f",
        "type": "api-current-state",
        "z": "28258fb2ba1372ba",
        "name": "get Powerfaktor",
        "server": "cb7b4a3ce8c4df39",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "number.growatt_esphome_power_factor",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 500,
        "y": 120,
        "wires": [
            [
                "14d22b428357de73"
            ]
        ]
    },
    {
        "id": "fe27b451d600f08a",
        "type": "function",
        "z": "28258fb2ba1372ba",
        "name": "+5",
        "func": "var lim = msg.payload + 5;\nvar limit = Math.ceil(lim);\nreturn [{ payload: limit }];",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 200,
        "wires": [
            [
                "53ab3fc2dd725815"
            ]
        ]
    },
    {
        "id": "53ab3fc2dd725815",
        "type": "function",
        "z": "28258fb2ba1372ba",
        "name": "range (min-max)",
        "func": "var min = 20 ;\nvar max = 100 ;\n\nvar limit = msg.payload ;\n\nif (limit > max) {\n    limit = max;\n} else if (limit < min) {\n    limit = min;\n} \n\n\nreturn[{payload:limit}];",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 640,
        "y": 200,
        "wires": [
            [
                "300a12c66ccf7f8c"
            ]
        ]
    },
    {
        "id": "14d22b428357de73",
        "type": "function",
        "z": "28258fb2ba1372ba",
        "name": "abs",
        "func": "var abs = Math.abs(msg.payload);\n\nreturn [{ payload: abs }]",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 200,
        "wires": [
            [
                "fe27b451d600f08a"
            ]
        ]
    },
    {
        "id": "a93f6162f0195d22",
        "type": "debug",
        "z": "28258fb2ba1372ba",
        "name": "debug 37",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1100,
        "y": 420,
        "wires": []
    },
    {
        "id": "68749c9aeeda5b45",
        "type": "function",
        "z": "28258fb2ba1372ba",
        "name": "-5",
        "func": "var lim = msg.payload - 5;\nvar limit = Math.ceil(lim);\nreturn [{ payload: limit }];",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 420,
        "wires": [
            [
                "91844c9cbe01fd4f"
            ]
        ]
    },
    {
        "id": "91844c9cbe01fd4f",
        "type": "function",
        "z": "28258fb2ba1372ba",
        "name": "range (min-max)",
        "func": "var min = 20 ;\nvar max = 100 ;\n\nvar limit = msg.payload ;\n\nif (limit > max) {\n    limit = max;\n} else if (limit < min) {\n    limit = min;\n} \n\n\nreturn[{payload:limit}];",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 660,
        "y": 420,
        "wires": [
            [
                "fbb6f6d5d26a80f2"
            ]
        ]
    },
    {
        "id": "bf3ea59878b05f19",
        "type": "function",
        "z": "28258fb2ba1372ba",
        "name": "abs",
        "func": "var abs = Math.abs(msg.payload);\n\nreturn [{ payload: abs }]",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 420,
        "wires": [
            [
                "68749c9aeeda5b45"
            ]
        ]
    },
    {
        "id": "2cb25ee2d1f03018",
        "type": "api-current-state",
        "z": "28258fb2ba1372ba",
        "name": "get Powerfaktor",
        "server": "cb7b4a3ce8c4df39",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "number.growatt_esphome_power_factor",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 500,
        "y": 320,
        "wires": [
            [
                "bf3ea59878b05f19"
            ]
        ]
    },
    {
        "id": "fbb6f6d5d26a80f2",
        "type": "api-call-service",
        "z": "28258fb2ba1372ba",
        "name": "set Value Power Faktor",
        "server": "cb7b4a3ce8c4df39",
        "version": 5,
        "debugenabled": false,
        "domain": "number",
        "service": "set_value",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "number.growatt_esphome_power_factor"
        ],
        "data": "{\t   \"value\":msg.payload\t}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 890,
        "y": 420,
        "wires": [
            []
        ]
    },
    {
        "id": "d8d6938d190d8eee",
        "type": "trigger-state",
        "z": "28258fb2ba1372ba",
        "name": "Shelly EM < -100W",
        "server": "cb7b4a3ce8c4df39",
        "version": 4,
        "inputs": 0,
        "outputs": 2,
        "exposeAsEntityConfig": "",
        "entityId": "sensor.shelly_em_channel_1_power",
        "entityIdType": "exact",
        "debugEnabled": false,
        "constraints": [
            {
                "targetType": "this_entity",
                "targetValue": "",
                "propertyType": "current_state",
                "propertyValue": "new_state.state",
                "comparatorType": ">",
                "comparatorValueDatatype": "str",
                "comparatorValue": "-900"
            },
            {
                "targetType": "this_entity",
                "targetValue": "",
                "propertyType": "current_state",
                "propertyValue": "new_state.state",
                "comparatorType": "<",
                "comparatorValueDatatype": "str",
                "comparatorValue": "-100"
            }
        ],
        "customOutputs": [],
        "outputInitially": false,
        "stateType": "num",
        "enableInput": false,
        "x": 110,
        "y": 320,
        "wires": [
            [
                "46bf2778243cae66"
            ],
            []
        ]
    },
    {
        "id": "70229a2257d6868b",
        "type": "trigger-state",
        "z": "28258fb2ba1372ba",
        "name": "Shelly EM > 0W",
        "server": "cb7b4a3ce8c4df39",
        "version": 4,
        "inputs": 0,
        "outputs": 2,
        "exposeAsEntityConfig": "",
        "entityId": "sensor.shelly_em_channel_1_power",
        "entityIdType": "exact",
        "debugEnabled": false,
        "constraints": [
            {
                "targetType": "this_entity",
                "targetValue": "",
                "propertyType": "current_state",
                "propertyValue": "new_state.state",
                "comparatorType": ">",
                "comparatorValueDatatype": "str",
                "comparatorValue": "-10"
            }
        ],
        "customOutputs": [],
        "outputInitially": false,
        "stateType": "num",
        "enableInput": false,
        "x": 100,
        "y": 120,
        "wires": [
            [
                "fb294bde8c0e4b90"
            ],
            []
        ]
    },
    {
        "id": "46bf2778243cae66",
        "type": "api-current-state",
        "z": "28258fb2ba1372ba",
        "name": "PV Schalter",
        "server": "cb7b4a3ce8c4df39",
        "version": 3,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "input_boolean.pv_automation",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 310,
        "y": 320,
        "wires": [
            [
                "2cb25ee2d1f03018"
            ],
            []
        ]
    },
    {
        "id": "fb294bde8c0e4b90",
        "type": "api-current-state",
        "z": "28258fb2ba1372ba",
        "name": "PV Schalter",
        "server": "cb7b4a3ce8c4df39",
        "version": 3,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "input_boolean.pv_automation",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 310,
        "y": 120,
        "wires": [
            [
                "c57943285edd8e1f"
            ],
            []
        ]
    },
    {
        "id": "a1618e66df583208",
        "type": "comment",
        "z": "28258fb2ba1372ba",
        "name": "PV Powerfaktor Automation",
        "info": "",
        "x": 140,
        "y": 60,
        "wires": []
    },
    {
        "id": "cb7b4a3ce8c4df39",
        "type": "server",
        "name": "Home Assistant PVE",
        "version": 5,
        "addon": false,
        "rejectUnauthorizedCerts": false,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": false
    }
]

Hallo,
hier mal ein kleiner Zwischenstand meines Projekts. Die Umsetzung mit Node Red habe ich erst einmal gestoppt.
Die Entität des Wechselrichters wo man die Einspeisung individuell einstellen kann wird leider nicht zur Verfügung gestellt.

Deshalb wurde mit einem Template ein Sensor erstellt.
grafik

Dann wurde ein Yaml Code geschrieben wo der Netzbezug, der von einem Hichi Lesekopf bereitgestellt wird, an den Sensor weitergeleitet wird. In dem Yaml Code kann man auch noch Schwellenwerte einstellen.

-in welchen Zeitraum die Werte vom Lesekopf an den Wechselrichter gesendet werden und der Wechselrichter die Einspeisung anpasst

  • ob der Wechselrichter die vom Lesekopf gelieferten Werte zum Beispiel immer auf volle Watt aufrundet oder abrundet (wenn der Lesekopf den Wert 235 Watt Netzbezug ausgibt das dann auf 300 Watt aufgerundet wird oder auf 200 Watt abrundet). Damit möchte ich ein ständiges auf und abregeln vermeiden.

Ich hoffe das ich das hier verständlich geschrieben habe. Die Umsetzung in HA habe ich nicht selber gemacht, sondern in der Verwandschaft.

Der Probebetrieb war schon einmal vielversprechend. Wenn das alles richtig und zuverlässig läuft werde ich hier den Yaml Code und Template einmal hochladen

Hallo Solartaucher,

wie ist der Stand? Bist Du zufrieden und kannst den Code bereitstellen?

Hallo, verwende jetzt folgende Programmierung die ganz gut bei mir läuft.