Reading Data from Solaredge inverters via Modbus TCP

Keep in mind that the Solaredge API lags minutes behind the actual solar production. Therefore, if you want to steer the power consumption in your house to capitalise on the actual solar power being available (i.e. for matching the power you feed to your e-car, or dumping the excess energy into a heat storage solution, that is not controlled directly by your inverter), you need real-time data, which is what the direct access to the Modbus data provides.

Best,

Thomas

Has anyone found out, which modbus address represents the battery level? I’m using a SE 5000H with LG RESU10H. The sunspec documents is pretty silent about batteries and using several tools to monitor the modbus made me NOT find anything about the battery.

Hi Thomas.
I newly own a se9k too, and am looking for ways to work with it.
I have an electronics background, but am currently absorbed with remodeling my house. It will take some months before I can dive deeper, but want to start with something basic now.
I have not yet started to use openhab or volkszähler, but am looking at both.
It seems like you have a setup quite close to what I might need.
Any chance to get in direct contact?
(Did not see a pm function here)
Ps: I am in Graubünden, Switzerland.
I think you are in Germany?

Being completely new to openHAB, i try to copy the code of @tkuehne (for inverter only).
As there are no file names given, i guess around a bit, and i do the following:

paste to
/etc/openhab2/services/modbus.cfg
change the IP

paste twice to
/etc/openhab2/items/solaredge9k.items

paste to
/etc/openhab2/sitemaps/solaredge9k.sitemap

paste to
/etc/openhab2/rules/solaredge9k.rules
Now i was not able to access the sitemap,
had to add 1st line sitemap solaredge9k label=“solaredge9k” { and last line }

Sounds like correct?
Is there anything more, or should this run?
next i’ll need to enable modbus TCP in the inverter…

As a reference for others who look for ways to get data from their solaredge inverters:


It does read directly from the inverter, by mimicking the solaredge portal server or by sniffing the traffic to the SE server.
This allows you to even get module-data if you have optimizers on your PV modules.

1 Like

So, Modbus TCP is enabled, i can get data through an excel spreadsheet/VBA thing.

But i can’t read via OH following thomas’ instructions.


Am i using the right filenames?

/etc/openhab2/services/modbus.cfg

    poll=10000

    tcp.se9k.connection=192.168.188.21:502:60:0:0:3:500
    tcp.se9k.id=1
    tcp.se9k.type=holding
    tcp.se9k.start=69
    tcp.se9k.length=50
    tcp.se9k.valuetype=uint16

