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

rasti

Zitat von: Wzut am 17 Dezember 2022, 15:14:39
Drei defines auf die ID100 - den Sinn und Zweck verstehe ich nicht, warum das nicht auf einmal erledigen ?
Ist durch viel Rumprobieren historisch so gewachsen  ;D
Zitat
Deine 30 Sekunden Intervalle sind IMHO OK, aber alle 3 Sekunden ... finde ich etwas heftig
Ist das ein Problem ? Mein FHEM läuft noch auf einem Raspi1 und anscheinend geht es doch ?!?

Zitat
BTW : mach dich mal schlau zum Thema userReadings , deine sind alle ohne Trigger definiert - siehe mein Bsp unter #10

Verstehe ich das richtig, da werden keine Events ausgelöst und
du meinst da gehört noch ein event-on-change-reading .* dazu ?

Wzut

ZitatMein FHEM läuft noch auf einem Raspi1 und anscheinend geht es doch ?
dein FHEM sehe ich auch nicht als Problem sondern die Gegenseite

ZitatVerstehe ich das richtig, da werden keine Events ausgelöst
Nein verstehst du nicht richtig, wenn kein Trigger gesetzt ist wird das userReading jedesmal erzeugt
in meinem Bsp :
attr EM24 userReadings Total_Power:L._Power.* {return (ReadingsNum($name, 'L1_Power', 0) + ReadingsNum($name, 'L2_Power', 0) + ReadingsNum($name, 'L3_Power', 0));;}
wird das Reading Total_Power nur erzeugt wenn es einen Event für L1_Power , L2_Power oder L3_Power gab.

Zitatdu meinst da gehört noch ein event-on-change-reading .* dazu ?
event-on-change-reading .* verwende ich fast immer und bei jedem Device
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

rasti

Zitat von: Wzut am 17 Dezember 2022, 15:54:05
dein FHEM sehe ich auch nicht als Problem sondern die Gegenseite
OK ?!?....Wie kann man denn die Grenze der "Abfragefrequenz" abschätzen ?

Zitat
Nein verstehst du nicht richtig, wenn kein Trigger gesetzt ist wird das userReading jedesmal erzeugt
in meinem Bsp :
attr EM24 userReadings Total_Power:L._Power.* {return (ReadingsNum($name, 'L1_Power', 0) + ReadingsNum($name, 'L2_Power', 0) + ReadingsNum($name, 'L3_Power', 0));;}
wird das Reading Total_Power nur erzeugt wenn es einen Event für L1_Power , L2_Power oder L3_Power gab.
event-on-change-reading .* verwende ich fast immer und bei jedem Device

Was mit "userreading wird erzeugt" und "event wird erzeugt" ist  gemeint ist verstehe ich nicht wirklich, dafür fehlen mir wohl wesentliche FHEM Grundlagen.Aber zumindest die übertragenen Leistungswerte ändern sich doch sowieso ständig und sorgen für Events ? Sorry falls ich gerade Mist erzähle  ::)

rasti

#18
etwas verbesserter Code, habe u.a. mit dem event-on.change reading etwas gespielt so dass das log file nicht zugemüllt wird

#######################
# Victron Photovoltaik
#######################

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 Victron_Ess ModbusAttr 100 30 192.168.178.19:502 TCP
attr Victron_Ess userattr dev-h-defPoll event-on-change-reading obj-h00843-reading obj-h00844-map obj-h00844-reading obj-h02900-map obj-h02900-reading stateFormat
attr Victron_Ess dev-h-defPoll 1
attr Victron_Ess event-on-change-reading .*
attr Victron_Ess obj-h00843-reading Battery_State
attr Victron_Ess obj-h00844-map 0:idle,1:charging,2:discharging
attr Victron_Ess obj-h00844-reading Battery_Status
attr Victron_Ess 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 Victron_Ess obj-h02900-reading ESS_Battery_State
attr Victron_Ess room Photovoltaik
attr Victron_Ess stateFormat SOC: Battery_State% - ESS-State: ESS_Battery_State

