Skip to content
View in the app

A better way to browse. Learn more.

Power Forum - Renewable Energy Discussion

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Goodwe 5048ES Protocol reverse engineering

Featured Replies

It seems various inverter models and/or firmware versions slightly differ in the response data (resp. their lengths).
So I've replaced the primitive response length check with proper checksum and response type validation.
Now it should be more robust in respect to different inverters.

  • Replies 58
  • Views 26.4k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Sooo, I've had a bit more time to fine tune and verify the data. I've also managed to expose a few more bits of info from the packets; it's about at a point where there's enough identified data to be

  • Hi see https://github.com/mletenay/home-assistant-goodwe-inverter/blob/master/custom_components/goodwe/goodwe_inverter.py for detail and say thank you to https://github.com/mletenay 

  • Aaaaand we have liftoff. Still a few bugs to sort out with the parsing of the power figures but success! There's a loooot more info available from the integration but I'll add that once everything has

Posted Images

So just a brief update.  I installed the openhab TCP/UDP binding and installed Packet Sender on my laptop to mimic the Goodwe.  Something unusual is going on as PacketSender did not provide the IP address of the OH Raspberry Pi as "sender".  So I'm parking that idea for now.

As an alternative, I took a Wemos board I have and wrote some code to send the UDP packet to the Goodwe.  The "0x00" initially gave some problems but I figured it out (I did say I'm a novice) and voila, the wemos is getting the data from the Goodwe!  Next I'm going to add the MQTT code, decipher the incoming message and send it to OH via the (existing) MQTT broker.  Finally I can see this working!

The neat thing about this solution is it should work for any home automation system that uses a MQTT broker.

So quick question.  I find it fairly easy to get data that uses only one address, for example SOC from address 33.  But how do I translate data across two addresses into a single value, for example [7,8] into PV1 voltage?

 

  • Author

That really depends on your coding language you use, but have a look at combing two bytes into a word. In C it’s easy, you just bit shift the high address with 4 bits and add the low address (hbyte <<4 + lbyte). That’s the most efficient way of doing bitwise operations, but it depends, like I said, on the high level language you using.

I'm coding the wemos using arduino's IDE.  For the SOC I use:

   BatterySOC = (int) incomingPacket[33];

If I understand bit-shifting correctly, I basically need to do this:

    n1 = (int) incomingPacket[7];
    n2 = (int) incomingPacket[8];
    PV1V = (n2*16 + n1) /10;                    //Divide by 10 for the single decimal

But the math doesn't seem to work out.  Using the example in your second post, 0x0B = B1011 and 0xA4 = B10100100 needs to give 298V.  If I bitshift 0xA4 and add 0x0B I get 2635.  This is the first time I come across bitshift and all help is appreciated!

 

I think I got it.  I basically have to put the two address together and convert the resulting hex to decimal.  I think that means bitshifting by 8 though.

 

Bit shift by 8, but it is a big endian encoding so the most significant byte is on the left.
Plus be aware some values need some (sign) conversion magic "if value > 32768 then value = value - 65535".
Look at the python sources, they are pretty self descriptive.
 

... and of course some values are signed.
In C you should do something like this:
 

#include <stdint.h>
// 2 byte values
(int16_t)((uint8_t) incomingPacket[0] <<  8 | (uint8_t) incomingPacket[1])
// 4 byte values
(int32_t)((uint8_t) incomingPacket[0] << 24 | (uint8_t) incomingPacket[1] << 16 | (uint8_t) incomingPacket[2] << 8 | (uint8_t) incomingPacket[3])

 

 

So my wemos is working and I'm getting the values and transmitting via MQTT.  Thanks for all the help!

I do need a bit of clarification on some of these readings:

  1. pgrid: On-grid Power (EzMeter) = 5 W   (Is this the draw from the grid?)
  2. pload: On-grid Power = 143 W   (And this the mains load?)
  3. total_power: Total Power = 427 W   (I have no idea what this is)

 

 

 

  • 3 weeks later...

I contribute with this program that runs on Windows Xp, 7, 8.1 and 10. I congratulate first of all the creator of this thread: @gbyleveldt, and a contributor whose Python code published on Github, @mletenay  were the inspiration and provided me with the basic information to be able to make this program that I share with the Power Phorum community, for all those owners of Goodwe Power Inverters, only for Series: ES.
I regret not being able to make adjustments for other series such as ET for example, for the simple reason that I do not have another power inverter to carry out the corresponding tests.
I leave the link of the download thread. In the .zip file are the installation instructions, which are very simple
I added a packets received and errors detected counter.
You can also change the reading time of the values that are running. Minimum 1000 milliseconds.
Good. Once installed, you only need to know the IP of the inverter within its own LAN network.
It is important to note that it is only possible to run one instance of interrogations by UDP, in other words, it is not possible to connect through the EzManage or PVMaster application together with this program simultaneously.
I have tried to reproduce with certain limitations the behavior of the LEDs in the screen image so that it corresponds to those of the Power Inverter.
Any errors detected, comments or suggestions are welcome in this thread or in the software download thread, whose thread is:

@g

  • Author
4 hours ago, Cef said:

I contribute with this program that runs on Windows Xp, 7, 8.1 and 10. I congratulate first of all the creator of this thread: @gbyleveldt, and a contributor whose Python code published on Github, @mletenay  were the inspiration and provided me with the basic information to be able to make this program that I share with the Power Phorum community, for all those owners of Goodwe Power Inverters, only for Series: ES.
I regret not being able to make adjustments for other series such as ET for example, for the simple reason that I do not have another power inverter to carry out the corresponding tests.
I leave the link of the download thread. In the .zip file are the installation instructions, which are very simple
I added a packets received and errors detected counter.
You can also change the reading time of the values that are running. Minimum 1000 milliseconds.
Good. Once installed, you only need to know the IP of the inverter within its own LAN network.
It is important to note that it is only possible to run one instance of interrogations by UDP, in other words, it is not possible to connect through the EzManage or PVMaster application together with this program simultaneously.
I have tried to reproduce with certain limitations the behavior of the LEDs in the screen image so that it corresponds to those of the Power Inverter.
Any errors detected, comments or suggestions are welcome in this thread or in the software download thread, whose thread is:

@g

Nice, awesome interpretation there! Glad you came right with it.

Hi
I posted a short video on youtube for you to see at work: https://youtu.be/S2CSYPYRD-Q

I acknowledge that when I started programming, I had my doubts about sending commands to my Power Inverter as this was not original Goodwe information.
I decided to take the risk to see the seriousness of the work of the members of the Forum whom I thanked in my previous Post.
As published by @mletenay in your Github code there are at least 3 Interrogation Commands that can be sent by UDP to the Goodwe ES Series.
In this Program I use 2 of them:
The 1st.) Interrogation for the Data of the Power Inverter Model, Serial Number and Software Versions.
The 2nd.) Is the one corresponding to the data that is running or live values, I launch it every period of time selectable by the User. I placed a limitation in the program so that a time less than 1,000 milliseconds cannot be selected for reasons of stability of the WIFI KIT of the Power Inverter. When I tried with 300 milliseconds I lost connection with WIFI and had to do a Hard Reset of the WIFI Board 🙄
I am afraid of the 3rd Command 😬👹... since it would theoretically change the Inverter Operating Mode, which is why I neither tested it nor am I going to incorporate it into the program in any future version.