/etc/openhab2/items/solaredge9k.items



    Group se9kint "Wechselrichter PV-Anlage (int-Werte)"
    Group se9k "Wechselrichter PV-Anlage"
    Number se9k_DID_int “WR Typ (int) [%d]” (se9kint) {modbus=“se9k:0”}

    // Amps acrosss all phases
    Number se9k_Amps_int “WR Stromerzeugung gesamt (int) [%d A]” (se9kint) { modbus=“se9k:2” }

    // Amps Phase A,B,C and scaling factor
    Number se9k_AmpA_int “WR Stromerzeugung Ph.A (int) [%d A]” (se9kint) { modbus=“se9k:3” }
    Number se9k_AmpB_int “WR Stromerzeugung Ph.B (int) [%d A]” (se9kint) { modbus=“se9k:4” }
    Number se9k_AmpC_int “WR Stromerzeugung Ph.C (int) [%d A]” (se9kint) { modbus=“se9k:5” }
    Number se9k_AmpSF_int “WR Skalierungsfaktor Strom (int) [%d]” (se9kint) { modbus=“se9k:6” }

    // Voltage for Phases A,B,C and scaling factor
    Number se9k_VoltA_int “WR Spannung Phase A (int) [%d V]” (se9kint) { modbus=“se9k:10” }
    Number se9k_VoltB_int “WR Spannung Phase B (int) [%d V]” (se9kint) { modbus=“se9k:11” }
    Number se9k_VoltC_int “WR Spannung Phase C (int) [%d V]” (se9kint) { modbus=“se9k:12” }
    Number se9k_VoltSF_int “WR Skalierungsfaktor Spannung (int) [%d]” (se9kint) { modbus=“se9k:13” }

    // Power and SF
    Number se9k_Watt_int “WR Leistung Erzeugung (int) [%d W]” (se9kint) { modbus=“se9k:14” }
    Number se9k_WattSF_int “WR Skalierungsfaktor Leistung (int) [%d]” (se9kint) { modbus=“se9k:15” }

    // Frequency and SF
    Number se9k_Hz_int “WR Netzfrequenz (int) [%d Hz]” (se9kint) { modbus=“se9k:16” }
    Number se9k_HzSF_int “WR Skalierungsfaktor Netzfrequ. (int) [%d]” (se9kint) { modbus=“se9k:17” }

    // Apparent Power and SF
    Number se9k_VA_int “WR Scheinleistung gesamt (int) [%d VA]” (se9kint) { modbus=“se9k:18” }
    Number se9k_VASF_int “WR Skalierungsfaktor Scheinleistung (int) [%d]” (se9kint) { modbus=“se9k:19” }

    // Reactive Power and SF
    Number se9k_VAR_int “WR Reaktive Leistung gesamt (int) [%d VA]” (se9kint) { modbus=“se9k:20” }
    Number se9k_VARSF_int “WR Skalierungsfaktor reaktive Leistung (int) [%d]” (se9kint) { modbus=“se9k:21” }

    // Power factor
    Number se9k_PF_int “WR Leistungsfaktor (int) [%d cos phi]” (se9kint) { modbus=“se9k:22” }
    Number se9k_PFSF_int “WR Skalierungsfaktor Leistungsfaktor (int) [%d]” (se9kint) { modbus=“se9k:23” }

    // Lifetime generated energy
    Number se9k_Wh1_int “WR Erzeugungszaehler Byte1 (int) [%d Wh]” (se9kint) { modbus=“se9k:24” }
    Number se9k_Wh2_int “WR Erzeugungszaehler Byte2 (int) [%d Wh]” (se9kint) { modbus=“se9k:25” }
    Number se9k_WhSF_int “WR Skalierungsfaktor Zaehler (int) [%d]” (se9kint) { modbus=“se9k:26” }

    // DC side current
    Number se9k_DCA_int “WR Strom DC Seite (int) [%d A]” (se9kint) { modbus=“se9k:27” }
    Number se9k_DCASF_int “WR Skalierungsfaktor DC Strom (int) [%d]” (se9kint) { modbus=“se9k:28” }

    // DC side voltage
    Number se9k_DCV_int “WR Spannung DC Seite (int) [%d V]” (se9kint) { modbus=“se9k:29” }
    Number se9k_DCVSF_int “WR Skalierungsfaktor DC Spannung (int) [%d]” (se9kint) { modbus=“se9k:30” }

    // DC side power
    Number se9k_DCW_int “WR Leistung DC Seite (int) [%d W]” (se9kint) { modbus=“se9k:31” }
    Number se9k_DCWSF_int “WR Skalierungsfaktor DC Leistung (int) [%d]” (se9kint) { modbus=“se9k:32” }

    // Temp Heat sink
    Number se9k_THS_int “WR Temperatur Kuehlkorper (int) [%d C]” (se9kint) { modbus=“se9k:34” }
    Number se9k_THSSF_int “WR Skalierungsfaktor Kuehlkoerper (int) [%d]” (se9kint) { modbus=“se9k:37” }

    // Operating state
    Number se9k_Status_int “WR Status (int) [%d]” (se9kint) { modbus=“se9k:38” }
    Number se9k_Status_Vendor_int “WR Status Vendor (int) [%d]” (se9kint) { modbus=“se9k:39” }