define Victron_AC_Consumption ModbusAttr 100 5 192.168.178.19:502 TCP
attr Victron_AC_Consumption userattr dev-h-defPoll event-on-change-reading obj-h00817-reading obj-h00818-reading obj-h00819-reading stateFormat userReadings
attr Victron_AC_Consumption dev-h-defPoll 1
attr Victron_AC_Consumption event-on-change-reading .*:10
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 5 192.168.178.19:502 TCP
attr Victron_Gridpower userattr dev-h-defPoll event-on-change-reading obj-h00820-reading obj-h00821-reading obj-h00822-reading stateFormat userReadings
attr Victron_Gridpower dev-h-defPoll 1
attr Victron_Gridpower event-on-change-reading .*:10
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 5 192.168.178.19:502 TCP
attr Victron_Battery userattr dev-h-defPoll event-on-change-reading obj-h00259-reading obj-h00261-reading obj-h00266-reading stateFormat userReadings
attr Victron_Battery dev-h-defPoll 1
attr Victron_Battery event-on-change-reading .*
attr Victron_Battery obj-h00259-reading Bat_voltage
attr Victron_Battery obj-h00261-reading Bat_current
attr Victron_Battery obj-h00266-reading Bat_SOC
attr Victron_Battery room Photovoltaik
attr Victron_Battery stateFormat Battery_Power W / Battery_voltage V /  Battery_current  A / SOC:Battery_SOC%  / Temp. Battery_temperature °C
attr Victron_Battery userReadings Battery_Power { round((ReadingsVal("Victron_Battery","Battery_current",0)*ReadingsVal("Victron_Battery","Bat_voltage",0) *0.01),0) ;;}, 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 ;;}, Battery_current { ReadingsVal("Victron_Battery","Bat_current",0) *0.1 ;;}

define Victron_Solarpower ModbusAttr 100 5 192.168.178.19:502 TCP
attr Victron_Solarpower userattr dev-h-defPoll event-on-change-reading obj-h00811-reading obj-h00812-reading obj-h00813-reading obj-h00850-reading stateFormat userReadings
attr Victron_Solarpower dev-h-defPoll 1
attr Victron_Solarpower event-on-change-reading .*:10
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);;}

jostmario

Hallo,

mit deinem:
define Victron_Gridpower ModbusAttr 100 5 192.168.178.19:502 TCP
attr Victron_Gridpower userattr dev-h-defPoll event-on-change-reading obj-h00820-reading obj-h00821-reading obj-h00822-reading stateFormat userReadings
attr Victron_Gridpower dev-h-defPoll 1
attr Victron_Gridpower event-on-change-reading .*:10
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);;}



wenn ich auf L1 einspeise errechnet er die Werte falsch. Jemand eine Idee:





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

rasti

Zitat von: jostmario am 19 Dezember 2022, 14:36:53
wenn ich auf L1 einspeise errechnet er die Werte falsch. Jemand eine Idee:

Verhalten bei Einspeisung konnte ich leider wg. zu wenig Sonne noch gar nicht testen !

Ich vermute mal ins blaue hinein, dass eine falsch dargestellte 2K Zahl (Zweierkomplementzahl ) ist.
Als Variablentyp steht int16 in der Excelregistertabelle von Victron drin.
16 Bit sind 4 Hex Zahlen
Die Zahl 65320 im Bild  als 16 Bit Zahl hex dargestellt ist FF28
Wenn ich dieselbe Zahl FF28(hex) nicht als Binärzahl sondern als 2K Zahl interpretiere, dann wäre das -216
Kommt 216 Watt Einspeisung hin ?

Rechne mal den großen Wert bei Einspeisung mit Neuer_Wert  = -(65535-Wert+1) um.
Wenn das funktioniert müsstest du das bei allen Readings machen, die grösser als 32767 sind.

jostmario

Hallo,  ja 216W kommen hin.

