Hacking the Sungrow 5 Inverter

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.

Screenshot from 2019 02 16 17 35 00
Screenshot from 2019 02 16 17 35 00

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.

Sungrow Inverter
Sungrow Inverter

9 thoughts on “Hacking the Sungrow 5 Inverter

  1. 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 🙁

    1. Hi Travis, I’m access it over WiFi. I’m not sure of the firmware version. Thanks for the mail heads up!

  2. 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 ?

    1. 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

  3. 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.

    1. I get that error on the first few connections so I just ignore it. I’d contact the original author via github.

Leave a Reply

Your email address will not be published. Required fields are marked *