Considerations:
1.) In my system I use Lead acid batteries, so there are some parameters that I have not been able to see if they are correct. I ask someone with lithium ion batteries if they can test it and let me know in case of any errors.

2.) There are data provided by the power inverter that are erroneous and I do not know why. For example, the Values indicated in e_day (e_today in EzManage) and e_total do not coincide with the real PV Energy produced that can be observed in the Goodwe WEB SEM PORTAL. I generated an Incident Ticket at Goodwe but they still haven't answered me.

3.) In the case of my lead-acid batteries, when they are fully charged (SOC = 100%) and in a float state of charge, the Inverter reports both by UDP to the PV Master and EzManager applications and to the SEM PORTAL a load close to 130 Watts (per positive amperage) totally false or incorrect.

4.) The Household Consumption value (which must be calculated since it is not the "BackUp Loads Power" value) is slightly higher than the Real one. The actual was determined by an Eastron Meter at the Power Inverter Back Up Loads Output.

Edited by Cef
Error in text

  • Author

Hi, let me answer

1. Very few of us run Lead Acid batteries. I believe there’s special firmware for that because the latest Goodwe doesn’t support LA anymore

2. That’s a known issue. The PV generated data from the inverter does not correspond with SEMS. I’ve used an accumulator approach in Home Assistant to calculate the data directly from measured PV over time, which resets at midnight.