// Se9K inverter Float values
String se9k_DID “WR Typ [%s]” (se9k)
// Amps acrosss all phases
Number se9k_Amps “WR Stromerzeugung gesamt [%.2f A]” (se9k)
// Amps Phase A,B,C
Number se9k_AmpA “WR Stromerzeugung Ph.A [%.2f A]” (se9k)
Number se9k_AmpB “WR Stromerzeugung Ph.B [%.2f A]” (se9k)
Number se9k_AmpC “WR Stromerzeugung Ph.C [%.2f A]” (se9k)
// Voltage for Phases A,B,C
Number se9k_VoltA “WR Spannung Phase A [%.1f V]” (se9k)
Number se9k_VoltB “WR Spannung Phase B [%.1f V]” (se9k)
Number se9k_VoltC “WR Spannung Phase C [%.1f V]” (se9k)
// Power
Number se9k_Watt “Erzeugungsleistung Photovolaik [%.2f W]” (se9k)
// Frequency
Number se9k_Hz “WR Netzfrequenz [%.2f Hz]” (se9k)
// Apparent Power
Number se9k_VA “WR Scheinleistung gesamt [%.2f VA]” (se9k)
// Reacive Power
Number se9k_VAR “WR reaktive Leistung gesamt [%.2f VA]” (se9k)
// Power factor
Number se9k_PF “WR Leistungsfaktor [%.1f cos phi]” (se9k)
// Lifetime generated energy
Number se9k_kWh “WR Erzeugungszaehler [%.3f kWh]” (se9k)
// the follwing two items allow you to display some derived values, i.e. the energy produced in the current year.
Number se9k_kWh_Jahr “WR Erzeugung seit Jahresanfang [%.3f kWh]” (se9k)
Number se9k_kWh_Jahr_Offset “WR Offset Erzeugungaehler zum 1.1. [%.3f kWh]” (se9k)
// DC side current
Number se9k_DCA “WR Strom DC Seite [%.2f A]” (se9k)
// DC side voltage
Number se9k_DCV “WR Spannung DC Seite [%.2f V]” (se9k)
// DC side power
Number se9k_DCW “WR Leistung DC Seite [%.2f W]” (se9k)
// Temp Heat sink
Number se9k_THS “WR Temperatur Kuehlkorper [%.2f C]” (se9k)
// Status
String se9k_Status “Status [%s]” (se9k)
String se9k_Status_Vendor “Status Vendor [%s]” (se9k)

