Sungrow Binding

Try the default:
User: admin
Password: pw8888

Oh dear… I won’t comment on whether that worked :slight_smile:

The whitelist seems disabled but under Run Information → Forwarding Information I see nothing. Is this usual? Or should it show some IP address? Do I need to enable MODBUS somehow?

Never mind, I think I got things configured now and they do seem to be working! So thanks a lot!

For all others who are trying to get this to run on a current version of OH, I slightly updated the syntax to avoid some warnings related to an outdated format being used:

Things config:

Bridge modbus:tcp:sungrowBridge [ host="inverter", port=502, id=1, enableDiscovery=false ] {
    Thing sungrow-inverter sungrowInverter "Sungrow Inverter" [ pollInterval=5000 ]

Items config:

// Groups
Group sungrowInverter "Sungrow Inverter" ["Inverter"]
Group overview "Overview" (sungrowInverter)
Group batteryInformation "Battery information" (sungrowInverter)
Group gridInformation "Grid information" (sungrowInverter)
Group loadInformation "Load information" (sungrowInverter)

// Overview
Number:Power total_active_power "Total Active Power" (overview) ["Measurement", "Power"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-overview#sg-total-active-power"}
Number:Power total_dc_power "Total DC Power" (overview) ["Measurement", "Power"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-overview#sg-total-dc-power"}
Number:Energy daily_pv_generation "Daily PV Generation" (overview) ["Measurement", "Energy"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-overview#sg-daily-pv-generation"}
Number:Energy total_pv_generation "Total PV Generation" (overview) ["Measurement", "Energy"]  {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-overview#sg-total-pv-generation"}

// Battery information
Number:Power battery_power "Battery Power" (batteryInformation) ["Measurement", "Power"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-battery-information#sg-battery-power"}
Number:Dimensionless battery_level "Battery Level" (batteryInformation) ["Measurement", "Energy"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-battery-information#sg-battery-power"}
Number:Energy daily_charge_energy "Daily Battery Charge Energy" (batteryInformation) ["Measurement", "Energy"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-battery-information#sg-daily-charge-energy"}
Number:Energy daily_discharge_energy "Daily Battery Discharge Energy" (batteryInformation) ["Measurement", "Energy"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-battery-information#sg-daily-battery-discharge-energy"}

// Grid information
Number:Power export_power "Export Power" (gridInformation) ["Measurement", "Power"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-grid-information#sg-export-power"}
Number:Energy daily_export_energy "Daily Export Energy" (gridInformation) ["Measurement", "Energy"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-grid-information#sg-daily-export-energy"}

// Load information
Number:Power load_power "Load Power" (loadInformation) ["Measurement", "Power"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-load-information#sg-load-power"}
Number:Energy daily_direct_energy_consumption "Daily Direct Energy Consumption" (loadInformation) ["Measurement", "Energy"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-load-information#sg-daily-direct-energy-consumption"}

(Note the updated things and channel identifiers.)

On the console, I am still seeing this output here:

Failed to update item 'battery_level' because '0 W' could not be converted to the item unit 'one'

I think this has to do with the introduction of unit types in OH 4. Does anybody know how to get rid of this?

please check your battery_level item it is related to the battery-power channel.


This widget looks great (as do the others)! But what do I have to select for “Solar Power”? I see now such channel. Same for “Solar Energy”.

All the values should have an appropriate default value. So if you check the source you’ll see the correct channels: Its Total DC Power and Daily_PV_Generation.

- context: item
  default: Sungrow_Inverter_Total_DC_Power
  label: Solar Power
  name: solarPower
  required: true
  type: TEXT
- context: item
  default: Sungrow_Inverter_Daily_PV_Generation
  description: Solar Energy
  label: Solar Energy
  name: solarEnergy
  required: true
  type: TEXT
1 Like

Hmm the error goes away when I change the definition from Number:Dimensionless to Number:Power:

Number:Power battery_level "Battery Level" (batteryInformation) ["Measurement", "Energy"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-battery-information#sg-battery-power"}

Is this right, does this return a power value, not a percentage?

No, that was not what I mean.
You have to change the Item definition to the correct channel sg-battery-level

Number:Dimensionsless battery_level "Battery Level" (batteryInformation) ["Measurement", "Level"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-battery-information#sg-battery-level"}

My items are defined in the Main UI, so you can see it in the picture

Oh of course, thanks! That seems to be another mistake in the README, which I copied. I will file a pull request to fix that.

Hi again. One question. I recently realized that when I go to the inverter’s web interface it’s showing me in red letters:

Network connection is abnormal. Please check network.

The interface itself is then not doing much, it’s not functional. Data does still seem to be sent to the cloud and also via MODBUS, though.

I have connected the inverter using a LAN cable at the communication interface only.

Has any of you observed the same before?

Hey my problem is, that my openhab machine uses multiple network interfaces.
Is it possible that the modbus binding is listening on the wrong interface?

Edit: I’ve overseen that this binding is only for ‘SH’ inverters. I switched to plain modbus and it’s working now. :v:

Hey, just wondering if you were planning to add write functionality for setting battery max SOC ?
I can see there’s a HA addon that implements it - entry sg_max_soc in the following yaml file

To my understanding, the max_soc will limit the battery charging, but the inverter will override this if it needs to divert power during peak production times.
So I’d like to do the same and limit the battery charge in the mornings to make sure there is capacity to divert when the peak day sun hits.
Then after the peak has passed, remove the max_soc limit to let the battery be topped up to 100% before sunset.


According to release note for openHAB 4.2 M1 the sungrow binding should be included:

I upgraded my testsystem to openHAB 4.2.0.M1 but can’t find any sungrow binding being offered for installation. What I’m doing wrong?

Hi all.

I have been struggling to show the battery level value as a proper percentage in OH4. Right now I have the following item definition, but the percentage that is shown is always too low by factor of 100, e.g. shows 1% when the battery is full.

Number:Dimensionless battery_level "Battery Level" <oh:batterylevel> (batteryInformation,eBattery) ["Measurement", "Level"] {channel="modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-battery-information#sg-battery-level", unit="%",  stateDescription=""[pattern="%.0f %%"] }

Has anybody managed to set this up properly?



works just fine here.
This is my configuration:

label: Battery Level
type: Number:Dimensionless
category: Battery
  - Sungrow_Inverter
  - Measurement
  - Energy

As you can see, I did not specify any metadata on the item.
The thing provides a working configuration.

I had the same issue and solved it with the Gain-Option at the Thing-Channel.

Thanks, that’s helpful. Weirdly, when I modify my Item syntax accordingly, then nothing changes (Item battery_level) but when I add a new battery_level_two Item then it works.

But restarting OH then did the trick! Awesome, thanks!

@soenke I do wonder why it works for you without that profile.

hi @soenke and all others

I use OpenHab 3.x and have an SH8.0RT-20 with battery since a couple days. Found your binding and installed and it seems to work fine :slight_smile: Connection via LAN on the inverter port, not the dongle.

One thing that bothers me:

There are two “temperature” channels, for the inverter and the battery. They seem to return data in “Kelvin”. So I have applied an “offset” in the link-to-item settings to have that converted into “°C” value. But the OpenHab UI still shows “K” as the unit and I cannot see where I could change this to “C”. It’s just cosmetic but still …

I use the UI to configure everything, no text files anymore.

Any suggestion?

Hey Jens,

great that the binding works fine for you. I’ve developed and testet this with openhab 4.x so im a little surprised, that it works with openhab 3 too.

The binding delivers the value as quantity of type temperature (see Units Of Measurement | openHAB) so the framework is able to convert this to your unit. Have a try to specify a state description on the binding as mentioned for example here:

for example i’ve two metadata entries:

%.2f °C


Have a try.

BR Sönke

Thank you!

Setting the Metadata “State Description” - as it’s called in the UI - did the trick for me.

I also had to remove the manually applied offset (K to °C) since this is apparently done automatically in the background.