Victron mit Modbus TCP auslesen

Begonnen von Michael Schmidt, 31 Januar 2021, 12:14:22

Vorheriges Thema - Nächstes Thema

Michael Schmidt

Hallo,

ich bin mit dem Modul ModbusAttr bereits soweit gekommen Adressen aus der Victron Zentrale auszulesen.

leider hänge ich an dem Problem die Readings zu formatieren.



Aktuell sehen die Readings so aus:
pv_ac_l1 ----- hex=04b1, string=.., s=-20220, s>=1201, S=45316, S>=1201

vermutlich ist das Attribut format das was ich suche aber irgendwie bekomme ich das nicht hin.

StefanStrobel

Hallo,

Du hast die Scan-Funktion verwendet. Dabei wird eine Default-Expression auf ScanFormat gesetzt. Die musst Du wieder entfernen.

Gruß
    Stefan

aikawa24

hi,

ich würde auch gern meinen CerboGX auslesen.

bist du mit den Readings schon weiter gekommen?


aikawa24

ich habe jetzt auch wie der TE etliche Readings aber wie bekomme ich die Werte in lesbare Reading umgewandelt ?

Reading
scan-h00260 hex=0000, string=.., s=0, s>=0, S=0, S>=0

Attributes
obj-h00260-reading scan-h00260


Vielen Dank schon mal für die Hilfe

aikawa24

habs :-)

dev-h-defPoll 1
dev-h-defUnpack s>
obj-h00259-expr $val / 100
obj-h00259-reading BatteryVoltage

skycrack

Hallo, könntet Ihr mal einige Beispiele posten, wie ich den Cerbo ein paar Daten entlocken kann und wie man diese verstehen muss.
Ich habe ebenso nach einen default Scan solche Readings
scan-h00771 hex=134c, string=.L, s=19475, s>=4940, S=19475, S>=4940

Vielen Dank

rubinho

Hallo Zusammen,

mir geht es genauso wie skycrack.
Ich verstehe es noch nicht so richtig und benötige diverse Register für mein Multiplus2

Eins davon wäre Register 33 um den Wechselrichter bei Bedarf ein oder auszuschalten.

scan-h00033 hex=0004, string=.., s=1024, s>=4, S=1024, S>=4
Ich kann die Zustände 1-4 als Wert schreiben, je nachdem was ich brauche.

Danke im Voraus

Viele Grüße
Rubinho
Fhem 5.9@Zotac Zbox Ci327 | HMCCU | Z-Wave@ZMEEUZB1 | HUE Bridge Gen2 | knxd over IP

rubinho

Soo ich hab mich mal etwas durchgekämpft.
Keine Ahnung ob das den anerkannten Regeln der Technik entspricht, aber zumindest hat man einen Ansatz zum weitermachen.
Da sich das VenusOS wie ein ModbusTCP Gateway verhält und sich darüber mehrere Geräte ansprechen lassen, musste ich mehrere Devices unterschiedlicher ID´s anlegen.
Wäre schön, wenn man diveres Geräte vereinen und einen Punkt vereinen könnte. Aber das ist in erster Linie nur Optik.

Mit der bisherigen Konfiguration kann ich zumindest den Wechselrichter ein und ausschalten. In Verbindung mit weiteren Sensoren, kann ich nun (hauptsächlich im Winter) den WR automatisch abschalten, wenn keine Sonne scheint und die Batterieentladefunktion deaktiviert ist (Geringer Ladestand).

Wer will darf seine Register und Optimierungen hier veröffentlichen. Da hat glaube ich keiner was dagegen :D

