Sungrow SH10.RT Modbus integration

Have you tried a shorter scanning interval fore some registers. Are there some experiences?

currently I hard-coded the modbus scan_intervals:

  • 10s for power / voltage and current values
  • 60s for battery parameters, which can be set via GUI
  • 600s for values that don’t change frequently, e.g. serial number (should in fact never change), but also energy values (total daily generation)

the values can be decreased, but I don’t see a good benefit to poll the power values faster than every 10seconds.
Do you see some benefits for - lets say 5s?

  • 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?

I recently changed the behaviours for these values:

  • “Battery Charging Power” # positive value if charging else zero
  • “Battery Discharging Power” # positive value if discharging else zero

they could be negative before, but that confused me sometimes

I have to admit, that several decisions are more or less random. But I am very open for disussions and change requests ! :slight_smile:

I think the most intervals are perfect. Maybe I will try if I would like shorter intervals for power sensors. Maybe its because everything is new. And so I look very often in my dashboard.

I have seen this also for my backup power sensors. They also sometimes have negative values. Likely a random measurement error when no load is applied.

My questions are only for understanding and to get some background.
Your work is a perfect point to start with integration of Sungrow inverters into HA. The idea to create a package is a very good idea. And easy to use.
I think own adjustments and optimizations are left to each individually.

Hi and thanks for this nice tool. I really like it and can skip solaranzeige and such tools now. In combination with water and gasmeter I have a very nice summary over consumption and gain. Two things maybe: I own a SH8.0RT which is recognized by solaranzeige using the very same id code as in your yaml. However, I see just “unknown device code”. Any idea, what is going wrong? I also use eth connection on the dedicated LAN port and everything else is working fine. And one other thing might be easily achievable: I would like to see power consumption for all 3 phases as stacked plot. would that be an improvement also for other users? Thanks for considering and also for the nice work so far.

strange…

can you give me the exact value from the device type code sensor??

e.g. type this in the template editor under “development”:

{{ states('sensor.sungrow_device_type_code') }}

Hi, the return value is 3598. If I convert it to Hex it is 0E0E.

the 0x0E0E code is not in the (probably outdated) modbus register description I have from sungrow.

So I assume that there is a newer revision of the SH8.RT (SH10.RT was updated a few months ago):

 {% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0E0F) %}
          SH10RT-V112

I will add the device code 0x0E0E. Any idea how it should be exactly called?

 {% elif ((states('sensor.sungrow_device_type_code') | int(default=0)) == 0x0E0X) %}
          SH8.0RT-v2

?

I see. iSolarcloud reports: Modellbezeichnung: SH8.0RT-V112, I guess same thing as with the SH10RT. Thanks for looking.

thank you for the input. Just committed an update including the new device type code

1 Like

Thanks for the update. Device code works now as expected, however, I have an issue with exported power now. This is stated as not available. Is this entity deprecated now or is something wrong with my configuration?

strange. Does the sensor “import power” work? Like the sensor “export power” it is derived from export_power_raw (modbus value)

Hi mkai,
Thanks for your work on this. It made the integration of a SH10-rt so easy today.
But for some reason the battery power on our device never becomes negative.
I fixed it locally by evaluating the inverter state to check if it is charging or not.
Not sure if this is firmware version dependent or not, but here is my code.

      - name: "Battery charging power" # positive if charging else zero
        unique_id: sg_battery_charging_power
        unit_of_measurement: W
        device_class: power
        state: >-
          {% if is_state('sensor.battery_power', 'unavailable') %}
          unavailable
          {% elif states('sensor.running_state')|int |bitwise_and(2) %}
                {{ states('sensor.battery_power') }}
          {% else %}
          0
          {% endif %}

      - name: "Battery discharging power" # positive if discharging else zero
        unique_id: sg_battery_discharging_power
        unit_of_measurement: W
        device_class: power
        state: >-
          {% if is_state('sensor.battery_power', 'unavailable') %}
          unavailable
          {% elif states('sensor.running_state')|int |bitwise_and(4) %}
                {{ states('sensor.battery_power') }}            
          {% else %}
          0
          {% endif %}

Cheers
Rico

Hi, export power seems the only value which is not shown. Import power works as well. I believe, it did work before, but I’m not 100% sure. Did you change something here? Otherwise I would try out to jump one version down again?

oh I just realized that I messed up with the export power.

thanks RicoKirstein for pointing that out. Will upload a fix, soon! I just need some sun :slight_smile:

should work now - can you give me a short feedback if it also works on your side?

seems to be working. thanks!
now i’m just waiting for the inverter to leave maintenance mode and some sun!

Hi, for me it is still not working. Export Power is the only sensor not available. Everything else is working fine, it seems. Is there a way to test it somehow?

I am a bit clueless here…

What is the ouput value of the sensor “running state”

Running State is used to determine, of the PV is generating, if battery is charged / discharged and if power is imported or exported. If this value is not working correctly, export power is consequently not working, too.

And one other thing might be easily achievable: I would like to see power consumption for all 3 phases as stacked plot. would that be an improvement also for other users? Thanks for considering and also for the nice work so far.

Do you mean something like this?

image

raw dashboard code:

  • chart_type: line
    period: hour
    days_to_show: 1
    type: statistics-graph
    entities:
    - sensor.meter_phase_a_active_power
    - sensor.meter_phase_b_active_power
    - sensor.meter_phase_c_active_power
    stat_types:
    - mean

This is the output. I think it is correct, right?

image

maybe, I remove everything and re-add it?

Yes, exactly. Thanks! I try to add to the Power panel in that way.