Modbus Device auslesen

Fragen zur Nutzung, Features, usw..
Antworten
the-beginner
Beiträge: 37
Registriert: So Mai 01, 2022 12:51 pm
Wohnort: Rottal-Inn

Modbus Device auslesen

Beitrag von the-beginner »

Hallo zusammen,

aktuell setze ich einen EVU (Stromzähler) ein, der per Modbus ausgelesen werden kann. Ich würde gerne bei openWB (Anschaffung openWB Pro geplant) diesen EVU als Stromzähler über Modbus einbinden. Aktuell kann ich diese EVU ganz einfach per NodeRed auslesen.

Folgende Fragen im Zusammenhang mit openWB:
  • Kann ich die EVU per Modbus auslesen?
  • Kann ich die EVU openWB auch als zu nutzende EVU vorgeben?
  • Wie kann ich ggf. die zu lesenden Register definieren?

Vielen Dank an alle Antwortenden.

Gruß
The Beginner
20,5 kWp, Huawei Sun2000 20KTL M2, Acthor 3 kW, Skoda Enyaq 60 (vss. 10/2022)
OpenWB custom 1p/3p-Umschaltung, RFID
derNeueDet
Beiträge: 4447
Registriert: Mi Nov 11, 2020 7:16 pm
Has thanked: 5 times
Been thanked: 27 times

Re: Modbus Device auslesen

Beitrag von derNeueDet »

Dazu würde ein extra Modul für den Zähler gebraucht. Es gibt kein generischen Modbus Modul, bei dem du Register eingeben kannst.
Alternativ würde es gehen, per MQTT die Daten aus dem Nodered zu verwenden. Ich denk da gibt es genügend hier, die dir dabei helfen können.

VG
Det
10kWp PV mit SMA Tripower 10000TL-10 (PE11 mit SDM72V2); 2,4kWp mit Solis 2.5 G6 (EE11 mit SDM120). OpenWB Standard+. EVU EM540 an einem Raspi mit Venus OS. BEV Mercedes EQA 300 (06/2024)
the-beginner
Beiträge: 37
Registriert: So Mai 01, 2022 12:51 pm
Wohnort: Rottal-Inn

Re: Modbus Device auslesen

Beitrag von the-beginner »

Hi Det,

danke für die Antwort.
Ich hab das Forum schon per Suche beackert. Leider wenig fündig geworden. Gibt es eine Anleitung (außer in der Wissenssammlung für MQTT)?

Alternative Frage: Kann ich mir selbst ein Modul schreiben?

Gruß
The Beginner
20,5 kWp, Huawei Sun2000 20KTL M2, Acthor 3 kW, Skoda Enyaq 60 (vss. 10/2022)
OpenWB custom 1p/3p-Umschaltung, RFID
Becker
Beiträge: 769
Registriert: Mi Okt 07, 2020 4:34 pm

Re: Modbus Device auslesen

Beitrag von Becker »

Kann dir meinen flow geben wo alle Werte per MQTT ans openWB EVU Modul geschrieben werden.
openWB series2 Buchse (2021)
go-eCharger HOME+ 22 kW (2022)
derNeueDet
Beiträge: 4447
Registriert: Mi Nov 11, 2020 7:16 pm
Has thanked: 5 times
Been thanked: 27 times

Re: Modbus Device auslesen

Beitrag von derNeueDet »

Ein eigenes Modul kannst du schon schreiben, Python3 wäre die richtige Programmiersprache dazu.
Wenn du dich in Python gut auskennst, dann einfach mal in Github stöbern nach einem "ähnlichen" Modbus Modul, kopieren und anpassen. Nimm ein Modul aus dem packages Verzeichnis, das sind Module, die in Version 1.9 und 2.0 funktionieren können. Module, dierekt unter dem Verzeichnis module sind nur 1.9 tauglich und das wäre wohl langfristig nicht zielführend.
Sinnvoll machen kannst du das aber nur auf einem Raspi, auf dem du dir die openWB Software schon mal installierst.

Danach dein Modul per Git Pull Request in die echte openWB bringen.

Wenn du die Daten per MQTT bereitstellen kannst, wäre es vermutlich wesentlich weniger Aufwand. Und wie viele andere Kunden / Community Mitglieder genau den bei dir verbauten Modbus EVU Zähler haben ist halt auch fraglich.

VG
Det
10kWp PV mit SMA Tripower 10000TL-10 (PE11 mit SDM72V2); 2,4kWp mit Solis 2.5 G6 (EE11 mit SDM120). OpenWB Standard+. EVU EM540 an einem Raspi mit Venus OS. BEV Mercedes EQA 300 (06/2024)
Becker
Beiträge: 769
Registriert: Mi Okt 07, 2020 4:34 pm

Re: Modbus Device auslesen

Beitrag von Becker »

Das schiebt die Werte vom SMA HM in openWB, mit "node-red-contrib-cron-plus" als Trigger.

Code: Alles auswählen