define Victron ModbusAttr 239 30 192.168.2.81:502 TCP
attr Victron dev-h-combine 5
attr Victron dev-h-defPoll 1
attr Victron obj-h00031-map 0:Off,1:Low Power,2:Fault,3:Bulk,4:Absorption,5:Float,6:Storage,7:Equalize,8:Passthru,9:Inverting,10:Power assist,11:Power supply,252:Bulk protection
attr Victron obj-h00031-reading Status
attr Victron obj-h00031-showGet 1
attr Victron obj-h00032-map 0:No error,1:VE.Bus Error 1: Device is switched off because one of the other phases in the system has switched off,2:VE.Bus Error 2: New and old types MK2 are mixed in the system,3:VE.Bus Error 3: Not all- or more than- the expected devices were found in the system,4:VE.Bus Error 4: No other device whatsoever detected,5:VE.Bus Error 5: Overvoltage on AC-out,6:VE.Bus Error 6: Error in DDC Program,7:VE.Bus BMS connected- which requires an Assistant- but no assistant found,10:VE.Bus Error 10: System time synchronisation problem occurred,14:VE.Bus Error 14: Device cannot transmit data,16:VE.Bus Error 16: Dongle missing,17:VE.Bus Error 17: One of the devices assumed master status because the original master failed,18:VE.Bus Error 18: AC Overvoltage on the output of a slave has occurred while already switched off,22:VE.Bus Error 22: This device cannot function as slave,24:VE.Bus Error 24: Switch-over system protection initiated,25:VE.Bus Error 25: Firmware incompatibility. The firmware of one of the connected device is not sufficiently up to date to operate in conjunction with this device,26:VE.Bus Error 26: Internal error
attr Victron obj-h00032-reading Error
attr Victron obj-h00032-showGet 1
attr Victron obj-h00033-map 1:Charger Only,2:Inverter Only,3:On,4:Off
attr Victron obj-h00033-reading WR-Mode
attr Victron obj-h00033-set 1
attr Victron room Modbus,Strom
attr Victron stateFormat WR-Mode - Error


define VictronSystem ModbusAttr 100 30 192.168.2.81:502 TCP
attr VictronSystem dev-h-combine 5
attr VictronSystem dev-h-defPoll 1
attr VictronSystem obj-h00843-reading Battery_State
attr VictronSystem obj-h00844-map 0:idle,1:charging,2:discharging
attr VictronSystem obj-h00844-reading Battery_Status
attr VictronSystem obj-h00844-showGet 1
attr VictronSystem obj-h02900-map 0:Unused (BL disabled), 1:Restarting, 2:Self-consumption, 3:Self-consumption, 4:Self-consumption, 5:Discharge_disabled, 6:Force charge, 7:Sustain, 9:Keep batteries charged, 10:BL Disabled, 11:BL Disabled (Low SoC)
attr VictronSystem obj-h02900-reading ESS_Battery_State
attr VictronSystem obj-h02901-expr $val / 10
attr VictronSystem obj-h02901-len 2
attr VictronSystem obj-h02901-reading ESS_Battery_Minimum
attr VictronSystem obj-h02903-expr $val / 10
attr VictronSystem obj-h02903-reading ESS_Battery_Minimum_Active
attr VictronSystem room Modbus,Strom
attr VictronSystem stateFormat Ladestand Battery_State% - Minimal ESS_Battery_Minimum% - ESS ESS_Battery_State


Fhem 5.9@Zotac Zbox Ci327 | HMCCU | Z-Wave@ZMEEUZB1 | HUE Bridge Gen2 | knxd over IP

jostmario

Kann mir jemand auf die Sprünge helfen würd gern die Werte vom an die Venus angeschlossenen EM24 auslesen. Z.b. die Watt auf Phase L1

Gruß Josty
Raspberry Pi  ---  HM-LAN ---  8X HM_HM_CC_RT_DN --- OWL+USB Strommesser    UVR1611

rubinho

#9
Ich dachte mein Schupser hätte ausgereicht  :-\

Als erstes musst du die ID des EM24 unter VenusOS ermitteln (Siehe Screenshot) (Einstellungen>Dienste>ModbusTCP>Verfügbare Dienste)
Dann erstellst du ein neues Device in Fhem:
define EM24 ModbusAttr <id> <interval> <ipadresse:port> TCP
Danach suchst du dir aus der Exceltabelle deine gewünschten Register raus (Der Bereich sollte zwischen 2600 und 2636 liegen) und trägst sie als Attribut ein.
Als Beispiel kannst du dir ein Reading von mir mit dem von dir passenden Register nehmen.

z.B. sowas...
attr EM24 dev-h-combine 5
attr EM24 dev-h-defPoll 1
attr EM24 obj-h02634-reading Total_Energy_from_net


Wenn du eine funktionierende Konfiguration hast, bitte veröffentlichen.


Ich hoffe das hilft dir weiter.
Fhem 5.9@Zotac Zbox Ci327 | HMCCU | Z-Wave@ZMEEUZB1 | HUE Bridge Gen2 | knxd over IP

Wzut

Zitat von: rubinho am 14 Dezember 2022, 16:27:11
Wenn du eine funktionierende Konfiguration hast, bitte veröffentlichen.

