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

Hi rossko57,

thanks for your reply.
I tried it with a other modbus client software and the same connection parameters and recieve some values.

.
I tried it with the dongle ip and inverter ip but without success.
Any ideas?

You seem to have a timeout error with your other utility as well.

@tlrider, did you somehow resolve the problem?
i am currently using the SUN2000-8KTL-M1 firmware
V100R001C00SPC145 and a SDongleA with firmware V100R001C00SPC128. My PI 3b running Openhab 3.3 is connected to the same switch as the Dongle.

2022-06-29 23:34:09.498 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=30073, length=10, maxTries=3]). Aborting. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: EOFException null [operation ID 8af19212-950a-4e53-8caa-8281c5364278]

my thing config looks like:
Bridge modbus:tcp:localhostTCP [ host=ā€œ192.168.1.104ā€, port=502, id=1, timeBetweenTransactionsMillis=1200, rtuEncoded=false, connectMaxTries=1, reconnectAfterMillis=0, timeBetweenReconnectMillis=0, connectTimeoutMillis=10000, enableDiscovery=false ]{

Bridge poller slave101holding [ start=30073, length=10, refresh=10000, type=ā€œholdingā€ ]{

    Thing data Rated_power                      [ readStart="30073", readValueType="uint32",readTransform="JS(divide1000.js)",updateUnchangedValuesEveryMillis="5000000" ]
    Thing data Maximum_active_power             [ readStart="30075", readValueType="uint32",readTransform="JS(divide1000.js)",updateUnchangedValuesEveryMillis="5000000" ]
    Thing data Maximum_apparent_power           [ readStart="30077", readValueType="uint32",readTransform="JS(divide1000.js)",updateUnchangedValuesEveryMillis="5000000" ]
    Thing data Maximum_reactive_power_fed       [ readStart="30079", readValueType="int32",readTransform="JS(divide1000.js)",updateUnchangedValuesEveryMillis="5000000" ]
    Thing data Maximum_reactive_power_absorbed  [ readStart="30081", readValueType="int32",readTransform="JS(divide1000.js)",updateUnchangedValuesEveryMillis="5000000" ]

ā€¦ and all other lines out of the config in the opening thread.

thanks for any reply.

Does that mean you are trying to run some target with two modbus masters? This is permissable with Modbus-TCP ā€¦ but not all slaves or gateways implement it.

not sure if i understand your question correctly. I think the SDongleA is the modbus master and openhab is configured as slave. The SDongle is connected to LAN and as i read several threads with timeout issues, i just wanted to express that the SDongle is connect to the same network switch.
The modbus bridge always shows as ā€œOnlineā€ in OH3.

Okay, thatā€™s clear and fine.
In fact openHAB is Modbus-TCP master.
The dongle is more complicated, because it acts as a gateway. On itā€™s serial side it acts as Modbus-RTU master.
On its TCP side, it acts as Modbus-TCP slave.

Hi oschwabe,

sorry for the late reply I was not at home.
Yes, an update to OH 3.3 solved my problem. I can now connect to the inverter an recieve all data I want.
If you need I can share my config.

Hello,

I have managed to connect to SUN2000-5KTL-M1 using WLAN-FE Smart Dongle and modbus TCP.
I am running Openhab version 3.2 on RPI3B+. I have a few items defined and they are updated by the binding. However, I have a regular warning message in the log as follows:

2022-07-07 10:24:59.416 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=32069, length=19, 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 ac0bf193-1979-4cc3-a33f-77daca5f2741]
2022-07-07 10:25:34.952 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=32069, length=19, 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 87f71476-92c2-46cd-b094-769628794c59]
2022-07-07 10:26:10.071 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=32069, length=19, 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 34e09ba7-184a-458b-8ac9-5a2dff3e98ba]

Is there a way to tune the modbus setting in OpenHab to avoid the warning ( shall I move to version 3.3 stable)? My current set up is as follows:

UID: modbus:tcp:4801b83789
label: Modbus TCP Slave SUN2000
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  timeBetweenTransactionsMillis: 1500
  connectMaxTries: 1
  reconnectAfterMillis: 0
  port: 502
  timeBetweenReconnectMillis: 0
  host: 192.168.x.x
  connectTimeoutMillis: 10000
  id: 1
  enableDiscovery: false
UID: modbus:poller:4801b83789:e626774474
label: Modbus SUN2000 Poll105
thingTypeUID: modbus:poller
configuration:
  start: 32069
  length: 19
  refresh: 30000
  maxTries: 3
  cacheMillis: 50
  type: holding
bridgeUID: modbus:tcp:4801b83789

Thank you for any replay

@RafalO I believe you need a afterConnectionDelayMillis option for that thing. Look few posts up:

This was ultimately what I had to add to stabilize dongle behavior. Iā€™d advise disabling retry on poler as well. With 30s poll cycle you better wait for another round, otherwise you risk stressing dongle too much. :wink:

2 Likes

Thank you for indicating. So I need to move to version 3.3 to have afterConnectionDelayMillis option avaiable. Then testing.

I can confirm that after upgrading to v3.3.0 and setting afterConnectionDelayMillis=2000 I do not have warnigs in the log :smiley:

Hello,

I am trying to connect the Huawei Sun2000 8KTL with openhab 3.3 using Modubus TCP
I followed these instructions:

The inverter is displayed under devices with all items. However, no values are displayed. I installed the Thing Modbus TCP Slave and set the local IP 192.168.1.184 of the Huawei WLAN dongle.
I also restarted openhab and the inverters. Without a result.
Does anyone have any idea where to start troubleshooting?
Thanks.

log:set debug org.openhab.binding.modbus

2022-09-09 13:18:16.664 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to UNINITIALIZED
2022-09-09 13:18:16.695 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from UNINITIALIZED to UNINITIALIZED (DISABLED)
2022-09-09 13:18:17.695 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2022-09-09 13:18:17.703 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from INITIALIZING to ONLINE
2022-09-09 13:18:41.352 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to OFFLINE
2022-09-09 13:18:41.356 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from OFFLINE to ONLINE
2022-09-09 13:20:03.775 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to UNINITIALIZED
2022-09-09 13:20:03.788 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2022-09-09 13:25:18.918 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to OFFLINE
2022-09-09 13:25:18.921 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from OFFLINE to ONLINE
2022-09-09 13:28:08.928 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to OFFLINE
2022-09-09 13:28:08.935 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from OFFLINE to ONLINE
2022-09-09 13:18:16.664 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to UNINITIALIZED
2022-09-09 13:18:16.695 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from UNINITIALIZED to UNINITIALIZED (DISABLED)
2022-09-09 13:18:17.695 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2022-09-09 13:18:17.703 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from INITIALIZING to ONLINE
2022-09-09 13:18:41.352 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to OFFLINE
2022-09-09 13:18:41.356 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from OFFLINE to ONLINE
2022-09-09 13:20:03.775 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to UNINITIALIZED
2022-09-09 13:20:03.788 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2022-09-09 13:25:18.918 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to OFFLINE
2022-09-09 13:25:18.921 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from OFFLINE to ONLINE
2022-09-09 13:28:08.928 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to OFFLINE
2022-09-09 13:28:08.935 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from OFFLINE to ONLINE
2022-09-09 13:18:16.664 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to UNINITIALIZED
2022-09-09 13:18:16.695 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from UNINITIALIZED to UNINITIALIZED (DISABLED)
2022-09-09 13:18:17.695 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2022-09-09 13:18:17.703 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from INITIALIZING to ONLINE
2022-09-09 13:18:41.352 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to OFFLINE
2022-09-09 13:18:41.356 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from OFFLINE to ONLINE
2022-09-09 13:20:03.775 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to UNINITIALIZED
2022-09-09 13:20:03.788 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2022-09-09 13:25:18.918 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to OFFLINE
2022-09-09 13:25:18.921 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from OFFLINE to ONLINE
2022-09-09 13:28:08.928 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from ONLINE to OFFLINE
2022-09-09 13:28:08.935 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:tcp:e10e331a0e' changed from OFFLINE to ONLINE

Hello,

Unfortunately, the log does not provide more information. I am sure the IP of Huawei WiFi Dongle is correct. An item looks like this.

The Modbus TCP interface like this:

Status is online.

Please help me :slight_smile:

You seem to have looked in the events.log
There is an openhab.log as well

I got a message

I opened openhabLog Viewer (Frontail) via browser openhabip:9001
arenā€™t the data from /var/log/openhab/openhab.log /var/log/openhab/events.log displayed here?

Yes, I think you should see openhab.log here, and that would include messages, good or bad, from the Modbus binding.
Before you can look at your inverter problem you will need to fix the logging.
Can you see any non-event log messages at all, from openHAB core or other bindings?

Thank you for your help!
I opened /var/log/openhab/openhab.log via putty and i could only find this line about modus:
2022-09-12 11:03:01.586 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated

Here is the my logfile:
openhab.log (227.6 KB)

You seem tto be having trouble with KNX IP connection, but I donā€™t think that is connected.

How is your Modbus poller Thing configured?

I only changed the IP under Things\modbus tcp Slave

UID: modbus:tcp:e10e331a0e
label: Modbus TCP Slave
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  connectMaxTries: 1
  reconnectAfterMillis: 0
  timeBetweenTransactionsMillis: 60
  port: 502
  timeBetweenReconnectMillis: 0
  connectTimeoutMillis: 10000
  host: 192.168.1.184
  afterConnectionDelayMillis: 0
  id: 1
  enableDiscovery: false