3. Just remember that there’s self dissipation of the inverter as well. It’s not 130W though; closer to 50W from what I can see

4. See point 2, same issue. And same approach to get the correct data.

Hi @gbyleveldt and thanks

On 2020/11/08 at 12:11 PM, gbyleveldt said:

...I believe there’s special firmware for that because the latest Goodwe doesn’t support LA anymore

Exact. There are special Goodwe firmwares for Lead Acid batteries and they work very well (for me at least). Likewise, I do not agree with you regarding the Users, since their base, even in this forum, is important. There is a contradiction in Goodwe, since in its current advertising it clearly says in the Batteries section: Lead-Acid and Ion-li. While Goodwe does not guarantee "proper operation" due to known temperature correction and load parameters, it continues to support it.

 

On 2020/11/08 at 12:11 PM, gbyleveldt said:

...I’ve used an accumulator approach in Home Assistant to calculate the data directly from measured PV over time, which resets at midnight.

Yes perfect if the information is not exact, there is no other way 🙂 I do it in the same way but I would not use the information via UDP over WIFI. It is not reliable unless you have a repeater nearby or your signal is higher than 80% due to daily natural variations.
If it would be more so if Goodwe had an RJ45 connector, or by taking the information directly from the RS485 port by MODBUS. The problem is the protocol. Goodwe gives you the Information if you want. The problem is that they make you sign 2 (two) Confidentiality agreements. They sent them to me in .pdf so that I could send them signed, but after reading them I preferred not to, because that way I have total freedom to speak, develop and share my own software with whoever I want, since the solution I use is extraordinarily exact and for any Power Inverter.

On 2020/11/08 at 12:11 PM, gbyleveldt said:

there’s self dissipation of the inverter as well. It’s not 130W though; closer to 50W from what I can see

The consumption of my current inverter on average is between 65 to 66 Wh, this is at night, isolating all other input / consumption, when there is no PV power and the batteries are on StandBy, measuring what is injected into the meter from the grid and what is consumed by the Loads of the BackUP Side. But the differences shown in the the Batterys by the UDP and in the SEMS Portal are greater in the floatation status... Maybe some of the internal sensors of my Goodwe device do not work well 😒...

Actually my main interest in this form of data extraction is that there is data that I now obtain by UDP that complements my own monitoring and control system, these are: voltage and amperage of each PV string separately, Internal temperature of the Inverter and start to record historically in real time the "Error codes:" (Bytes 55 to 58), which in the next version will be included together with an automatic search for the Power Inverter in the LAN to avoid having to know the IP.

Thanks for everything.

 

 

 

Edited by Cef
Error with image

  • 1 month later...