Folgendes habe ich mal für jemand mit einem EM24 gemacht :
defmod EM24 ModbusAttr 30 30 192.168.0.7:502 TCP
attr EM24 dev-h-combine 4
attr EM24 dev-h-defLen 1
attr EM24 dev-h-defPoll 1
attr EM24 dev-h-defUnpack s>
attr EM24 event-on-change-reading .*
attr EM24 obj-h2600-reading L1_Power
attr EM24 obj-h2601-reading L2_Power
attr EM24 obj-h2602-reading L3_Power
attr EM24 obj-h2616-expr $val/10
attr EM24 obj-h2616-format %.1f
attr EM24 obj-h2616-reading L1_Voltage
attr EM24 obj-h2618-expr $val/10
attr EM24 obj-h2618-format %.1f
attr EM24 obj-h2618-reading L2_Voltage
attr EM24 obj-h2620-expr $val/10
attr EM24 obj-h2620-format %.1f
attr EM24 obj-h2620-reading L3_Voltage
attr EM24 obj-h2622-expr $val/100
attr EM24 obj-h2622-len 2
attr EM24 obj-h2622-reading L1_Energy_in
attr EM24 obj-h2622-unpack N
attr EM24 obj-h2624-expr $val/100
attr EM24 obj-h2624-len 2
attr EM24 obj-h2624-reading L2_Energy_in
attr EM24 obj-h2624-unpack N
attr EM24 obj-h2626-expr $val/100
attr EM24 obj-h2626-len 2
attr EM24 obj-h2626-reading L3_Energy_in
attr EM24 obj-h2626-unpack N
attr EM24 obj-h2628-expr $val/100
attr EM24 obj-h2628-len 2
attr EM24 obj-h2628-reading L1_Energy_out
attr EM24 obj-h2628-unpack N
attr EM24 obj-h2630-expr $val/100
attr EM24 obj-h2630-len 2
attr EM24 obj-h2630-reading L2_Energy_out
attr EM24 obj-h2630-unpack N
attr EM24 obj-h2632-expr $val/100
attr EM24 obj-h2632-len 2
attr EM24 obj-h2632-reading L3_Energy_out
attr EM24 obj-h2632-unpack N
attr EM24 obj-h2634-expr $val/100
attr EM24 obj-h2634-len 2
attr EM24 obj-h2634-reading Total_In
attr EM24 obj-h2634-unpack N
attr EM24 obj-h2636-expr $val/100
attr EM24 obj-h2636-len 2
attr EM24 obj-h2636-reading Total_Out
attr EM24 obj-h2636-unpack N
attr EM24 room Modbus
attr EM24 userReadings Total_Power:L._Power.* {return (ReadingsNum($name, 'L1_Power', 0) + ReadingsNum($name, 'L2_Power', 0) + ReadingsNum($name, 'L3_Power', 0));;}
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

rasti

Hallo,

also wie ich einzelne Werte aus dem Cerbo hole hab ich glaube nun verstanden.
Ich hab jetzt mal die Register für AC Consumption L1 L2 L3 rausgesucht.

Das ist der Code....der geht auch
define Victron_AC_Consumption ModbusAttr 100 3 192.168.178.19:502 TCP
#attr Victron_AC_Consumption userattr dev-h-combine dev-h-defPoll obj-h00817-reading obj-h00818-reading obj-h00819-reading
#attr Victron_AC_Consumption dev-h-combine 5
attr Victron_AC_Consumption dev-h-defPoll 1
attr Victron_AC_Consumption obj-h00817-reading L1
attr Victron_AC_Consumption obj-h00818-reading L2
attr Victron_AC_Consumption obj-h00819-reading L3
attr Victron_AC_Consumption room Photovoltaik
attr Victron_AC_Consumption stateFormat L1 W L2 W L3 W


Nehme ich die auskommentierten Zeilen raus, geht es nicht mehr. In den anderen Beispielen sind die ja (manchmal) drin.
z-B. für das dev-h-combine 5 steht in der Anleitung folgendes:.
Zitatdev-h-combine 5 for example allows the module to combine read requests to objects having an address that differs 5 or less into one read request.
. Hat das was mit der Buslast (Anzahl der Anfragen) zu tun ??? Kann mir das jemand kurz erklären.

Viele Grüße
Ralf

Wzut

Zitat von: rasti am 15 Dezember 2022, 23:55:45
Kann mir das jemand kurz erklären.
combine 5 will 5 Register am Stück lesen , du hast aber nur drei in der Liste -> 817,818,819 daher würde ich auch nur max combine 3 nutzen.

