Solarauswertung Steuerung mal einfacher

Überwachung der Solaranlage per eMail oder Pushover und Steuerung von Geräten mit Smart Home Zentralen. PV-Monitoring und Geräten mit Tasmota Firmware

Moderator: Ulrich

Antworten
panterb
Beiträge: 6
Registriert: Mi 29. Apr 2020, 08:00
Danksagung erhalten: 1 Mal

Solarauswertung Steuerung mal einfacher

Beitrag von panterb »

Hallo Leute,

ich habe 2 Solar PVs über Solaranzeige aktiv.
Einmal über einen Tasmota SONOFF POW2 und einmal über Shelly1PM

Dazu noch einen IOBROKER mit Node Red

Ziel: Falls Summe der Stromerzeugung aktuell >400W , dann schalte Gerät an.

Hier der Node Red Code

Code: Alles auswählen

[
    {
        "id": "1275f63c.46e232",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "ac516b3e.7fcbd",
        "type": "debug",
        "z": "1275f63c.46e232",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 230,
        "y": 320,
        "wires": []
    },
    {
        "id": "1215b09b.182c07",
        "type": "function",
        "z": "1275f63c.46e232",
        "name": "turn relay on",
        "func": "var x = \"on\";\nvar IP = \"192.168.178.38\";\nmsg.url= \"http://\"+ IP + \"/relay/0\";\n\nmsg.payload = \"turn=\" + x;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 810,
        "y": 240,
        "wires": [
            [
                "ac516b3e.7fcbd",
                "5743c271.4c2ddc",
                "53f723a.b4cc0dc"
            ]
        ]
    },
    {
        "id": "53f723a.b4cc0dc",
        "type": "http request",
        "z": "1275f63c.46e232",
        "d": true,
        "name": "HTTP Post",
        "method": "POST",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 1130,
        "y": 420,
        "wires": [
            []
        ]
    },
    {
        "id": "417c14a9.666214",
        "type": "function",
        "z": "1275f63c.46e232",
        "name": "turn relay off",
        "func": "var x = \"off\";\nvar IP = \"192.168.178.38\";\nmsg.url= \"http://\"+ IP + \"/relay/0\";\n\nmsg.payload = \"turn=\" + x;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 1270,
        "y": 240,
        "wires": [
            [
                "ac516b3e.7fcbd",
                "53f723a.b4cc0dc"
            ]
        ]
    },
    {
        "id": "d6808038.900a08",
        "type": "ioBroker in",
        "z": "1275f63c.46e232",
        "name": "Garten PV",
        "topic": "shelly.0.SHSW-PM#8CAAB574DBE8#1.Relay0.Power",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "fireOnStart": "false",
        "x": 100,
        "y": 140,
        "wires": [
            [
                "4e27402c.508c18"
            ]
        ]
    },
    {
        "id": "413afe62.db39d8",
        "type": "function",
        "z": "1275f63c.46e232",
        "name": "combine energy",
        "func": "var msg2 = {};\nvar msg1 = {};\n\nif (msg.topic == \"Garten\") {\n    flow.set('Garten', msg.payload);\n} else if (msg.topic == \"Garage\") {\n   flow.set('Garage', msg.payload);\n}\n\n\n// get the latest values of pid/temperature from context - default to 0 if not yet set\nvar garage = flow.get('Garage') || 0;\nvar garten = flow.get('Garten') || 0;\nmsg1.payload = garten+garage;\nmsg1.topic = \"Energy\";\n\n \nreturn [msg1];\n ",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 540,
        "y": 160,
        "wires": [
            [
                "ac516b3e.7fcbd",
                "5dbd4fd9.a30c98",
                "4f16ce07.e231e",
                "e4e6e4a6.ddbcb"
            ]
        ]
    },
    {
        "id": "4e27402c.508c18",
        "type": "change",
        "z": "1275f63c.46e232",
        "name": "Convert to Integer",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number(payload)",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "Garten",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 290,
        "y": 180,
        "wires": [
            [
                "413afe62.db39d8"
            ]
        ]
    },
    {
        "id": "3de8c015.3add7",
        "type": "change",
        "z": "1275f63c.46e232",
        "name": ">400W",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 980,
        "y": 140,
        "wires": [
            [
                "1215b09b.182c07"
            ]
        ]
    },
    {
        "id": "5743c271.4c2ddc",
        "type": "trigger",
        "z": "1275f63c.46e232",
        "name": "Wait and Retrigger 10 min",
        "op1": "",
        "op2": "",
        "op1type": "pay",
        "op2type": "payl",
        "duration": "20",
        "extend": true,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 1050,
        "y": 240,
        "wires": [
            [
                "417c14a9.666214"
            ]
        ]
    },
    {
        "id": "5dbd4fd9.a30c98",
        "type": "switch",
        "z": "1275f63c.46e232",
        "name": "Schwellwert",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gt",
                "v": "115",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 810,
        "y": 140,
        "wires": [
            [
                "3de8c015.3add7"
            ]
        ]
    },
    {
        "id": "4f16ce07.e231e",
        "type": "ui_gauge",
        "z": "1275f63c.46e232",
        "name": "Leistung",
        "group": "1d948ee5.fea3c1",
        "order": 3,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Leistung Alle PV",
        "label": "Watt",
        "format": "{{value}}",
        "min": 0,
        "max": "1500",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 360,
        "y": 560,
        "wires": []
    },
    {
        "id": "e4e6e4a6.ddbcb",
        "type": "ui_chart",
        "z": "1275f63c.46e232",
        "name": "",
        "group": "c52f025a.157af",
        "order": 4,
        "width": 0,
        "height": 0,
        "label": "PV Leistung Verlauf",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "0",
        "ymax": "1500",
        "removeOlder": "24",
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "x": 550,
        "y": 560,
        "wires": [
            []
        ]
    },
    {
        "id": "8a2a8970.e4baa",
        "type": "mqtt in",
        "z": "1275f63c.46e232",
        "name": "Solaranlage",
        "topic": "stat/solar/STATUS10",
        "qos": "2",
        "datatype": "json",
        "broker": "7d9db293.0e12bc",
        "x": 110,
        "y": 100,
        "wires": [
            [
                "417501a0.4bf6f8"
            ]
        ]
    },
    {
        "id": "417501a0.4bf6f8",
        "type": "function",
        "z": "1275f63c.46e232",
        "name": "",
        "func": "var msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\nvar msg4 = {};\nvar msg5 = {};\nvar msg6 = {};\n\nmsg1.payload = msg.payload.StatusSNS.ENERGY.Voltage;\nmsg1.topic = 'Voltage';\nmsg2.payload = msg.payload.StatusSNS.ENERGY.Power;\nmsg2.topic = 'Power';\nmsg3.payload = msg.payload.StatusSNS.ENERGY.Today;\nmsg3.topic = 'Today';\nmsg4.payload = msg.payload.StatusSNS.ENERGY.Yesterday;\nmsg4.topic = 'Yesterday';\nmsg5.payload = msg.payload.StatusSNS.ENERGY.Total;\nmsg5.topic = 'Total';\nmsg6.payload = msg2.payload;\nmsg6.topic = 'Garage';\n\nreturn [msg1, msg2, msg3, msg4, msg5, msg6];\n\n ",
        "outputs": 6,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 320,
        "y": 100,
        "wires": [
            [],
            [],
            [],
            [],
            [],
            [
                "413afe62.db39d8"
            ]
        ]
    },
    {
        "id": "1d948ee5.fea3c1",
        "type": "ui_group",
        "name": "Erträge",
        "tab": "9bad75b8.5e5df8",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "c52f025a.157af",
        "type": "ui_group",
        "name": "Solaranlage",
        "tab": "9bad75b8.5e5df8",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "7d9db293.0e12bc",
        "type": "mqtt-broker",
        "name": "192.168.178.143",
        "broker": "192.168.178.143",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": false,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    },
    {
        "id": "9bad75b8.5e5df8",
        "type": "ui_tab",
        "name": "Solaranlage",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

In Grafana, mache ich es so, dass der Shelly direkt in die InfluxDB der Solaranzeige schreibt.
Dann kann ich recht einfach die Queriy dazu starten und eine 2. Kurve anzeigen.

Über IOBroker kann ich direkt die InfluxDB schreiben und spare mir dabei den Umweg über die PHP Skripte der Solaranzeige/MQTT.

Grundsätzlich, wenn man auf die Summernwerte versichten kann, kann man auch IObroker + Influx DB + Grafana nehmen
Unbenannt.JPG
Oben die Leistungskurven parallel.
Mitte die gestapelten Werte
Unden nochmal addietr pro Tag
Viele Grüße

Antworten