Reading data from Huawei inverter SUN 2000 (3KTL-10KTL) via modbus TCP and RTU

I just wanted to say a big thank you for the excellent tutorial! It took me all of maybe 5 minutes to get data from my inverter.
I did my configuration in the UI and used the offset+ gain profile to set the gains but it was all smooth sailing.
I found that I had to set time between transactions to 1000 ms, which I read somewhere, but other than that, it worked “straight out of the box”.

My Modbus TCP is working for some months now.
There are still a lot of warning in the openhab log file.

Roundabout every minute:

2023-04-13 06:31:40.086 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=32069, length=9, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 1b1eb5e0-4e9d-4ee8-bbcc-5ab3c7ecff80]
2023-04-13 06:31:56.596 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=32106, length=2, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 8e14341a-f758-41ce-9f55-15f182e28488]
2023-04-13 06:33:01.588 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=32000, length=1, maxTries=3]). Will try again soon. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 83339138-1af0-4717-8bfc-5283173fc79a]

My settings:

UID: modbus:poller:slave100:slave102
label: Regular Poll 102
thingTypeUID: modbus:poller
configuration:
  length: 1
  start: 32000
  refresh: 15000
  maxTries: 3
  cacheMillis: 50
  type: holding
bridgeUID: modbus:tcp:71978dd591


UID: modbus:tcp:71978dd591
label: Modbus TCP Slave inverter
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  connectMaxTries: 2
  reconnectAfterMillis: 0
  timeBetweenTransactionsMillis: 1500
  port: 502
  timeBetweenReconnectMillis: 0
  connectTimeoutMillis: 10000
  host: 192.168.1.8
  afterConnectionDelayMillis: 2000
  id: 1
  enableDiscovery: false

I tried a lot of different settings but I can’t get rid of it.
Is this a normal behavior or avoidable?
Thanks!

I set time between transactions to 2000 ms and don’t seem to be having warnings in the logs after that.

Thanks!
Following observation:
timeBetweenTransactionsMillis: 1500
→ Warning approx. every Minute
timeBetweenTransactionsMillis: 2000
→ Warning approx. every 5 Minutes
timeBetweenTransactionsMillis: 3000
→ Warning approx. every 10 Minutes

Not perfect but better than before.

Hi,

i followed Rados “openHAB3 GIU configuration via Modbus TCP” and implement all Things, Items, ChannelLinks and Metadata from json.files. Most of the Items work very well and i see values from my Huawei Inverter. Also no Error-Messages in the Log-File after changing reaction-times.
But some Items show me “NULL” values and Channel Link in the Item is invalid. For example “Frequency” because there is no Thing called “modbus:data:slave100:slave105holdings:Frequency:number”.

So my question is: Do i have anything else to adjust?
Or is Rado’s json-file incomplete?

Thank you for your help

Hi,

Did anyone succeed in Writing one of the Holding Registers?
I’d like to alter the ‘Maximum Charging Power’ on the fly to prevent clipping later on in the day.

My Solar Panels can deliver 8 kWp, but my inverter is only rated for 5 kW (Single Phase).
Meaning that once my DC-DC coupled Battery is at 100% the production power is clipped at 5kW.

So I’d like to alter the ‘Maximum Charging Power’ of the battery to only reach that 100% at the end of the day, sending as much of the previously clipped energy to the grid instead.

When writing the 47075 UINT32 Register, I’m getting an unauthorized error:

Error (ModbusSlaveErrorResponseExceptionImpl) with write. Request: ModbusWriteRegisterRequestBlueprint [slaveId=0, reference=47075, registers=ModbusRegisterArray(00000000), maxTries=3, getFunctionCode()=WRITE_MULTIPLE_REGISTERS]. Description: ModbusSlaveErrorResponseException(error=128). Message: Slave responded with error=128 (unknown error code)

ErrorCode : 0x80
Name: No permission
Description: An operation is not allowed because of a permission authentication failure or permission expiration.

Kind regards,
Frederic Depuydt

I’ve installed 1x SUN2000-2KTL-L1 inverter @ V200R001C00SPC130 firmware level. With this firmware level it is possible to use modbus tcp without the sdongle (using port 6607 instead of 502). To open this port it is necessary to execute the following procedure (in a mobile phone with fusion app): Go to device commissioning, connect to your inverter (needs installer password), then go to Settings → Communication configuration → Router connection settings. Then, select your local wifi access point, enter your password and check the option “Local O&M”, then click Connect. It will reconnect to your access point, but this time port 6607 is open on local lan.

Fusion Solar (cloud and mobile phone app) continue to work, but as the inverter does not support simultaneous control, if you want to use the fusion app (mobile phone) to comission the inverter you have to pause OH’s bridge.

I’m using OH 4.0.0.M2

Try qModMaster. If it can can read OH will be able to read as well (but not simultaneously, you have to stop OH bridge to allow qModMaster’s access, and vice versa).

I have the 4KTL with the very same firmware. I can confirm that an additional dongle is not required (and actually does not work, so don’t buy it).
However, it didn’t work for me quite like that, there was a catch.
The inverter creates his own subnet (192.168.200.0 in my case), so you have to add a route entry for that subnet with the inverter’s IP adress as a gateway (for ex. route add 192.168.200.0 gw ). I’ve done it on my pfsense firewall, so it may be different for you.
Hope that helps.

In my case the trick was the activation of Local O&M so that port 6607 was also opened in the local wlan

Good point. I am pretty sure that I activated that, too, but it did not have the desired effect. I’ll double check as soon as I have a moment and I’ll report back.

My 2KTL only allows one device to use port 6607. If the port is being used in the 192.168.200.x lan (by OH or mobile phone) it will not work in the local wlan (and vice versa).

Is there already any way to connect to the inverter only using wifi instead of modbus? Right now, the installation where the inverter to where I want to connect to is and the server room is just too far away and therefore, passing a modbus cable would mean doing a lot of holes through concrete and it would be a massive pain.

Therefore, if there’s the possibility to connect to the inverter using wifi, that would be awesome! Even if I can only get some basic data out of it.

I’m using modbus TCP via wifi.

So in that case, since there’s already a wifi module on the inverter to use with the Huawei APP, this means I need a receiver modbus wifi dongle for RPi? Or can I simply use the IP address from my network and work with that?

Inverter’s wifi module is a master for lan 192.168.200.1 and is also a client for your own wlan (used to relay info to FusionSolar). If you open port 6607 (mine was closed by default) then you can access the inverter using your wlan (where the inverter gets an ip via DHCP).

1 Like

Perfect! I can definitely ping the IP in my network, but when I do “telnet IP PORT”, it refuses connection, so I will definitely have to talk with the installer to open that port.

Telnet is a different protocol, it will never work in port 6607. You need to use qModMaster to test if port 6607 is open. And yes, you need installer pw to open port 6607 (Settings → Communication configuration → Router connection settings. Then, select your local wifi access point, enter your password and check the option “Local O&M”, then click Connect)

1 Like

Since I am in Linux, I used netcat (which should answer if the port is open or not) “nc -zv 192.168.2.245 6607” and it refused connection as well. Also tried port 27250 which was one that the installer said was open, but even that one is refusing connection.

So I will definitely have to talk with them.

For linux you may try QModBus.