Sungrow Binding

Hey,

i’m just using the UI-Wizard, so i’ve no configuration files present.
But as the Readme.md is a ToDo i’ve just started writing down an example.
As said, i’m not using configuration files, so this is just untested.

Please check if it works and let me know if you need further information.

BR Sönke

P.S. As there is no export function, this is not complete yet.

sungrow.things

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

sungrow.items

// 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"] {modbus:sungrow-inverter:sungrowBridge:sungrowInverter:sg-battery-information#sg-battery-power}
Number:Dimensionless battery_level "Battery Level" (batteryInformation) ["Measurement", "Energy"] {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"}

}

Thank you for your feedback!!! I’ll comment once I have my PV installed.

Hi @soenke
I’m quite new to the sungrow modbus world, what do you mean with “internal lan port”?
where is it? is it one of the two lans where there is also the bus connectors?
I’ve the battery pack so one of these lan port is already used. Can I choose of of them or is there a specif lan port to be used?

Hey,

here is a manual for the device (in german, but only the graphics are relevant):

On Page 33 is a description for the connections below the device.
There is Port 3, the Wifi-Port, which will have the Winet-S-Dongle installed to. This dongle serving the internal website and connected to lan/Wlan and will upload any data to the iSolarCloud. As mentioned in the binding readme, you can enable the modbus data provisioning via winet-s-dongle.

The port 4 is the “internal lan port” which can be used for directly access to the device data.
But (in my installation as mentioned above) this doesn’t work at all.

The battery pack (which i’ve installed too) should be attached via direct modbus on port 6.

So - if you are using the “default” setup with winet-S dongle, you should be fine to read the data with this binding.

Let me know, if you have any further questions.

BR

Sönke

Thank you for the aswer, I have a different model, the SH5.0RS, which is different from the one described on page 33: I don’t have a port named " LAN-Anschluss Steckverbinder für EMS, Router, und Data Logger"

Anyway, I’ve the Winet-S dongle (It is fully working with mobile app and isolarcloud)

but I got an error on the OH (4.0.4-stable) binding.
ModBus binding seems ok (172.7.11.104 is the IP I’ve found connecting to the winet dashboard with a browser):


but ModBus.Sungrow thing went wrong:

any suggestion?

Hey,

first of all, your device typ is listed in the spec, which is implemented within the binding
https://github.com/bohdan-s/SunGather/files/8918236/TI_20211231_Communication.Protocol.of.Residential.Hybrid.Inverter_V1.0.23_EN.pdf
So this should work in general.

The issue looks a bit like reading some modbus registers may have failed. The message within the ui doen’t show enough details, please check the openhab log files for more details.

BR
Sönke

it doesn’t work neither from QMobBus


Is there some specific configuration apart the “MODBUS” page under “transfer configuration” on the Winet-S webpage?

Hey,
as you are sucessfully connected (in openhab and qmodbus), i think it might not be a general modbus problem, but only that some registers may not be available.

Did you try only 13023 or some other registers too?
Having a look in the spec, therere are some ranges of registers, you might try one of each range.

BR Sönke

I tried just with:

  • Battery Level (13023)
  • Battery Healthy (13024)
  • Self Consumption rate (13029)

later I’ll try with more.

It looks very strange, I was able to read “holding registers” 0x03 but it continues to fail for “input registers” 0x04.

For example I was able to read the “year” (5000).

Hi,
thanks @soenke! It’s working for me using OH4.0.4, Sungrow SH10RT and battery SBR096.

I’m using the LAN port connected to my internal network for ModBus. Winet-S is using my Guest network for iSolarCloud connection.
I had to restart the Docker container after completing installation to get regular item updates based on configured pollInterval. Stop-Start the binding didn’t work.

Here’s the things config similar to the example mentioned above but without a type mismatch warning:

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

QModBus is a bid tricky. Sometimes it allowed to read register only once. Had to disconnect - reconnect after each read.

Does someone know a good Modbus Client software for MacOS?

Cheers,
Rainer

Hi
thanks for your SungrowBinding.

I’m working on a script/rule that triggers my Wifi outlet if the Exprt Power is greater than X.
But so far it doesen’t trigger something, maybe I’m doing something wrong with the state argument.

if (items.getItem('Sungrow_Inverter_Export_Power').quantityState > Quantity('10 W')) {
  items.getItem('WiFi_steckdose_kuche_switch_1').sendCommand('ON');
}

Hey,
i’m not familiar with the quantityState and don’t have any rules for this now.
Do you have any documentation on that?
I’ve found this topic Working with Number:Temperature Items in rules which discusses some pitfalls while working with Quanties in rules, it may be helpful.

Anyway, did you check, that your items have the correct dimension type?
Maybe you could check your code by logging something and check the values.

BR
Sönke

Hi Sönke thank you for your reply,
unfortunately I only got around to continuing on the topic today…

I logged the exact QuantitySate to get the correct format. With

logInfo("testlog", "state contains" + Sungrow_Inverter_Export_Power.state.toString)

Is the output: state contains -991 W - this is also correct.
However, I still can’t get the rule to work… it doesn’t matter if I try state or quantitystate

Hi there. I am sorry if this is a beginner’s question. I installed the bundle via bundle:install https://github.com/soenkekueper/openhab-addons/releases/download/sungrow-beta/org.openhab.binding.modbus.sungrow-4.0.0-SNAPSHOT.jar, but when I type bundle:start in the command line, I get this error:

openhab> bundle:start 263
Error executing command: Error executing command on bundles:
	Error starting bundle 263: Could not resolve module: org.openhab.binding.modbus.sungrow [263]
  Unresolved requirement: Import-Package: org.openhab.binding.modbus.handler

This is on OH 4.0.4. Is the bundle somehow not packaged correctly?

Never mind, I got this resolved by installing the Modbus binding through the UI. Now in the UI I have to create this kind of Thing?

Hey,
you’re too fast :wink: and right :slight_smile:
As you need a default modbus tcp or serial bridge, provided by the modbus binding, you need to install the generic modbus binding first.

The sungrow inverter thing is correct too, but, as mentioned above, you’ll need a modbus tcp bridge first.
Check out the Readme at https://github.com/soenkekueper/openhab-addons/tree/sungrow/bundles/org.openhab.binding.modbus.sungrow, there is also a configuration example and steps to activate modbus on your winet-s dongle, if required.

BR

Sönke

Thanks a lot Sönke, I will try that! My LAN cable is hooked up only to the WiNet-S right now. If I understand the previous exchanges correctly, then to access MODBUS I will still have to hook up a cable to the other LAN port, right? Will I then nonetheless need to do what you described in your README under “Enabling modbus and whitelist setting” or is that an alternative to using the inverter-internal LAN port?

Hey,

i’ve just the same setup: Just one lan cable connected to the Winet-S Dongle. So you should be fine to go with that. Just check that the modbus export is enabled in the winet-s dongle as mentioned in the docs.

The internal lan port did not worked for my inverter and as the winet-s is working fine, i’ve not investigated that any more.

BR

Sönke

Got it, thanks! I will have to ask my electrician, though, because he did not give me the admin password for the device. I will check with him.