Hi. I was able to extract the self-defined Battery Data, by decoding one of the commands that are sent by the PV Master application to the inverter on a regular basis. As @gbyleveldt commented at the beginning of this thread, there are different chains of commands that are sent to the Goodwe to port 8899.
I discovered that in one of them is the information of the self-defined battery parameters entered by the user through the PV Master App.
The command string in bytes is: 0xaa, 0x55, 0xc0, 0x7f, 0x01, 0x09,0x00, 0x02, 0x48
The answer is a 95 byte string and the data is as follows, assuming the 1st Byte is number 1 (shift -1 for Python lovers), in Big Endian format, as explained elsewhere in this thread, for those data that involve 2 bytes the precision is: 0.1
Byte 31 (Integer) = Battery Capacity (Amper)
Bytes 32 and 33 (Value obtained divided by 10) = Load Voltage (Volts)
Bytes 52 and 53 (Obtained value divided by 10) = Float Voltage (Volts)
Bytes 54 and 55 (Value obtained divided by 10) = Float Current (Ampere)
Byte 57 (Integer) = Float Time (Minutes)
Byte 82 and 83 (Value obtained divided by 10) = Load Current (Amper)

As additional information for developers, the verification value for the string is = "0x189" for this command

  • 1 month later...
  • 3 weeks later...

Awesome work people! Seems there are various working solutions to read data from the inverter. 

 

How about writing data/settings to the inverter? - 

Using PV Master app, a user is able to change inverter modes and "advanced settings". Has anyone been able to reverse-engineer a way to write/change settings on the inverter without using the app? 

Reason I'm asking is, scheduling functions in the app are rudimentary. I would dearly like to change modes and SOC requirements based on a schedule or time.  

4 hours ago, PowerVan said:

Awesome work people! Seems there are various working solutions to read data from the inverter. 

 

How about writing data/settings to the inverter? - 

Using PV Master app, a user is able to change inverter modes and "advanced settings". Has anyone been able to reverse-engineer a way to write/change settings on the inverter without using the app? 

Reason I'm asking is, scheduling functions in the app are rudimentary. I would dearly like to change modes and SOC requirements based on a schedule or time.  

I have not done it, but of course it is possible.
Just as there are Read commands, there are a good number of Write commands. But it is a dangerous terrain, even for those who know what he is doing, if he does not have direct information from the manufacturer and above all "updated"
Now, if you have an idea of programming and the UDP protocol, the Reverse Engineering work (only for reference and in a general way) would be the following:
1) While the android App "Packet Capture" or any other packet capture application is running, enter the PV Master App.
2) Enter / change the desired values with the PV Master application, as you normally do.
3) From the Packet Capture App Try to recognize the write command sent by the PV Master, among several other read-only commands that it will find (such as a string of Bytes in HEX), that the PV Master sent to the inverter at the moment in which you set or changed the pre-existing values.
4) Reading the LOG in RAW format, Try to decode how the PV Master Application encodes the decimal values entered by the user (possibly as it does in the values that the inverter returns, this is in Big-Endian format), separating these from the bytes of the command itself.
Procedures 1) to 3) must be repeated as many times as necessary until you are sure how the PV Master encodes both the command, the values set by the user and the Byes of Success Check or CRC Value that will be returned in a response from the current inverter.
5) Program the application or routine in the language of your preference.
6) Try your own Power inverter and cross your fingers.
You just have to set it as your goal. It is a daring goal, but those who do not risk being able to do so will never be able to obtain the benefits of what occurred to them. Finally:
7) share it, what's the use of having great and useful ideas if they aren't shared?

32 minutes ago, Cef said:

I have not done it, but of course it is possible.
Just as there are Read commands, there are a good number of Write commands. But it is a dangerous terrain, even for those who know what he is doing, if he does not have direct information from the manufacturer and above all "updated"
Now, if you have an idea of programming and the UDP protocol, the Reverse Engineering work (only for reference and in a general way) would be the following:
1) While the android App "Packet Capture" or any other packet capture application is running, enter the PV Master App.
2) Enter / change the desired values with the PV Master application, as you normally do.
3) From the Packet Capture App Try to recognize the write command sent by the PV Master, among several other read-only commands that it will find (such as a string of Bytes in HEX), that the PV Master sent to the inverter at the moment in which you set or changed the pre-existing values.
4) Reading the LOG in RAW format, Try to decode how the PV Master Application encodes the decimal values entered by the user (possibly as it does in the values that the inverter returns, this is in Big-Endian format), separating these from the bytes of the command itself.
Procedures 1) to 3) must be repeated as many times as necessary until you are sure how the PV Master encodes both the command, the values set by the user and the Byes of Success Check or CRC Value that will be returned in a response from the current inverter.
5) Program the application or routine in the language of your preference.
6) Try your own Power inverter and cross your fingers.
You just have to set it as your goal. It is a daring goal, but those who do not risk being able to do so will never be able to obtain the benefits of what occurred to them. Finally:
7) share it, what's the use of having great and useful ideas if they aren't shared?