wie verarbeite ich das in fhem, muss ich da ein neues Userreading anlegen oder kann man das irgendwie direkt in dem Modbusattr attribut berechnen ?

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

rasti

Zitat von: jostmario am 19 Dezember 2022, 16:40:40
Hallo,  ja 216W kommen hin.

wie verarbeite ich das in fhem, muss ich da ein neues Userreading anlegen oder kann man das irgendwie direkt in dem Modbusattr attribut berechnen ?

Gruß Josty

Gute Frage, keine Ahnung. Ich kann zwar in bestehenden Programmen rumpfuschen aber als Programmierer könnte ich nicht leben....da fehlen mir zu viele FHEM und Perl und sonstige Grundlagen.

Kannst ja mal im Anfängerforum fragen wie das geht und wenn du eine Lösung hast hier posten. Ich brauche den FHEM-Code ja auch  :) . Wenn man da Ahnung hat ist das in 10 Minuten erledigt. Ich brauche da wahrscheinlich 1-2 Abende dazu um das hinzukriegen....und gerade genug anderes zu tun.

rasti

Ich hab es hingekriegt...nun werden bei Gridpower und Batterypower auch negative Werte richtig angezeigt

#######################
# Victron Photovoltaik
#######################

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 Victron_Ess ModbusAttr 100 30 192.168.178.19:502 TCP
attr Victron_Ess userattr dev-h-defPoll event-on-change-reading obj-h00843-reading obj-h00844-map obj-h00844-reading obj-h02900-map obj-h02900-reading stateFormat
attr Victron_Ess dev-h-defPoll 1
attr Victron_Ess event-on-change-reading .*
attr Victron_Ess obj-h00843-reading Battery_State
attr Victron_Ess obj-h00844-map 0:idle,1:charging,2:discharging
attr Victron_Ess obj-h00844-reading Battery_Status
attr Victron_Ess 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 Victron_Ess obj-h02900-reading ESS_Battery_State
attr Victron_Ess room Photovoltaik
attr Victron_Ess stateFormat SOC: Battery_State% - ESS-State: ESS_Battery_State

define Victron_AC_Consumption ModbusAttr 100 5 192.168.178.19:502 TCP
attr Victron_AC_Consumption userattr dev-h-defPoll event-on-change-reading obj-h00817-reading obj-h00818-reading obj-h00819-reading stateFormat userReadings
attr Victron_AC_Consumption dev-h-defPoll 1
attr Victron_AC_Consumption event-on-change-reading .*:10
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 5 192.168.178.19:502 TCP
attr Victron_Gridpower userattr dev-h-defPoll event-on-change-reading obj-h00820-expr obj-h00820-reading obj-h00821-expr obj-h00821-reading obj-h00822-expr obj-h00822-reading stateFormat userReadings
attr Victron_Gridpower dev-h-defPoll 1
attr Victron_Gridpower event-on-change-reading .*:10
attr Victron_Gridpower obj-h00820-expr $val =  unsigned16_signed16($val)
attr Victron_Gridpower obj-h00820-reading Gridpower_L1
attr Victron_Gridpower obj-h00821-expr $val = unsigned16_signed16($val)
attr Victron_Gridpower obj-h00821-reading Gridpower_L2
attr Victron_Gridpower obj-h00822-expr $val = unsigned16_signed16($val)
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 5 192.168.178.19:502 TCP
attr Victron_Battery userattr dev-h-defPoll event-on-change-reading obj-h00259-reading obj-h00261-reading obj-h00266-reading stateFormat userReadings
attr Victron_Battery dev-h-defPoll 1
attr Victron_Battery event-on-change-reading .*
attr Victron_Battery obj-h00259-reading Bat_voltage
attr Victron_Battery obj-h00261-reading Bat_current
attr Victron_Battery obj-h00266-reading Bat_SOC
attr Victron_Battery room Photovoltaik
attr Victron_Battery stateFormat Battery_Power W / Battery_voltage V /  Battery_current  A / SOC:Battery_SOC%  / Temp. Battery_temperature °C
attr Victron_Battery userReadings Battery_Power { round((ReadingsVal("Victron_Battery","Battery_current",0)*ReadingsVal("Victron_Battery","Bat_voltage",0) *0.01),0) ;;}, 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 ;;}, Battery_current { unsigned16_signed16(ReadingsVal("Victron_Battery","Bat_current",0)) *0.1;;}

define Victron_Solarpower ModbusAttr 100 5 192.168.178.19:502 TCP
attr Victron_Solarpower userattr dev-h-defPoll event-on-change-reading obj-h00811-reading obj-h00812-reading obj-h00813-reading obj-h00850-reading stateFormat userReadings
attr Victron_Solarpower dev-h-defPoll 1
attr Victron_Solarpower event-on-change-reading .*:10
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);;}




Die Funktion unsigned16_signed16 also das hier

sub unsigned16_signed16 {
  my $v = shift;
  return ($v & 0x8000) ? -((~$v & 0xffff) + 1) : $v;
}


muss in die 99_myUtils.pm reinkopiert werden.



Wzut

Zitat von: rasti am 20 Dezember 2022, 10:35:05
muss in die 99_myUtils.pm reinkopiert werden.
ne,ne,ne ob ein Register ein int, uint , flow oder sonst etwas Wert enthält wird im Modul mit dem unpack Attribut abgehandelt.
Die command.ref zum Modul enthält sogar die Lösung für int16 :
Zitatobj-[cdih][1-9][0-9]*-unpack
defines the pack / unpack code to convert data types.
-- snipp ---
For an unsigned integer in big endian format this would be "n",
for a signed 16 bit integer in big endian format this would be "s>", in little endian format it would be "s<"
-- snipp ---
d.h. attr Victron_Gridpower obj-h820-unpack s> usw. wäre hier dein Freund
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

jostmario

Hallo,

ja dakne das unpack funktioniert.

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

rasti

Zitat von: jostmario am 22 Dezember 2022, 16:52:14
Hallo,

ja dakne das unpack funktioniert.

Gruß Josty
Mein gepfuschter Code funktioniert auch  ;D

jostmario

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

lynckmeister

Servus zusammen, also ich habe mich an diesem Thread entlanggehangelt und kann nun ohne Probleme alle Register lesen und wohl auch schreiben.
Ich habe einen MP2 den ich mit dem VenusOSRasp über Modbus anspreche. Da ich kein Smartmeter extra einbauen will, steurere ich den Mp2 über die in FHEM bereits ausgelesenen Smartmeter Werte:
Wenn ich also die Batterie laden will muss ich Register 37 mit dem Wert (Watt) den ich Laden will schreiben. Anschliessend muss ich noch Register 38 auf Enabled setzen, damit das ganze losgeht. Der MP2 lädt dann für ca 60 Sekunden. Dann braucht er wohl ein Update. Setze ich das (Reg 37) dann sprint 38 wieder auf disbaled um und ich muss auch 38 erneut auf enabled setzen. Ist das normal?!
Bei Feed in ist es nicht so , 39 bleibt immer auf enables. Ich muss also nur 37 negatv setzen und schon entlädt der MP2 für ca. 60 Sekunden die Batterie . Damit kann ich umgehen.

Es gibt aber noch beim Victron Hub ( Id100) den Register 2700 , der genau das gleiche laut Beschreibung macht Setpoint in Watt für laden und entladen sezten. Wofür ist dann aber der, wenn ich doch 37 schon habe?!

Ich mache mir auch Sorgen , ob die Grundeinstellungen meines MP2 noch greifen, wenn ich ihm explizit alle 60 Sekunden sage, was er zu tun hat. Hält er sich dann trotzdem an die Grenzen meiner LifePo4 Batterie für Über und Unterladung ?

Hier die List meiner Attribute:


Attributes:
   dev-h-defPoll 1
   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
   obj-h00031-reading Status
   obj-h00031-showGet 1
   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
   obj-h00032-reading Error
   obj-h00032-showGet 1
   obj-h00033-map 1:Charger Only,2:Inverter Only,3:On,4:Off
   obj-h00033-reading WR-Mode
   obj-h00033-set 1
   obj-h00037-expr $val / 1
   obj-h00037-len 2
   obj-h00037-reading BatteryLoad
   obj-h00037-set 1
   obj-h00037-showGet 1
   obj-h00038-map 0:Allowed,1:Disabled
   obj-h00038-reading BatteryCharge
   obj-h00038-set 1
   obj-h00038-showGet 1
   obj-h00039-map 0:Allowed,1:Disabled
   obj-h00039-reading BatteryFeedIn
   obj-h00039-set 1
   obj-h00039-showGet 1
   room       aussen,power




rasti

Zitat von: lynckmeister am 31 Dezember 2022, 00:05:52
Servus zusammen, also ich habe mich an diesem Thread entlanggehangelt und kann nun ohne Probleme alle Register lesen und wohl auch schreiben.
Ich habe einen MP2 den ich mit dem VenusOSRasp über Modbus anspreche. Da ich kein Smartmeter extra einbauen will, steurere ich den Mp2 über die in FHEM bereits ausgelesenen Smartmeter Werte:

Das ist mutig. Aber irgend ein Smartmeter (also sowas wie der Victron EM24) braucht es schon. Hast du anscheinend ja auch nur ein anderes, nehme ich an. Dann solltest du besser dessen Werte an die Victron Steuerung übermitteln anstatt eine völlig neue eigene Steuerung mit FHEM zu basteln. Hab ich auch irgendwo schon gesehen, wo man z.B. ein SDM 630 anstatt des Victron EM24 nimmt...

Zitat
Ich mache mir auch Sorgen , ob die Grundeinstellungen meines MP2 noch greifen, wenn ich ihm explizit alle 60 Sekunden sage, was er zu tun hat. Hält er sich dann trotzdem an die Grenzen meiner LifePo4 Batterie für Über und Unterladung ?

Ob er das tut weiss ich nicht aber im Notfall sollte ein funktionierendes BMS bei drohender Unter- oder Überladung einfach trennen. Das ist jetzt zwar keine Lösung, aber ich würde mir bei einem funktionierenden BMS keine Gedanken um die Zerstörung der Batterie machen.

lynckmeister

Danke für dein Feedback,
zu Punkt1: Ja ich habe ein  SM das die Werte an meinen Sungrow übermittelt, von dort lese ich die Daten per Modbus in den FHEM. Wieso ist es mutig? Angenommen, ich habe falsche Werte, dann speise ich entweder ins öffentliche Netz ein (obwohl ich die Batterie laden könnte) oder ich lade die Batterie aus dem öffentlichen Netz. Schlimm ist beides nicht. Über Maximalwerte kann ich auch verhindern, dass zuviel Watt angegeben werden - wobei ich mal hoffe, dass der MP2 das anfängt. Angenommen der Sungrow raucht ab und übermittelt keine Werte mehr, dann kann ich das auch erkennen und keine "alten " Werte an den MP2 schicken.... Wo glaubst du liegt weitere Gefahr, die ich übersehe ?
Abgesehen davon habe ich die Idee auch nur aufgegriffen, es gibt viele Loxone Leute , die genau das mit dem System machen. Prominenter Vertreter, der das feiert ist Jörg von meinTechBlog.de ...

Punkt2: Ja ich hab das BMS aber ich will ja eigentlich auch den MP2 mit den richtigen absobtion und float Settings betreiben... am End muss ich es testen....

sledge

Das mit dem "regelmäßig Werte an das Venus OS übermitteln" ist zumindest bei MQTT-basierter Ansteuerung so. Alles 60 Sekunden, sonst passiert da nichts.

Meines Wissens trifft das auch für all die Modbus-Register zu, in denen sich ändernde Werte erwartet werden (also alles, was unmittelbar in die Regellung einfließt). Von daher erstmal kein Störgefühl.

Was die Übermittlung der Werte angeht: Aktuell bevorzuge ich den Weg, dem VenusOS einen EM24 vorzugaukeln - in meinem Fall ist ein Fronius Smartmeter die Basis, der Rest geht dann innerhalb VenusOS durch das ESS. Für die meisten Smartmeter gibt es ja mittlerweile Plugins für VenusOS - github hilft Dir da sicherlich weiter, wahlweise die Victron-Foren.

Warum? Nun - ich wollte kein ESS usw. nachprogrammieren, sondern hier die Funktionalität von Victron direkt nutzen - erschien mir einfacher. Bisher lese ich in FHEM lediglich Daten aus (via MQTT und modbus), steuere aber nahezu nichts. Liegt aber auch daran, dass ich meinen Victron-Speicher mit meiner Wallbox (openWB) verknüpft habe und deswegen auch der entsprechende Informationsfluss zur Verfügung stehen muss.
FHEM: debian Intel-NUC / 25 x MAX!, 15 x HM-bidcos, MQTT, 3 x 1wire, 20 x Shelly, 20 x Tasmota, 12 x Yeelight, Opentherm-GW, Espeasy, alexa-fhem, kodi, unifi, musiccast, ...

Wzut

Zitat von: sledge am 31 Dezember 2022, 10:57:21
Was die Übermittlung der Werte angeht: Aktuell bevorzuge ich den Weg, dem VenusOS einen EM24 vorzugaukeln
dito , bei mir ist es ein SMA HomeManager , der mittels der Software Victron Faker dem Cerbo/RPi einen EM24 vorgaukelt - klappt erstaunlich gut da der HM alle Sekunde via Multicast seine Werte rauhaut.
Ich würde an deiner Stelle auch dem von rasti und sledge vorgschlagenen Weg folgen um mit einem anderen Gerät einen EM24 zu simulieren.
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

lynckmeister

also ich habe jetzt mein Venus OS mit fhem verbunden (darunter auch den  Multiplus und mit JKBMS) vor ein paar Tagen ist mir der RASP hängen geblieben und nach dem Neustart waren die Modubs IDs im Venus geändert. Ich habe das hier und da gelesen, passiert also nicht ganz so selten. Im Venus sind die Devices ( Muiltiplus und BMS) gleich wieder mit den neuen IDs erschienen, nachdem ich die IDs im Fhem geändert habe , kann ich auch auf die meisten Werte zugreifen. Allerdings nicht auf alle, irgendwie zeigt mir das Victron System nicht mehr alle Werte aus dem BMS ( zb Ladestand 844 und Status der Batterie 843).. also hat sich auch im Venus irgendwas verschoben und das System nimmt die Werte (die ja weiterhin durch MP und BMS geliefert werden nicht mehr an - mit dbus-spy sind sie auch nicht mehr da, sondern auf 0).
Die eigentliche Frage ist aber, wieso ändern sich die IDs ? Ich habe aus dem Augenwinkel gesehen, das sich die USB Ports wohl geändert haben in einem Script auf dem Venus habe ich nämlich com.victronenergy.battery.ttyUSB1 abgefragt, das ist jetzt com.victronenergy.battery.ttyUSB0 ...

hat da zufällig jemand auch schon solche Erfahrungen gemacht und eine Lösung oder wenigstens einen Grund gefunden ?

Chris_XXX

Hallo zusammen,
ich habe mal eine bescheidene Frage:
Der ESS min SOC ist per Modbus auslesbar und kann auch gesetzt werden. Hat aber den Faktor 10. Ich habe das ganze so definiert:
attr Victron_System obj-h02901-expr $val / 10
attr Victron_System obj-h02901-len 2
attr Victron_System obj-h02901-reading Min_SOC
attr Victron_System obj-h02901-set 1

Beim zurück schreiben wird der Wert aber auch durch 10 geteilt. Kann ich das irgendwie verhindern?

VG
Christian

Chris_XXX

Habs gefunden  ;D
attr Victron_System obj-h02901-setexpr $val * 10