/etc/openhab2/rules/solaredge9k.rules

    Group se9kint "Wechselrichter PV-Anlage (int-Werte)"
    Group se9k "Wechselrichter PV-Anlage"
    Number se9k_DID_int “WR Typ (int) [%d]” (se9kint) {modbus=“se9k:0”}

    // Amps acrosss all phases
    Number se9k_Amps_int “WR Stromerzeugung gesamt (int) [%d A]” (se9kint) { modbus=“se9k:2” }

    // Amps Phase A,B,C and scaling factor
    Number se9k_AmpA_int “WR Stromerzeugung Ph.A (int) [%d A]” (se9kint) { modbus=“se9k:3” }
    Number se9k_AmpB_int “WR Stromerzeugung Ph.B (int) [%d A]” (se9kint) { modbus=“se9k:4” }
    Number se9k_AmpC_int “WR Stromerzeugung Ph.C (int) [%d A]” (se9kint) { modbus=“se9k:5” }
    Number se9k_AmpSF_int “WR Skalierungsfaktor Strom (int) [%d]” (se9kint) { modbus=“se9k:6” }

    // Voltage for Phases A,B,C and scaling factor
    Number se9k_VoltA_int “WR Spannung Phase A (int) [%d V]” (se9kint) { modbus=“se9k:10” }
    Number se9k_VoltB_int “WR Spannung Phase B (int) [%d V]” (se9kint) { modbus=“se9k:11” }
    Number se9k_VoltC_int “WR Spannung Phase C (int) [%d V]” (se9kint) { modbus=“se9k:12” }
    Number se9k_VoltSF_int “WR Skalierungsfaktor Spannung (int) [%d]” (se9kint) { modbus=“se9k:13” }

    // Power and SF
    Number se9k_Watt_int “WR Leistung Erzeugung (int) [%d W]” (se9kint) { modbus=“se9k:14” }
    Number se9k_WattSF_int “WR Skalierungsfaktor Leistung (int) [%d]” (se9kint) { modbus=“se9k:15” }

    // Frequency and SF
    Number se9k_Hz_int “WR Netzfrequenz (int) [%d Hz]” (se9kint) { modbus=“se9k:16” }
    Number se9k_HzSF_int “WR Skalierungsfaktor Netzfrequ. (int) [%d]” (se9kint) { modbus=“se9k:17” }

    // Apparent Power and SF
    Number se9k_VA_int “WR Scheinleistung gesamt (int) [%d VA]” (se9kint) { modbus=“se9k:18” }
    Number se9k_VASF_int “WR Skalierungsfaktor Scheinleistung (int) [%d]” (se9kint) { modbus=“se9k:19” }

    // Reactive Power and SF
    Number se9k_VAR_int “WR Reaktive Leistung gesamt (int) [%d VA]” (se9kint) { modbus=“se9k:20” }
    Number se9k_VARSF_int “WR Skalierungsfaktor reaktive Leistung (int) [%d]” (se9kint) { modbus=“se9k:21” }

    // Power factor
    Number se9k_PF_int “WR Leistungsfaktor (int) [%d cos phi]” (se9kint) { modbus=“se9k:22” }
    Number se9k_PFSF_int “WR Skalierungsfaktor Leistungsfaktor (int) [%d]” (se9kint) { modbus=“se9k:23” }

    // Lifetime generated energy
    Number se9k_Wh1_int “WR Erzeugungszaehler Byte1 (int) [%d Wh]” (se9kint) { modbus=“se9k:24” }
    Number se9k_Wh2_int “WR Erzeugungszaehler Byte2 (int) [%d Wh]” (se9kint) { modbus=“se9k:25” }
    Number se9k_WhSF_int “WR Skalierungsfaktor Zaehler (int) [%d]” (se9kint) { modbus=“se9k:26” }

    // DC side current
    Number se9k_DCA_int “WR Strom DC Seite (int) [%d A]” (se9kint) { modbus=“se9k:27” }
    Number se9k_DCASF_int “WR Skalierungsfaktor DC Strom (int) [%d]” (se9kint) { modbus=“se9k:28” }

    // DC side voltage
    Number se9k_DCV_int “WR Spannung DC Seite (int) [%d V]” (se9kint) { modbus=“se9k:29” }
    Number se9k_DCVSF_int “WR Skalierungsfaktor DC Spannung (int) [%d]” (se9kint) { modbus=“se9k:30” }

    // DC side power
    Number se9k_DCW_int “WR Leistung DC Seite (int) [%d W]” (se9kint) { modbus=“se9k:31” }
    Number se9k_DCWSF_int “WR Skalierungsfaktor DC Leistung (int) [%d]” (se9kint) { modbus=“se9k:32” }

    // Temp Heat sink
    Number se9k_THS_int “WR Temperatur Kuehlkorper (int) [%d C]” (se9kint) { modbus=“se9k:34” }
    Number se9k_THSSF_int “WR Skalierungsfaktor Kuehlkoerper (int) [%d]” (se9kint) { modbus=“se9k:37” }

    // Operating state
    Number se9k_Status_int “WR Status (int) [%d]” (se9kint) { modbus=“se9k:38” }
    Number se9k_Status_Vendor_int “WR Status Vendor (int) [%d]” (se9kint) { modbus=“se9k:39” }

// Se9K inverter Float values
String se9k_DID “WR Typ [%s]” (se9k)
// Amps acrosss all phases
Number se9k_Amps “WR Stromerzeugung gesamt [%.2f A]” (se9k)
// Amps Phase A,B,C
Number se9k_AmpA “WR Stromerzeugung Ph.A [%.2f A]” (se9k)
Number se9k_AmpB “WR Stromerzeugung Ph.B [%.2f A]” (se9k)
Number se9k_AmpC “WR Stromerzeugung Ph.C [%.2f A]” (se9k)
// Voltage for Phases A,B,C
Number se9k_VoltA “WR Spannung Phase A [%.1f V]” (se9k)
Number se9k_VoltB “WR Spannung Phase B [%.1f V]” (se9k)
Number se9k_VoltC “WR Spannung Phase C [%.1f V]” (se9k)
// Power
Number se9k_Watt “Erzeugungsleistung Photovolaik [%.2f W]” (se9k)
// Frequency
Number se9k_Hz “WR Netzfrequenz [%.2f Hz]” (se9k)
// Apparent Power
Number se9k_VA “WR Scheinleistung gesamt [%.2f VA]” (se9k)
// Reacive Power
Number se9k_VAR “WR reaktive Leistung gesamt [%.2f VA]” (se9k)
// Power factor
Number se9k_PF “WR Leistungsfaktor [%.1f cos phi]” (se9k)
// Lifetime generated energy
Number se9k_kWh “WR Erzeugungszaehler [%.3f kWh]” (se9k)
// the follwing two items allow you to display some derived values, i.e. the energy produced in the current year.
Number se9k_kWh_Jahr “WR Erzeugung seit Jahresanfang [%.3f kWh]” (se9k)
Number se9k_kWh_Jahr_Offset “WR Offset Erzeugungaehler zum 1.1. [%.3f kWh]” (se9k)
// DC side current
Number se9k_DCA “WR Strom DC Seite [%.2f A]” (se9k)
// DC side voltage
Number se9k_DCV “WR Spannung DC Seite [%.2f V]” (se9k)
// DC side power
Number se9k_DCW “WR Leistung DC Seite [%.2f W]” (se9k)
// Temp Heat sink
Number se9k_THS “WR Temperatur Kuehlkorper [%.2f C]” (se9k)
// Status
String se9k_Status “Status [%s]” (se9k)
String se9k_Status_Vendor “Status Vendor [%s]” (se9k)

/etc/openhab2/sitemaps/solaredge9k.sitemap

sitemap solaredge9k label="solaredge9k" {

    Text item=se9k_Watt {

      	Frame label="Wechselrichter SE9k" {
                Text item=se9k_Watt
                Text item=se9k_kWh
                Text item=se9k_kWh_Jahr
      		Setpoint item=se9k_kWh_Jahr_Offset  minValue=-100000 maxValue=100000 step=0.1
                Text item=se9k_Hz
      		Text item=se9k_VA
                Text item=se9k_VAR
                Text item=se9k_PF
      		Text item=se9k_Amps
      		Text item=se9k_AmpA
                Text item=se9k_AmpB
                Text item=se9k_AmpC
                Text item=se9k_VoltA
                Text item=se9k_VoltB
                Text item=se9k_VoltC
                Text item=se9k_DCA
                Text item=se9k_DCV
                Text item=se9k_DCW
                Text item=se9k_THS
                Text item=se9k_Status
                Text item=se9k_Status_Vendor
      	}
      	Group item=se9kint label="Werte SE9K Wechselrichter (int)"
      }
}

The file names look correct. The rules file seems to be the same as the items file, contentwise. If that is not a copy&paste error of the post, this would be wrong. Also, post/look at the /var/log/openhab2/openhab2.log if it still does not work after the correction, to geht a hint about what‘s going on.

Hi everyone!

@tkuehne 's great description about the modbus set up made me wonder if we could make this more userfriendly, so I’ve came up with a dedicated sunspec binding.

It uses the openhab2 compatible modbus binding from @ssalonen which is currently awaiting integration into the main openhab branch.

The sunspec addon supports reading data from inverters (single/split/three phase) at the moment but if someone can help me with testing I’ll add support for meters as well. (I do not have access to a smart meter)

Code can be found here, but if any of you would like to try out I can send the prebuild packages.

I would be very glad to get feedback testreports from you!

2 Likes

Hi

Thanks for creating this code to be used with modbus…
I have last we got a SolarEdge system and i have already got it to work. I really love that it picks up the data locally, that makes it both fast and more important i don’t have to trust external servers to get my information.

Most things worked with just copy paste but there was some problems with " and ”, yes they look almost the same but not the same in the editor. I guess this is some copy paste problem between systems.
I have also translated most things to Swedish now but i am lacking the correct term for Apparent Power and Reactive Power so if there are anyone that knows the electrical terms in Swedish please feel free to reply here…

But i have still one problem with the site map. The “Setpoint item=se9k_kWh_Jahr_Offset”, i cant get this to work. When i try to press it in the android app the app crashes and to be honest i don’t know what is should be used for. Anyone that can explain to me?
I would guess the crash is general and has nothing to do with this feature.

So a big than you Thomas Kuehne for making this really detailed and simple to use post, I would not have been able to do this feature myself but now i have a mush better understanding of how modbus is working.

Hi Thomas, I just got a SolarEdge inverter and same ModBus meter as you have but find that (excepting for the Common + Identification values) all of the meter 1 values (addresses 40190 onwards) are being reported as either 0 or 32768. The inverters own values are being reported correctly. Did you have any issues with the meter or did it just work? Many thanks. Ian.

Hi Ian,

It just worked. Does your inverter show you correct values for the meter in it‘s display? If not, maybe there is a modbus ID or other configuration error.

Best,

Thomas

Thanks for the reply, the meter readings (instantaneous grid import / export power) look fine when I check them on the inverters LCD screen. It’s a single phase meter (C_SunSpec_DID=201) and reports it’s C_Model as WND-3Y-400-MB when queried via Modbus over TCP from the inverter.
The meter shows up in the inverters RS-485 status menu as RS485-1 Dev=MLT Prot=01 ##=01. The solar edge meter installation guide example seems to suggest that this should be Dev=MTR Prot=WN but I don’t really know what impact that has.

Ian.

WN stands for WattNode, and your meter is a Wattnode Device. I guess I would switch it to Dev=MTR Prot=WN and try if this changes things.

Hallo tkuehne,
ich denke ich habe die selbe Konfiguration (Solaredge WR,…) und möchte Daten via Excel File auslesen.
Habe am WR Modbus TCP mit Port 502 aktiviert. bekomme aber keine Werte.
Eventuell irgendwelche Tipps für mich woran es liegen kann ?
Pingen kann ich den WR, bin aber kein VB Programmierer oder ähnliches und kann dem Code weiter oben nur bedingt folgen.

danke

Hallo Harald,

ich habe leider keine Ahnung, was Du anstellen willst, da Du nicht genau beschreibst, wie Dein Setup aussieht, und welche Tools Du benutzt, damit Du die Daten ins Excel wandern sollen. Du mußt ja mindestens noch ein Stück Zusatzsoftware haben, die eine Modbus TCP Verbindung zum Wechselrichter aufbaut und bestimmte Register ausliest.

Grüße,

Thomas

Hallo Thomas,

danke für die Rückmeldung.

Ich habe einen Solaredege Wechselrichter mit Energiezähler verbunden über RS485

Der WR ist via Ethernet vernetzt und meldet so auch die Daten zum Solaredge Portal.

Das alles funktioniert soweit.

Ich habe in div. Foren gelsen das ich diese Daten auch via Modbus TCP auslesen kann und habe dazu eine Excel Datei gefunden die genau das machen soll.

Bekomme aber leider keine weitere Unterstützung.

Ich habe am WR Modbus mit Port 502 aktiviert und sieht auch gut aus. Nun habe ich mit div. Modbus TCP Programmen versucht Daten auszulesen. Leider ohne Erfolg.

Daher meine Frage ob und wenn ja wie dies bei dir funktioniert. Ist dies eine selbstgeschriebene Exe Datei in VBA … ? oder ähnliches

Auch fehlt mir hier die Aussage ob nun der Solaredge WR der Modbus TCP Master ist oder der Slave ?

Leider bekomme ich vom Solaredge Support auch keine weitere Unterstützung ausser das es gehen sollte.

Vielleicht kannst du mir hier noch ein paar Tipps geben wie ich die Modbus TCP Schnittstelle testen kann.

Oder bin ich hier falsch und du liest die Daten über RS485 aus ??

danke

Harald

Sorry to interrupt, @harsch and @tkuehne, but you should be discussing in english so that everybody understands.

1 Like

You are right Mikka. Harald was looking for support to read Modbus data from his SE inverter via Excel.

@Harald, I am still quite lost how your setup actually looks, since you are not saying which tool exactly you are trying to use and how you configured it. “I use an Excel file” is kinda not enough level of detail to make an educated guess.

In principle, you need a system to make the TCP connection to the modbus port on the inverter and have it send the proper read commands to read the registers. And if done correcty, this “just works”, there is nothing you need to set up on the inverter apart from enabling it. the only thing that might be woth trying is to disable and enable modbus on the inverter just before you start data collection to restart the modbus server.

For us folks using openHab, the Modbus binding which comes with openhab is this system, and the configs that I have been discussing above tell the community which registers to read and how to extract and calculate the correct values from the register content.

Best,

Thomas

Hallo @tkuehne,

  I think you probably mixed up two Harald's. You might mean @harsch.

  But this is a very interesting discussion...

Greetings,
Harald

Hi,
sorry
but Problem is already fixed.
There were problems at the modbus tcp kommunikation from Solaredge at my version of their firmware.
Firmware update and then the modbus tcp komm. did work.

Thanks
Harsch