Thema userattr : die must du gar nicht setzen/beachten, das macht FHEM von alleine je nachdem welche Attribute du setzt.
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

rasti

Hier mal ein wenig Code :
define Victron ModbusAttr 239 30 192.168.178.19:502 TCP
attr Victron userattr dev-h-combine dev-h-defPoll obj-h00031-map obj-h00031-reading obj-h00032-map obj-h00032-reading obj-h00033-map obj-h00033-reading obj-h00033-set stateFormat
attr Victron dev-h-combine 5
attr Victron dev-h-defPoll 1
attr Victron obj-h00031-map 0:Off,1:Low Power,2:Fault,3:Bulk,4:Absorption,5:Float,6:Storage,7:Equalize,8:Passthru,9:Inverting,10:Power assist,11:Power supply,252:Bulk protection
attr Victron obj-h00031-reading Status
attr Victron obj-h00032-map 0:No error,1:VE.Bus Error 1: Device is switched off because one of the other phases in the system has switched off,2:VE.Bus Error 2: New and old types MK2 are mixed in the system,3:VE.Bus Error 3: Not all- or more than- the expected devices were found in the system,4:VE.Bus Error 4: No other device whatsoever detected,5:VE.Bus Error 5: Overvoltage on AC-out,6:VE.Bus Error 6: Error in DDC Program,7:VE.Bus BMS connected- which requires an Assistant- but no assistant found,10:VE.Bus Error 10: System time synchronisation problem occurred,14:VE.Bus Error 14: Device cannot transmit data,16:VE.Bus Error 16: Dongle missing,17:VE.Bus Error 17: One of the devices assumed master status because the original master failed,18:VE.Bus Error 18: AC Overvoltage on the output of a slave has occurred while already switched off,22:VE.Bus Error 22: This device cannot function as slave,24:VE.Bus Error 24: Switch-over system protection initiated,25:VE.Bus Error 25: Firmware incompatibility. The firmware of one of the connected device is not sufficiently up to date to operate in conjunction with this device,26:VE.Bus Error 26: Internal error
attr Victron obj-h00032-reading Error
attr Victron obj-h00033-map 1:Charger Only,2:Inverter Only,3:On,4:Off
attr Victron obj-h00033-reading WR-Mode
attr Victron obj-h00033-set 1
attr Victron room Photovoltaik
attr Victron stateFormat WR-Mode - Error

define VictronSystem ModbusAttr 100 30 192.168.178.19:502 TCP
attr VictronSystem userattr dev-h-combine dev-h-defPoll obj-h00843-reading obj-h00844-map obj-h00844-reading obj-h02900-map obj-h02900-reading obj-h02901-expr obj-h02901-len obj-h02901-reading obj-h02903-expr obj-h02903-reading stateFormat
attr VictronSystem dev-h-combine 5
attr VictronSystem dev-h-defPoll 1
attr VictronSystem obj-h00843-reading Battery_State
attr VictronSystem obj-h00844-map 0:idle,1:charging,2:discharging
attr VictronSystem obj-h00844-reading Battery_Status
attr VictronSystem obj-h02900-map 0:Unused (BL disabled), 1:Restarting, 2:Self-consumption, 3:Self-consumption, 4:Self-consumption, 5:Discharge_disabled, 6:Force charge, 7:Sustain, 9:Keep batteries charged, 10:BL Disabled, 11:BL Disabled (Low SoC)
attr VictronSystem obj-h02900-reading ESS_Battery_State
attr VictronSystem obj-h02901-expr $val / 10
attr VictronSystem obj-h02901-len 2
attr VictronSystem obj-h02901-reading ESS_Battery_Minimum
attr VictronSystem obj-h02903-expr $val / 10
attr VictronSystem obj-h02903-reading ESS_Battery_Minimum_Active
attr VictronSystem room Photovoltaik
attr VictronSystem stateFormat Ladestand Battery_State% - Minimal ESS_Battery_Minimum% - ESS ESS_Battery_State