[
    {
        "id": "6649fcadf54f90a8",
        "type": "change",
        "z": "4726af68.c62a98",
        "name": "I L1",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.I1",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 620,
        "wires": [
            [
                "92a46e3c400a2c08"
            ]
        ]
    },
    {
        "id": "7450ae6c25a5b14a",
        "type": "function",
        "z": "4726af68.c62a98",
        "name": "Bezug",
        "func": "Bez = msg.payload.P_bez;\nEin = msg.payload.P_ein;\nvar P;\nif(Bez > 0 && Ein == 0 ) {\n    P = Bez;\n}\nelse if(Bez == 0 && Ein > 0 ) {\n   P = Ein *-1;\n}\nelse {\n   P = 0;\n}\nmsg.payload = Math.round(P);\nmsg.topic = \"P\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 250,
        "y": 560,
        "wires": [
            [
                "50cd715bd0d6434e"
            ]
        ]
    },
    {
        "id": "50cd715bd0d6434e",
        "type": "mqtt out",
        "z": "4726af68.c62a98",
        "name": "Bezugsleistung",
        "topic": "openWB/set/evu/W",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d1369cc14791a2de",
        "x": 480,
        "y": 560,
        "wires": []
    },
    {
        "id": "92a46e3c400a2c08",
        "type": "mqtt out",
        "z": "4726af68.c62a98",
        "name": "Strom L1",
        "topic": "openWB/set/evu/APhase1",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d1369cc14791a2de",
        "x": 460,
        "y": 620,
        "wires": []
    },
    {
        "id": "c78b17308a57e51a",
        "type": "mqtt out",
        "z": "4726af68.c62a98",
        "name": "Strom L2",
        "topic": "openWB/set/evu/APhase2",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d1369cc14791a2de",
        "x": 460,
        "y": 680,
        "wires": []
    },
    {
        "id": "e4d55f0f1b537d52",
        "type": "mqtt out",
        "z": "4726af68.c62a98",
        "name": "Strom L3",
        "topic": "openWB/set/evu/APhase3",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d1369cc14791a2de",
        "x": 460,
        "y": 740,
        "wires": []
    },
    {
        "id": "0941e47dfd2b1ae0",
        "type": "change",
        "z": "4726af68.c62a98",
        "name": "I L2",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.I2",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 680,
        "wires": [
            [
                "c78b17308a57e51a"
            ]
        ]
    },
    {
        "id": "82f7ee1e368ab8f7",
        "type": "change",
        "z": "4726af68.c62a98",
        "name": "I L3",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.I3",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 740,
        "wires": [
            [
                "e4d55f0f1b537d52"
            ]
        ]
    },
    {
        "id": "dc51bdeddba52baf",
        "type": "mqtt out",
        "z": "4726af68.c62a98",
        "name": "Bezogene Energie in Wh",
        "topic": "openWB/set/evu/WhImported",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d1369cc14791a2de",
        "x": 510,
        "y": 1040,
        "wires": []
    },
    {
        "id": "b4caa3281ec39a1e",
        "type": "change",
        "z": "4726af68.c62a98",
        "name": "W Bezug",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.W_bez2",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 260,
        "y": 1040,
        "wires": [
            [
                "dc51bdeddba52baf"
            ]
        ]
    },
    {
        "id": "e0cc9585588ab29e",
        "type": "change",
        "z": "4726af68.c62a98",
        "name": "W Einsp",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.W_ein2",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 260,
        "y": 1100,
        "wires": [
            [
                "718ebd8162de0e76"
            ]
        ]
    },
    {
        "id": "ecdeb310366ddb58",
        "type": "mqtt out",
        "z": "4726af68.c62a98",
        "name": "Spannung L1",
        "topic": "openWB/set/evu/VPhase1",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d1369cc14791a2de",
        "x": 480,
        "y": 800,
        "wires": []
    },
    {
        "id": "17ee85d34a8a3823",
        "type": "mqtt out",
        "z": "4726af68.c62a98",
        "name": "Spannung L2",
        "topic": "openWB/set/evu/VPhase2",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d1369cc14791a2de",
        "x": 480,
        "y": 860,
        "wires": []
    },
    {
        "id": "97bc1c1d40c7d49d",
        "type": "mqtt out",
        "z": "4726af68.c62a98",
        "name": "Spannung L3",
        "topic": "openWB/set/evu/VPhase3",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d1369cc14791a2de",
        "x": 480,
        "y": 920,
        "wires": []
    },
    {
        "id": "8d8825484130fb79",
        "type": "change",
        "z": "4726af68.c62a98",
        "name": "U L1",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.U1",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 800,
        "wires": [
            [
                "ecdeb310366ddb58"
            ]
        ]
    },
    {
        "id": "02f331bc84d51997",
        "type": "change",
        "z": "4726af68.c62a98",
        "name": "U L2",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.U2",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 860,
        "wires": [
            [
                "17ee85d34a8a3823"
            ]
        ]
    },
    {
        "id": "08a20444e8ddff72",
        "type": "change",
        "z": "4726af68.c62a98",
        "name": "U L3",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.U3",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 920,
        "wires": [
            [
                "97bc1c1d40c7d49d"
            ]
        ]
    },
    {
        "id": "185c8682f5c99586",
        "type": "change",
        "z": "4726af68.c62a98",
        "name": "Hz",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.Hz",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 980,
        "wires": [
            [
                "764780e0cd8deed0"
            ]
        ]
    },
    {
        "id": "764780e0cd8deed0",
        "type": "mqtt out",
        "z": "4726af68.c62a98",
        "name": "Frequenz",
        "topic": "openWB/set/evu/HzFrequenz",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "d1369cc14791a2de",
        "x": 460,
        "y": 980,
        "wires": []
    },
    {
        "id": "16dac3a97063128b",
        "type": "comment",
        "z": "4726af68.c62a98",
        "name": "für das openWB EVU Modul",
        "info": "alle 10 Sekunden",
        "x": 320,
        "y": 500,
        "wires": []
    },
    {
        "id": "74dc463f9bb55ecc",
        "type": "cronplus",
        "z": "4726af68.c62a98",
        "name": "alle 5s",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "P Bezug",
                "topic": "P_bez",
                "payloadType": "global",
                "payload": "P-Bezug",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "P Einspeisung",
                "topic": "P_ein",
                "payloadType": "global",
                "payload": "P-Einsp",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "I L1",
                "topic": "I1",
                "payloadType": "global",
                "payload": "I1",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "I L2",
                "topic": "I2",
                "payloadType": "global",
                "payload": "I2",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "I L3",
                "topic": "I3",
                "payloadType": "global",
                "payload": "I3",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "U L1",
                "topic": "U1",
                "payloadType": "global",
                "payload": "U1",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "U L2",
                "topic": "U2",
                "payloadType": "global",
                "payload": "U2",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "U L3",
                "topic": "U3",
                "payloadType": "global",
                "payload": "U3",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "Frequenz",
                "topic": "Hz",
                "payloadType": "global",
                "payload": "Hz",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "W Bezug",
                "topic": "W_bez2",
                "payloadType": "flow",
                "payload": "W_bez2",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "W Einspeisung",
                "topic": "W_ein2",
                "payloadType": "flow",
                "payload": "W_ein2",
                "expressionType": "cron",
                "expression": "*/5 * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 70,
        "y": 500,
        "wires": [
            [
                "cb6535591c6baa00"
            ]
        ]
    },
    {
        "id": "cb6535591c6baa00",
        "type": "join",
        "z": "4726af68.c62a98",
        "name": "Objekt",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "11",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 70,
        "y": 560,
        "wires": [
            [
                "7450ae6c25a5b14a",
                "6649fcadf54f90a8",
                "82f7ee1e368ab8f7",
                "02f331bc84d51997",
                "08a20444e8ddff72",
                "185c8682f5c99586",
                "b4caa3281ec39a1e",
                "e0cc9585588ab29e",
                "0941e47dfd2b1ae0",
                "8d8825484130fb79"
            ]
        ]
    },
    {
        "id": "d1369cc14791a2de",
        "type": "mqtt-broker",
        "name": "openWB",
        "broker": "192.168.168.51",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]
openWB series2 Buchse (2021)
go-eCharger HOME+ 22 kW (2022)
the-beginner
Beiträge: 37
Registriert: So Mai 01, 2022 12:51 pm
Wohnort: Rottal-Inn

Re: Modbus Device auslesen

Beitrag von the-beginner »

Hi Det,
danke für den Hinweis.
derNeueDet hat geschrieben: Sa Mai 21, 2022 7:23 am Wenn du die Daten per MQTT bereitstellen kannst, wäre es vermutlich wesentlich weniger Aufwand. Und wie viele andere Kunden / Community Mitglieder genau den bei dir verbauten Modbus EVU Zähler haben ist halt auch fraglich.
Das lasse ich mal besser. Ich spreche gerade mal VBA. Das wird dann wohl nix Vernünftiges werden.

Ich werde mir per Node Red ein Skript basteln, welches die in einem anderen Skript gesammelten (und an InfluxDB weitergereichten) Daten per MQTT komplett an die openWB durchschiebt.

Ist die hier (viewtopic.php?f=6&t=577) gezeigte Auflistung noch aktuell? Oder gibt es woanders noch eine besser Übersicht die ich noch nicht gefunden habe?

Gruß
The-Beginner
20,5 kWp, Huawei Sun2000 20KTL M2, Acthor 3 kW, Skoda Enyaq 60 (vss. 10/2022)
OpenWB custom 1p/3p-Umschaltung, RFID
Gero
Beiträge: 3442
Registriert: Sa Feb 20, 2021 9:55 am
Has thanked: 4 times
Been thanked: 62 times

Re: Modbus Device auslesen

Beitrag von Gero »

Google mal nach mqttexplorer - der stellt alle Topics schön im Baum dar.

Und klick‘ mal diesen beiden Links hinterher, da findest Du eine schöne Einleitung in‘s Thema.
openWB-series2, openWB-Buchse, E3/DC S10pro+19.5kWh, 30kWp Ost-Süd, Model 3 und Ion
Antworten