This inverter has a WiFi connection and opens ports 80 (password protected) and 502 (modbus). It’s possible to read the modbus registers. There’s a handy script that’s done all the hard work. This can import into Influx, as shown below (via grafana.
I’ve modified it slightly modified it here. As of late 2020 it works well and handled the encrypted ModBus.
Make sure to use “total_pv_power”. The others are self explanatory except for the status codes which are bit masks / secret codes. See the slightly modified grafana dashboard which is shown below.
9 thoughts on “Hacking the Sungrow 5 Inverter”
Hey!
I was googling around for info on the Sungrow SH5k-20 and I came across your website. I’ve written a modbus/mqtt interface for reading information off the inverter to integrate with my home automation: https://github.com/tjhowse/modbus4mqtt
I’m in the process of filling out the modbus address map. It’s slow going.
I’m helping someone troubleshoot an issue they’re having in talking to their inverter over modbus. They seem to think it might be related to an update for their solarinfo dongle, but I’m not sure. Are you accessing your inverter over wifi or ethernet? Do you know what version of firmware your inverter is running? I’ve removed my solarinfo dongle, and my inverter is running SH5K-V13_FW_V013 according to the LCD interface on the front.
Cheers,
Travis.
P.S. I tried emailing you at brett@brettbeeson.com.au and your mailserver timed out 🙁
Hi Travis, I’m access it over WiFi. I’m not sure of the firmware version. Thanks for the mail heads up!
If someone else ends up on this page researching sungrow inverters: It turns out that Sungrow have encrypted the modbus comms in newer versions of their inverter firmware. Fortunately someone’s cracked the encryption and posted a ModbusTCPClient wrapper here: https://github.com/rpvelloso/Sungrow-Modbus
There are further details and discussions on the topic here: https://forums.whirlpool.net.au/thread/3vxm5jy3
Thanks Travis. Another good resource is https://github.com/brettbeeson/solariot which uses those libraries.
Hello,
My name is Josue and I’m from Brazil. I would like to thank you for making your python scripts available to obtain Sungrow inverter data. I would just like a python script to obtain real-time data from registers such as the energy generated at the moment as well as self-consumption. I see that port 80 is open, but it asks for a login and password that I don’t know. another option would be on port 502 via python script. I find it annoying to use the app on android to get this data instantly, since you need to change the wifi to an SSID starting with SG-XXXXXXXX. Can you help me ?
Hi Josue, everything I’ve got is there on the site. I used the modbus interface which doesn’t need the http port 80 interface (mine too is locked). See the comments regarding the new encryption. Cheers, Brett
Hi Brett,
Trying to get this working with SG8K-D. Connects but throws this …
D:\solariot-master>python solariot.py
Load config sungrow-sh5k
Load SungrowModbusTcpClient
Connect
packet:b’hh\x00\x00\x00\x13\xf7\x04\x10v\x8d\x02qas\x1e\x07\x15Gia\xbbs\xfcQ’
pub_key:b’v\x8d\x02qas\x1e\x07\x15Gia\xbbs\xfcQ’
[ERROR] ‘ExceptionResponse’ object has no attribute ‘registers’
[ERROR] ‘grid_import_or_export’
Traceback (most recent call last):
Any ideas ? Keen to learn about decoding modbus.
I get that error on the first few connections so I just ignore it. I’d contact the original author via github.
Hi Brett, what changes did you make compared to the original script?