Sungrow SH10.RT Modbus integration

That may be as far as I can take you. I’m still waiting for my Sungrow inverter and solar to be installed at end of month! I am also anticipating some issues with encryption but hopefully we can overcome them :crossed_fingers:!

Bo,

I installed the ModbusTCP2MQTT successfully. Thanks for your tip. It is sending requests, but I am getting errors, which I suspect may be due to the fact that Sungrow have now implemented encryption.

I have found this project rpvelloso/Sungrow-Modbus which adds encryption to the standard ModbusTCP client, by " just replace ModbusTcpClient() with SungrowModbusTcpClient()".

I couldn’t figure out how to do that, and I have created a new thread how to swap the standard TCP with the encrypted one. The thread is " TCP Client for Sungrow Devices with encryption"

I will let you know how I go.

Anthony

1 Like

@mkai, Thank you a lot for sharing this awesome code. :pray:

I have a SH10RT with battery and WiNet-S. If somebody else is struggeling a bit, modbus with LAN was working fine for me from the beginning.
WLAN started to work after a firmware update in my case:

  • MDSP SAPPHIRE-H_03011.01.16
  • LCD SAPPHIRE-H_01011.01.18
  • WINET-SV200.001.00.P010 (WiNet-S)

I have two minor problems:

  1. Battery Power has always a positive value. No matter, if it is charging or discharging.


    (Battery power is positive day and night)

  2. on/off Sensors are not working. They are always off:

Does anybody have similar problems or even a solution?

Thank you!

I installed the ModbusTCP2MQTT successfully. Thanks for your tip. It is sending requests, but I am getting errors.

I want to install TCP Client for Sungrow Devices with encryption .
I dont know how/where to " just replace ModbusTcpClient() with SungrowModbusTcpClient()".

Could some direct me where ModbusTcpClient is located? thanks.

Anthony

sorry for the late response.

The battery power supplied by the modbus interface does not reflect the energy flow direction.

Therefore you need the on/off sensors, which unfortunately are not working for you.

I recently made several improvements to the overall integration. Can you check, if it works with the testing branch? → https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/tree/testing

If the Battery charging sensor works, it should be relatively easy to create a template sensor (look at the lower part of the modbus_sungrow.yaml for examples)

BR

Martin

Hi Martin, thank you very much for your reply and your effort for the integration. I already solved it using a battery load trend sensor checking, if % load goes up or down. :wink: Works like a charm.

Anyway I will check your updated version and let you know.

Best,
Axel

Hi Martin,

I updated the yaml. It’s working fine, but my binary sensors are still all “off”.
Thank you for the credits. :wink:

Cheers, Axel

I noticed that battery current was negative when charging, so I did the following:

modbus:
  - name: SungrowSHx
    # ...
    sensors:
      - name: Inverter battery power (raw)
        unique_id: inverter_battery_power_raw
        slave: !secret sungrow_modbus_slave
        address: 13021
        input_type: input
        count: 1
        data_type: uint16
        swap: word
        precision: 0
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        scale: 1
        scan_interval: 10
      - name: Inverter battery current
        unique_id: inverter_battery_current
        slave: !secret sungrow_modbus_slave
        address: 13020
        input_type: input
        count: 1
        # data_type: uint16
        data_type: int16 # docs say unsigned but I'm getting overflows when battery is charging
                         # changing to int shows negative amperage which makes sense.
        swap: word
        precision: 1
        unit_of_measurement: A
        device_class: current
        state_class: measurement
        scale: 0.1
        scan_interval: 10

sensor:
  - platform: template
    sensors:
      inverter_battery_power:
        unique_id: inverter_battery_power
        friendly_name: Inverter battery power
        value_template: >-
          {% set current = states('sensor.inverter_battery_current') %}
          {% set power = states('sensor.inverter_battery_power_raw') %}
          {% if 'unavailable' in [current, power] %}
            unavailable
          {% elif current|float < 0.0 and power|float > 0.0 %}
            {{ -1 * power | float }}
          {% else %}
            {{ power | float }}
          {% endif %}
        unit_of_measurement: W
        device_class: power

Edit: I had to change the data_type on the battery current to be int16, despite what Sungrow docs show. Also, from talking to other people, the value ranges in these registers might vary based on the actual battery pack you have. In my case, I have a SH5.0RS with SBR128 battery.

1 Like

Hi

Thanks for the good config!

I’ve managed to get this config up, however the on/off sensors are not working for me either, has anyone find a solution for this?

I’ve also a question regarding to charge the battery. I want to specify a certain time to charge the battery from the grid (depending on price of electricity), how do I force the system via HA to charge the battery from the grid?

Thanks

Managed to get the on/off sensors working. Connected directly to the inverter solved the problem.

Hi @mkai,

is there a way to configure a second inverter in this integration?

Thanks
Basti

1 Like

Hey @mkai,
The SH10RT has a DO relay that is a part of its load control, did you see it in your modbus scan? as I can’t see it anywhere. I also don’t seem to be able to scan my inverter with any modbus tool but your integration works and gets data so it must be working.

Hello, Thank you for your work. I have an SH10RT. I can access it via LAN-Interface as “User” and as “Admin”. But the integration is’nt delivering any value.

I have triple-checked the ip-address, modbus-port and slave-settings.

How can I troubleshoot it?

Best regards
Ekkehard

There was an issue on github for that. Unfortunately the thread starter did not share his processings. Feel free to re-open it :slight_smile:

@ [CodeRed]
Best to check the github page (especially the issues) for that.

I would start updating to the current firmware. Next step is to ensure, that you are using the SH10.RT’s native LAN port, NOT the LAN port of the dongle.

Then use some modbus TCP tool (search: modbus tool, windows / linux) to check the address and slave port.

1 Like

Thanks for your answer.
I have implemented the second inverter independently in the same way :+1:
It works perfect.

Greets
Basti

@mkai Thank you for the great work. Importing data from inverter (SH10RTV112) worked like a charme.
Saved me a lot of time and work :+1:

Only thing I would suggest for future users: Maybe you could add a hint to use the local LAN Port. Not the WiNet port. Also with current firmware the WiNet port has not all ModbusTCP capabilities. Some registers aren’t available. Even some are erroneous. E.g. grid frequency has divisor 0.01 and not 0.1 as documented.

thanks for the feedback - I added some more lines regarding the not supported WiNet port :slight_smile:

Thats great. Will help new users in the future to get the right start.

I have some question about sensor definitions:

  • Have you tried a shorter scanning interval fore some registers. Are there some experiences?
  • Why did you define the template sensors to be positive or negative depending of inverter state (e.g. sg_battery_charging_power). For this sensor comment tells it will be 0 when discharging. Maybe I am missing something?