Thanks for the excellent pointers!
 

My knowledge of UDP is limited at the moment (but surely not rocket science?). I'm hoping I can build upon or reuse @mletenay's excellent python code base. Although I don't use Home Assistant...yet. The fundamental UDP command structure is there already. 

I'll share more in the coming weeks.

On 2020/10/14 at 10:04 PM, Niel said:

So my wemos is working and I'm getting the values and transmitting via MQTT.  Thanks for all the help!

I do need a bit of clarification on some of these readings:

  1. pgrid: On-grid Power (EzMeter) = 5 W   (Is this the draw from the grid?)
  2. pload: On-grid Power = 143 W   (And this the mains load?)
  3. total_power: Total Power = 427 W   (I have no idea what this is)

 

 

 

I need to get live data from the inverter and send it to an Allen Bradley plc via RS232. I thought I could get it using an esp8266 or similar. My programming knowledge is very limited, but I think a friend of mine could help me adapt your code if you could share it. Would you like to share your code? I just need to get the inverter data, then I prepare it and send it to the plc.

 

Edited by Pandarojo
Text Format

  • 1 month later...

Hi guys.

i was amassed to find people that actually do what you do!!

I was Googling for this inverter communication protocol when i saw your forum and now i have a hope that i might can get some help.

I convinced my son to buy the Goodwe 5048ES     because of the 5Kw backup capacity it has.

I ordered from China a LiFePo4 batterie bank in the form of Four 10Kh batteries From Felicity Solar. (Model 48200)

I installed them in parallel and i have a 40Kh bank at48v nominal.

The problem is that the inverter is not recognize the  BMS of the batteries and there is no communication happening.

When i go to the App i self define the battery but the discharge depth is 60% Max. That means the 40% is been never used and the inverter is turning to the grid starts importing power.

I contacted the supplier to find a solution to this only to find out that they need to have the communication protocol the inverter is using.

Goodwe is not willing to hand out any info when i called them.

I hope that someone here can help. My knowledge in electronics is nil. 

20210212_192228.thumb.jpg.71920ac4fe7a2ac7bf64d1337dd6988d.jpg

 

  • 2 weeks later...
On 2021/04/08 at 11:31 AM, GC62 said:

Hi guys.

i was amassed to find people that actually do what you do!!

I was Googling for this inverter communication protocol when i saw your forum and now i have a hope that i might can get some help.

I convinced my son to buy the Goodwe 5048ES     because of the 5Kw backup capacity it has.

I ordered from China a LiFePo4 batterie bank in the form of Four 10Kh batteries From Felicity Solar. (Model 48200)

I installed them in parallel and i have a 40Kh bank at48v nominal.

The problem is that the inverter is not recognize the  BMS of the batteries and there is no communication happening.

When i go to the App i self define the battery but the discharge depth is 60% Max. That means the 40% is been never used and the inverter is turning to the grid starts importing power.

I contacted the supplier to find a solution to this only to find out that they need to have the communication protocol the inverter is using.

Goodwe is not willing to hand out any info when i called them.

I hope that someone here can help. My knowledge in electronics is nil. 

20210212_192228.thumb.jpg.71920ac4fe7a2ac7bf64d1337dd6988d.jpg

 

That is something that the battery supplier and inverter supplier must sort out between themselves to provide a solution. You have to get the 2 parties to talk to each other. There is very little that you as client (or third party) can do. 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.