Sungrow SH10.RT Modbus integration

Hi,

I created a Modbus based integration for a Sungrow SH10.RT inverter, which should be working for
SH3.6RS, SH4.6RS, SH5.0RS, SH5.0RT, SH6.0RS, SH8.0RT, SH6.0RT, SH10RT

and maybe SH5K-20 SH3K6 SH4K6 SH5K-V13 SH5K-30

See

Please let me know, if you have any questions and comments. If there is enough demand and with some help, I can also try to create a more user-friendly GUI-based integration (but I don’t know how to do that, yet!)

Best Regards,

10 Likes

Hi @mkai, works fine on my Sungrow SH5K (it’s the original SH5k-v13 version) so can confirm working well.

@mkai it works vor SH5.0RT. But I found one issue. For the Energy dashboard are only the Total values offered, which is wrong, we need the active values there, can you please have a look into it?

Hi,

what do you mean with “active values”?

The build-in energy dashboard requires monotonic increasing “kWh values”. The reason behind this is that the measured energy values (kWh) are much more accurate than the current / momentum values (Watts) due to the scanning interval (5 seconds in my pre-defined settings)

I made some screenshots with my settings. It takes over an hour, until the dashboard displays reasonable date.

Can you check, if this works for you?

yes, this was an increadible, short and dark day (even for germany…):

Ach, deutsch ist gut :wink:
ich glaube ich habe die Energieflussgrafik falsch verstanden. Aufgrund der schlechten Produktionsraten in Deutschland ist halt im Moment nicht viel zu sehen…

Hi,

Looks very good, and will be implemented as soon as I get my solarcells installed.

Do you have any plans to include batterymanagement? Forced charging/discharging based on schedule?

Hi folks,

I’m looking at buying a Sungrow inverter, but am seeing reports online that they’re rolling out a firmware update that locks out Modbus access with encryption:

https://brettbeeson.com.au/hacking-the-sungrow-5-inverter/

Have any of you experienced this?

Hi @mkai, followed the instructions (first time doing this so forgive me if this is a simple issue to resolve) didn’t have an integrations folder already present so created one and added the modbus_sungrow.yaml file as directed, updated configuration.yaml and restarted, on boot i’m getting an error

2022-03-02 03:49:49 ERROR (MainThread) [homeassistant.setup] Setup failed for packages: Integration not found.

any ideas on what to do to troubleshoot?

Cheers

Woody

I just opened a github “todo issue” for that.

have not much time at the moment. I guess it will take a month or so… :slight_smile:

hi,

that is strange.
did you check “Configuration” → “Server Controls” → “Check Configuration” first?

Can you give us more information? E.g. Home Assistant version and maybe post your config files.

In the Github I added a screenshot for the config files. Maybe this helps?

Hi Mkai,

I ran the config check and it came back with could not find Packages, I think the issue was in the configuration.yaml I had not indented the packages line so it ws listed like:

homeassistant:
packages: !include_dir_named integrations

rather than

homeassistant:
packages: !include_dir_named integrations