define Victron_AC_Consumption ModbusAttr 100 3 192.168.178.19:502 TCP
attr Victron_AC_Consumption userattr dev-h-defPoll obj-h00817-reading obj-h00818-reading obj-h00819-reading stateFormat userReadings
attr Victron_AC_Consumption dev-h-defPoll 1
attr Victron_AC_Consumption obj-h00817-reading Consumption_L1
attr Victron_AC_Consumption obj-h00818-reading Consumption_L2
attr Victron_AC_Consumption obj-h00819-reading Consumption_L3
attr Victron_AC_Consumption room Photovoltaik
attr Victron_AC_Consumption stateFormat Total:Consumption_Total W - L1: Consumption_L1 W - L2:Consumption_L2 W - L3:Consumption_L3: W
attr Victron_AC_Consumption userReadings Consumption_Total { ReadingsVal("Victron_AC_Consumption","Consumption_L1",0) + ReadingsVal("Victron_AC_Consumption","Consumption_L2",0) + ReadingsVal("Victron_AC_Consumption","Consumption_L3",0);;}

define Victron_Gridpower ModbusAttr 100 3 192.168.178.19:502 TCP
attr Victron_Gridpower userattr dev-h-defPoll obj-h00820-reading obj-h00821-reading obj-h00822-reading stateFormat userReadings
attr Victron_Gridpower dev-h-defPoll 1
attr Victron_Gridpower obj-h00820-reading Gridpower_L1
attr Victron_Gridpower obj-h00821-reading Gridpower_L2
attr Victron_Gridpower obj-h00822-reading Gridpower_L3
attr Victron_Gridpower room Photovoltaik
attr Victron_Gridpower stateFormat Total:Gridpower_Total W - L1: Gridpower_L1 W - L2:Gridpower_L2 W - L3:Gridpower_L3: W
attr Victron_Gridpower userReadings Gridpower_Total { ReadingsVal("Victron_Gridpower","Gridpower_L1",0) + ReadingsVal("Victron_Gridpower","Gridpower_L2",0) + ReadingsVal("Victron_Gridpower","Gridpower_L3",0);;}

define Victron_Battery ModbusAttr 225 3 192.168.178.19:502 TCP
attr Victron_Battery userattr dev-h-defPoll obj-h00259-reading obj-h00261-reading obj-h00266-reading stateFormat userReadings
attr Victron_Battery dev-h-defPoll 1
attr Victron_Battery obj-h00259-reading Bat_voltage
attr Victron_Battery obj-h00261-reading Battery_current
attr Victron_Battery obj-h00266-reading Bat_SOC
attr Victron_Battery room Photovoltaik
attr Victron_Battery stateFormat Voltage:Battery_voltage V - Current: Battery_current  A - SOC:Battery_SOC%  - Temperature:Battery_temperature °C
attr Victron_Battery userReadings Battery_temperature { round(ReadingsNum("Temperatur_Keller","temperature",-1),1) ;;}, Battery_SOC { ReadingsVal("Victron_Battery","Bat_SOC",0) *0.1 ;;}, Battery_voltage { ReadingsVal("Victron_Battery","Bat_voltage",0) *0.01 ;;}

define Victron_Solarpower ModbusAttr 100 3 192.168.178.19:502 TCP
attr Victron_Solarpower userattr dev-h-defPoll obj-h00811-reading obj-h00812-reading obj-h00813-reading obj-h00850-reading stateFormat userReadings
attr Victron_Solarpower dev-h-defPoll 1
attr Victron_Solarpower obj-h00811-reading Fronius_L1
attr Victron_Solarpower obj-h00812-reading Fronius_L2
attr Victron_Solarpower obj-h00813-reading Fronius_L3
attr Victron_Solarpower obj-h00850-reading DC_PV_Power
attr Victron_Solarpower room Photovoltaik
attr Victron_Solarpower stateFormat Total:  Total_Solar_Power W Fronius: AC_PV_Power W MPPT-DC:  DC_PV_Power W
attr Victron_Solarpower userReadings AC_PV_Power { ReadingsVal("Victron_Solarpower","Fronius_L1",0) + ReadingsVal("Victron_Solarpower","Fronius_L2",0) + ReadingsVal("Victron_Solarpower","Fronius_L3",0);;}, Total_Solar_Power {ReadingsVal("Victron_Solarpower","DC_PV_Power",0) + ReadingsVal("Victron_Solarpower","Fronius_L1",0) + ReadingsVal("Victron_Solarpower","Fronius_L2",0) + ReadingsVal("Victron_Solarpower","Fronius_L3",0);;}



Wzut

#14
Drei defines auf die ID100 - den Sinn und Zweck verstehe ich nicht, warum das nicht auf einmal erledigen ?
Deine 30 Sekunden Intervalle sind IMHO OK, aber alle 3 Sekunden ... finde ich etwas heftig

BTW : mach dich mal schlau zum Thema userReadings , deine sind alle ohne Trigger definiert - siehe mein Bsp unter #10
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher