Sungrow Binding

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.

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?

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

BR

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?