I made this modification and rechecked and it passed, restarted home assistant and now can see the dashboard properly - no values in there as yet and in reviewing the system logs i’m getting alot of errors:

Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py”, line 208, in execute
self.client.framer.processIncomingPacket(response,
File “/usr/local/lib/python3.9/site-packages/pymodbus/framer/socket_framer.py”, line 153, in processIncomingPacket
self._process(callback)
File “/usr/local/lib/python3.9/site-packages/pymodbus/framer/socket_framer.py”, line 175, in _process
raise ModbusIOException(“Unable to decode request”)
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request
2022-03-03 02:25:25 ERROR (SyncWorker_6) [pymodbus.factory] index out of range
2022-03-03 02:25:25 ERROR (SyncWorker_6) [pymodbus.transaction] Modbus Error: [Input/Output] Unable to decode request
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py”, line 208, in execute
self.client.framer.processIncomingPacket(response,
File “/usr/local/lib/python3.9/site-packages/pymodbus/framer/socket_framer.py”, line 153, in processIncomingPacket
self._process(callback)
File “/usr/local/lib/python3.9/site-packages/pymodbus/framer/socket_framer.py”, line 175, in _process
raise ModbusIOException(“Unable to decode request”)
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] Unable to decode request

its a few steps forward, i’ll have to take a deeper look at the modbus_sungrow.yaml file to see what it’s looking at - could just be a module I don’t have (I don’t have a battery for example)

Cheers

Woody

So been over 2 hours now and still nothing in the dashboards constantly getting hte errors in the logs - I read that the Sungrow Modbus was encrypted and that it was possible to get the data direct from the Winet-s adaptor by using SungrowModbusWebclient instead - Is this the right process to follow and if so do you have any experience doing so? Ie where would i modify to make this work?

Cheers

Woody

FYI I have the SG8.0RT Inverter and the WiNet-S adaptor

very good that you could find out so much.

there is already an open issue (https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/issues/4) from a user with a SH6.0RS inverter with WiNet-S.

Sungrow promised a firmware update to enable the modbus WiNet support. If this connection will be encrypted is currently unknown.

So unfortunately I only see a way to integrate of your inverter by somehow scraping the website.

ok thanks so much for your help @mkai, i’ll post if i make more progress

So I took a look at that link you provided and downloaded the QmodMaster software - no dice initially then I logged onto the WiNet-S web interface as the admin, under system transfer configuration MODBUS there is an option to add IP whitelists. I added my PC to the whitelist and was able (with errors and timeouts) to get data returned. not quite sure how to translate this to the Home Assistant (already added as Whitelisted IP) but I guess it’s a step in the right direction.

Hi

I’m thinking of getting the SH10RT and a battery. What about control of the energy flow to/from the battery, can that be controlled by the integration? Can anyone confirm that it works?

/Henrik

Hi there, first time poster. I hope I haven’t missed anything too obvious.

I have a HomeAssistant Setup using Home Assistant OS on a Raspberry Pi 3. I am running core-2022.5.3 and Home Assistant OS 7.6. I already have a number of add-ons from the Official and Community Stores.

I recently installed an external SSD as I want to add monitoring of my two Sungrow SH5K-30 Hybrid inverters and I expect to need a InfluxdB and Grafana, which I have also installed.

My problem is that I cannot add the repository for the project I think may be what I need.

I want to use this project Sungrow-SHx-Inverter-Modbus-Home-Assistant by Mark Kaiser. I cannot work out how to specify the link to the repository in HomeAssistant. I keep getting error “Invalid Add-on repository!”

I have used the link from the green CODE button on the project page;
GitHub - mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant: Sungrow SH Integration for Home Assistant for SH3.6RS, SH4.6RS, SH5.0RS, SH5.0RT, SH6.0RS, SH8.0RT, SH6.0RT, SH10RT” and
GitHub - mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant: Sungrow SH Integration for Home Assistant for SH3.6RS, SH4.6RS, SH5.0RS, SH5.0RT, SH6.0RS, SH8.0RT, SH6.0RT, SH10RT”, neither work.

I have also tried to do the same for meltaxa/solariot and have encountered the same problem.

Could someone suggest what I am doing wrong.

Thanks

AC

Hi Anthony…

This is not an out of the box component nor add-on as Home Assistant already has a built-in Modbus integration. This repo merely demonstrates a working configuration.

I suggest starting by copying Sungrow-SHx-Inverter-Modbus-Home-Assistant/modbus_sungrow.yaml at 20c594987a5808c74e018942699324ce62ab86a2 · mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant · GitHub into your own configuration.yaml (or a package within it), merging modbus sections if you have others. Adjust your secrets to use the correct IP, port, etc.

Thx Bo,

I am very much a newbie with this, I didn’t realise that HA already supported Modbus, nor understand the need to add the code to configuration.yaml. I am very much a graphical user!

I am now using Modbus Client app (on my Mac) to test if I can retrieve any data. I suspect that I may have issues due to the encryption that has been reported being used by Sungrow.

But you have certainly answered the immediate question :slight_smile:

I am sure I will have more