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

Yes you can connect with modbus TCP or RTU.
For TCP you need the sdongle.
For RTU you need a USB to modbus converter.

1 Like

Here is the inverter.items file for modbus TCP

Group   gSolar "Solar data"
Group:Number:SUM   gSolalarmMinor  "Minor alarm [%d] "<error>
Group:Number:SUM   gSolalarmWarning "Warning [%d] "   <error>
Group:Number:SUM   gSolalarmMajor "Major alarm [%d] " <error>
Group:Number:SUM   gSolateleIndica  "Standelone tele indication [%d] " <settings>

Number  Rated_power                                                                                                         { channel="modbus:data:localhostTCP:slave101holding:Rated_power:number" }
Number  Maximum_active_power                                                                                                { channel="modbus:data:localhostTCP:slave101holding:Maximum_active_power:number" }
Number  Maximum_apparent_power                                                                                              { channel="modbus:data:localhostTCP:slave101holding:Maximum_apparent_power:number" }
Number  Maximum_reactive_power_fed                                                                                          { channel="modbus:data:localhostTCP:slave101holding:Maximum_reactive_power_fed:number" }
Number  Maximum_reactive_power_absorbed                                                                                     { channel="modbus:data:localhostTCP:slave101holding:Maximum_reactive_power_absorbed:number" }

String  Standalone_tele_indication       "Tele indicatie  [%s]"                 
Number  Standalone_tele_indicationbit0   "Stand by"                                                       (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit0:number" }
Number  Standalone_tele_indicationbit1   "Grid connection"                                                (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit1:number" }
Number  Standalone_tele_indicationbit2   "Normal grid connection"                                         (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit2:number" }
Number  Standalone_tele_indicationbit3   "Grid connection with derating due to power rationing"           (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit3:number" }
Number  Standalone_tele_indicationbit4   "Grid connection with derating due to inverter internel causes"  (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit4:number" }
Number  Standalone_tele_indicationbit5   "Normal stop"                                                    (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit5:number" }
Number  Standalone_tele_indicationbit6   "Stop due to faults"                                             (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit6:number" }
Number  Standalone_tele_indicationbit7   "Stop due to power rationing"                                    (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit7:number" }
Number  Standalone_tele_indicationbit8   "Shutdown"                                                       (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit8:number" }
Number  Standalone_tele_indicationbit9   "Spot check"                                                     (gSolateleIndica) { channel="modbus:data:localhostTCP:slave102holding:Standalone_tele_indicationbit9:number" }

Number  Unlocked              "Unlocked [MAP(0-1.map):%s]"   <settings>                                                     { channel="modbus:data:localhostTCP:slave102aholding:Operating_statusbit0:number" }
Number  Pv_connection         "Pv connection [MAP(0-1.map):%s]"  <settings>                                                 { channel="modbus:data:localhostTCP:slave102aholding:Operating_statusbit1:number" }
Number  Dsp_data_collection   "Dsp data collection [MAP(0-1.map):%s]"  <settings>                                           { channel="modbus:data:localhostTCP:slave102aholding:Operating_statusbit2:number" }

Number  Alarm_1bit0            "High String Voltage 2001"                                                 (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit0:number" }
Number  Alarm_1bit1            "DC Arc Fault 2002"                                                        (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit1:number" }
Number  Alarm_1bit2            "String Reversed 2011"                                                     (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit2:number" }
Number  Alarm_1bit3            "PV String Backfeed 2012"                                                  (gSolalarmWarning){ channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit3:number" }
Number  Alarm_1bit4            "Abnormal String 2013"                                                     (gSolalarmWarning){ channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit4:number" }
Number  Alarm_1bit5            "AFCI Self-test Fault 2021"                                                (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit5:number" }
Number  Alarm_1bit6            "Short circuit between phase to PE 2031"                                   (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit6:number" }
Number  Alarm_1bit7            "Power Grid Failure 2032"                                                  (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit7:number" }
Number  Alarm_1bit8            "Grid Undervoltage 2033"                                                   (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit8:number" }
Number  Alarm_1bit9            "Grid Overvoltage 2034"                                                    (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit9:number" }
Number  Alarm_1bit10           "Unbalanced Grid Voltage 2035"                                             (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit10:number" }
Number  Alarm_1bit11           "Grid Overfrequency 2036"                                                  (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit11:number" }
Number  Alarm_1bit12           "Grid Underfrequency 2037"                                                 (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit12:number" }
Number  Alarm_1bit13           "Grid Frequency Instability 2038"                                          (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit13:number" }
Number  Alarm_1bit14           "Output Overcurrent 2039"                                                  (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit14:number" }
Number  Alarm_1bit15           "Large DC of Output current 2040"                                          (gSolalarmMajor)  { channel="modbus:data:localhostTCP:slave103holding:Alarm_1bit15:number" }


Number  Alarm_2bit0           "Abnormal Leakage Current 2051"                                             (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit0:number" }
Number  Alarm_2bit1           "Abnormal Ground 2061"                                                      (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit1:number" }
Number  Alarm_2bit2           "Low Insulation Res 2062"                                                   (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit2:number" }
Number  Alarm_2bit3           "High Temperature 2063"                                                     (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit3:number" }
Number  Alarm_2bit4           "Abnormal Equipment 2064"                                                   (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit4:number" }
Number  Alarm_2bit5           "Upgrade Failed 2065"                                                       (gSolalarmMinor)   { channel="modbus:data:localhostTCPslave103aholding:Alarm_2bit5:number" }
Number  Alarm_2bit6           "License Expired 2066"                                                      (gSolalarmWarning) { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit6:number" }
Number  Alarm_2bit7           "Abnormal Monitor Unit 61440"                                               (gSolalarmMinor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit7:number" }
Number  Alarm_2bit8           "Power collector fault 2067"                                                (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit8:number" }
Number  Alarm_2bit9           "Abnormal energy storage device 2068"                                       (gSolalarmMinor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit9:number" }
Number  Alarm_2bit10          "Active islanding 2070"                                                     (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit10:number" }
Number  Alarm_2bit11          "Passive islanding 2071"                                                    (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit11:number" }
Number  Alarm_2bit12          "Transient AC overvoltage 2072"                                             (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit12:number" }
//Number  Alarm_2bit13                                                                                                       { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit13:number" }
//Number  Alarm_2bit14                                                                                                       { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit14:number" }
Number  Alarm_2bit15          "Abnormal PV module configuration 2080"                                     (gSolalarmMajor)   { channel="modbus:data:localhostTCP:slave103aholding:Alarm_2bit15:number" }


//Number  Alarm_3bit0                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit0:number" }
//Number  Alarm_3bit1                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit1:number" }
//Number  Alarm_3bit2                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit2:number" }
//Number  Alarm_3bit3                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit3:number" }
//Number  Alarm_3bit4                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit4:number" }
//Number  Alarm_3bit5                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit5:number" }
//Number  Alarm_3bit6                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit6:number" }
//Number  Alarm_3bit7                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit7:number" }
//Number  Alarm_3bit8                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit8:number" }
//Number  Alarm_3bit9                                                                                                        { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit9:number" }
//Number  Alarm_3bit10                                                                                                       { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit10:number" }
//Number  Alarm_3bit11                                                                                                       { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit11:number" }
//Number  Alarm_3bit12                                                                                                       { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit12:number" }
//Number  Alarm_3bit13                                                                                                       { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit13:number" }
//Number  Alarm_3bit14                                                                                                       { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit14:number" }
//Number  Alarm_3bit15                                                                                                       { channel="modbus:data:localhostTCP:slave103bholding:Alarm_3bit15:number" }

Number  Pv_1_Voltage        "Pv 1 voltage[%.1f V]"    <energy>                                         (gSolar)             { channel="modbus:data:localhostTCP:slave104holding:Pv_1_Voltage:number" }
Number  Pv_1_Current        "Pv 1 stroom[%.2f A]"     <energy>                                         (gSolar)              { channel="modbus:data:localhostTCP:slave104holding:Pv_1_Current:number" }
Number  Pv_2_Voltage        "Pv 2 voltage[%.1f V]"    <energy>                                         (gSolar)              { channel="modbus:data:localhostTCP:slave104holding:Pv_2_Voltage:number" }
Number  Pv_2_Current        "Pv 2 stroom[%.2f A]"     <energy>                                         (gSolar)              { channel="modbus:data:localhostTCP:slave104holding:Pv_2_Current:number" }
//Number  Pv_3_Voltage        "Pv 3 voltage[%.1f V]"                                                                         { channel="modbus:data:localhostTCP:slave104holding:Pv_3_Voltage:number" }
//Number  Pv_3_Current        "Pv 3 stroom[%.2f A]"                                                                          { channel="modbus:data:localhostTCP:slave104holding:Pv_3_Current:number" }
//Number  Pv_4_Voltage        "Pv 4 voltage[%.1f V]"                                                                         { channel="modbus:data:localhostTCP:slave104holding:Pv_4_Voltage:number" }
//Number  Pv_4_Current        "Pv 4 stroom[%.2f A]"                                                                          { channel="modbus:data:localhostTCP:slave104holding:Pv_4_Current:number" }

Number  Input_power                                                                                                          { channel="modbus:data:localhostTCP:slave105holding:Input_power:number" }
Number  Uab                                                                                                                  { channel="modbus:data:localhostTCP:slave105holding:Uab:number" }
Number  Ubc                                                                                                                  { channel="modbus:data:localhostTCP:slave105holding:Ubc:number" }
Number  Uca                                                                                                                  { channel="modbus:data:localhostTCP:slave105holding:Uca:number" }
Number  Ua                                                                                            (gSolar)               { channel="modbus:data:localhostTCP:slave105holding:Ua:number" }
Number  Ub                                                                                            (gSolar)               { channel="modbus:data:localhostTCP:slave105holding:Ub:number" }
Number  Uc                                                                                            (gSolar)               { channel="modbus:data:localhostTCP:slave105holding:Uc:number" }
Number  La                                                                                                                   { channel="modbus:data:localhostTCP:slave105holding:La:number" }
Number  Lc                                                                                                                   { channel="modbus:data:localhostTCP:slave105holding:Lc:number" }
Number  Active_peak_of_current_day                                                                                           { channel="modbus:data:localhostTCP:slave105holding:Active_peak_of_current_day:number" }
Number  Active_power         "Actieve power[%.2f Kw]"      <energy>                                (gSolar)               { channel="modbus:data:localhostTCP:slave105holding:Active_power:number" }
Number  Reactive_power                                                                                                       { channel="modbus:data:localhostTCP:slave105holding:Reactive_power:number" }
Number  Power_factor                                                                                                         { channel="modbus:data:localhostTCP:slave105holding:Power_factor:number" }
Number  Frequency                                                                                                            { channel="modbus:data:localhostTCP:slave105holding:Frequency:number" }
Number  Inverter_efficiency  "Efficientie omvormer[%.1f %%]" <settings>                               (gSolar)               { channel="modbus:data:localhostTCP:slave105holding:Inverter_efficiency:number" }
Number  Cabinet_temperature  "Temperatuur omvormer[%.1f °C]"<temperature>                             (gSolar)               { channel="modbus:data:localhostTCP:slave105holding:Cabinet_temperature:number" }
Number  Insulation_resistance                                                                                                { channel="modbus:data:localhostTCP:slave105holding:Insulation_resistance:number" }
Number  Device_status    "Apparaat status[MAP(inverter_device_status.map):%s]" <settings>             (gSolar)               { channel="modbus:data:localhostTCP:slave105holding:Device_status:number" }
Number  Fault_code            "Fault code[%d]"      <error>                                           (gSolar)               { channel="modbus:data:localhostTCP:slave105holding:Fault_code:number" }
Number  Start_up_time                                                                                                        { channel="modbus:data:localhostTCP:slave105holding:Start_up_time:number" }
Number  Shutdown_time                                                                                                        { channel="modbus:data:localhostTCP:slave105holding:Shutdown_time:number" }

Number  E_total            "Totaal opgewekt[%.2f Kwh]"    <line>                                      (gSolar)               { channel="modbus:data:localhostTCP:slave106holding:E_total:number" }

Number  E_day              "Dagelijks opgewekt[%.2f Kwh]" <line>                                      (gSolar)               { channel="modbus:data:localhostTCP:slave107holding:E_day:number" }

Number  Reactive_power_compensation_pf                                                                                       { channel="modbus:data:localhostTCP:slave108holding:Reactive_power_compensation_pf:number" }
Number  Reactive_power_compensation_qs                                                                                       { channel="modbus:data:localhostTCP:slave108holding:Reactive_power_compensation_qs:number" }
Number  Active_power_derating_percent                                                                                        { channel="modbus:data:localhostTCP:slave108holding:Active_power_derating_percent:number" }
Number  Active_power_derating_fixed                                                                                          { channel="modbus:data:localhostTCP:slave108holding:Active_power_derating_fixed:number" }

1 Like

I got two SUN200 (10KTL-M1) to integrate through SDongle and been struggling a lot to stabilize TCP connections. Turns out that dongle is doing RTU communication when it receives TCP packets so you can’t make instant modbus poll after connection is established cause it will not work.
Official support told me to wait 1-2 seconds before making a request after tcp connection is set up. I made some tests and it seems to help a lot as I haven’t seen inverters going offline or terminating connection.

Core issue and related changes to make it work reliably: [modbus] Support for an arbitrary delay after connection is made · Issue #2926 · openhab/openhab-core · GitHub.

Update with changes above I was able to get connection in a decent shape, key is not terminating TCP connection as long as it is operational and not repeating requests once they fail. I found SDongle getting very fragile in such situations. With long lasting connection it is working with 500ms/2 Hz sampling period for dc/ac power with no issues. Sample config:

UID: modbus:tcp:huawei_1
label: Huawei 1
thingTypeUID: modbus:tcp
configuration:
  timeBetweenTransactionsMillis: "250"
  connectMaxTries: "-1"
  reconnectAfterMillis: "-1"
  port: "1502"
  timeBetweenReconnectMillis: "10000"
  host: 127.0.0.1
  connectTimeoutMillis: "10000"
  afterConnectionDelayMillis: "2000"  # new parameter available in OH 3.3
  id: "1"
  enableDiscovery: "false"

An additional finding. While doing field testing I lost for a bit hope as it didn’t work after patchwork. Eventually modbus binding started to report “not our request” errors which made me thinking if there is another connection, so there was another instance of OH running which did poll SDongle. It turns out that this thing (my firmware version is V100R001C00SPC127) can’t handle two parallel TCP connections at once as it might be throwing modbus reply packets between them!

1 Like

Hi,
I can confirm that with these parameters the MODBUS connection is more stable and into LOG I have fewer connection errors.

Thanks for the suggestion!

Hi,
i tried updating with docker-compose to:

  • image: openhab/openhab:snapshot
  • image: openhab/openhab:3.3.0.M4

but this part seems not to work anymore, had to go back to 3.2

  Bridge poller batteryRW [ start=47075, length=28, refresh=5000, type="holding" ]{
  Thing data Max_charging_power                   [ readStart="47075", readValueType="uint32",                               
                                                                  writeStart="47075", writeValueType="uint32", writeType="holding", updateUnchangedValuesEveryMillis="5000000" ] //W, default: 3500

Please help!

@Andreas_Pircher openHAB 3.3 Milestone discussion - #60 by ssalonen

Great, thanks a lot!
I thought it may be some change, but I got no error message that lead me anywhere

I tried with settings from @splatch’s post like

port=502, id=2,
rtuEncoded=false,
connectMaxTries=-1, 
timeBetweenReconnectMillis=10000, 
connectTimeoutMillis=10000, 
reconnectAfterMillis=-1, 
timeBetweenTransactionsMillis=250, 
afterConnectionDelayMillis=2000,  
enableDiscovery=false 

in OH 3.3.0.M4
but it gives me more of the

Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint

warnings and errors.
Any suggestions?

PR against addons is not yet accepted, hence I am not sure if afterConnectionDelayMillis option is effective for you. Also, looking at the error, you have try 1 out of 3, try without retries.

Hi,

I got a question on the configuration. I did the Modbus TCP Slave setup through the GUI using 3.3.0-M4 where is does not allow for the following “-1” settings:

connectMaxTries=-1,
reconnectAfterMillis=-1,

The GUI says for connectMaxTries:

* Maximum Connection Tries

How many times we try to establish the connection. Should be at least *1*.

and for reconnectAfterMillis:

* Reconnect Again After

The connection is kept open at least the time specified here. Value of zero means that connection is disconnected after every MODBUS transaction. In milliseconds.

Also the new parameter afterConnectionDelayMillis is not shown on the GUI yet accepted when added through the Code window. Is the new code not active yet in 3.3.0-M4?

Thanks

Well I have more tries if you mean that:

[ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint

I think these also for me do not work properly, yet.

connectMaxTries=-1,
reconnectAfterMillis=-1,

Can you keep us update if there is a release or snapshop where it should work?

What is the question?

@splatch referring to your tcp thing configuration: I see it has been configured in MainUI. How did you manage to configure those -1 parameters there? MainUI should disallow even entering those invalid values

@Andreas_Pircher what is the error? The log line seems to be incomplete and missing the error reason

I use own config based on XML which does not validate parameters very strictly (min/max declared in thing config descriptor). For clarity I just copied what main ui shows.

What I been looking for was finding a way to make infinite reconnect attempts. Reconnect delay is anyhow related to space between operations.

Hi @ssalonen & @splatch,

you cut my question away. The question is what are the recommended connection parameters for the Modbus TCP Slave?

I just upgraded to the new milestone release 3.3.0-M5. That one comes with enhancement #12642 which enables the afterConnectionDelayMillis parameter in the GUI. It work reasonable well now, thanks! This is the configuration I’m using now:

UID: modbus:tcp:5b0337a743
label: Modbus TCP Slave WR1
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  connectMaxTries: 1
  reconnectAfterMillis: 60000
  timeBetweenTransactionsMillis: 500
  port: 502
  timeBetweenReconnectMillis: 3000
  connectTimeoutMillis: 10000
  host: 192.168.178.82
  afterConnectionDelayMillis: 2000
  id: 1
  enableDiscovery: false

I still see 3 scenarios happening, 2 recovering and 1 failing:

022-05-08 08:45:11.924 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=37000, length=70, 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 a44c09a9-9672-4c99-8f6e-17b62fee9f78]
2022-05-08 09:50:07.225 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=37100, length=39, 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 bc69f5d7-2a16-49f6-8e00-ab28b7f13ce9]
2022-05-08 09:50:09.232 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 2 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=37100, length=39, maxTries=3]). Will try again soon. The response did not match the request. Resetting the connection. Error details: org.openhab.core.io.transport.modbus.exception.ModbusUnexpectedTransactionIdException Transaction id of request (728) does not equal response (727). Slave response is invalid. [operation ID bc69f5d7-2a16-49f6-8e00-ab28b7f13ce9]
2022-05-08 09:10:06.605 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=32016, length=100, 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 4d227069-bc15-4e25-a47a-25791b664d78]
2022-05-08 09:10:08.622 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 2 out of 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=32016, length=100, maxTries=3]). Will try again soon. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 6 [operation ID 4d227069-bc15-4e25-a47a-25791b664d78]
2022-05-08 09:10:09.124 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=32016, length=100, maxTries=3]). Aborting. The response did not match the request. Resetting the connection. Error details: org.openhab.core.io.transport.modbus.exception.ModbusUnexpectedTransactionIdException Transaction id of request (513) does not equal response (511). Slave response is invalid. [operation ID 4d227069-bc15-4e25-a47a-25791b664d78]

BTW, I’m using 2 Modbus TCP Slaves, one for each inverter in a cascade configuration with a single SDongle - so same IP, but different ModbusIDs.
4 Modbus Pollers (3+1) are accessing the 2 Salves in 1min resolution (refresh: 60000). The SDongle is connected over WLAN to my home network.

Please share your setup details for further configuration optimization.

Thanks

1 Like

In my case I tested it with two+two system. I am not sure how reliable SDongle is in your case. In theory its single rtu lane, but who knows what kind of weird optimizations their firmware is trying to do…

Please disable retry on the pollers, if they fail next poll cycle will bring you data anyway. I observed that retrying had rather a bad effect on the stability of these dongles.

I upgraded to 3.3.0-M5 an set the Bridge config

rtuEncoded=false, //default: false
connectMaxTries=1, //How many times we try to establish the connection. Should be at least 1.
timeBetweenReconnectMillis=3000, //How long to wait to before trying to establish a new connection after the previous one has been disconnected. In milliseconds.
connectTimeoutMillis=10000, //The maximum time that is waited when establishing the connection. Value of zero means that system/OS default is respected. In milliseconds.
reconnectAfterMillis=10000, //The connection is kept open at least the time specified here. Value of zero means that connection is disconnected after every MODBUS transaction. In milliseconds.
timeBetweenTransactionsMillis=500, //How long to delay we must have at minimum between two consecutive MODBUS transactions. In milliseconds.
enableDiscovery=false, //Enable auto-discovery feature. Effective only if a supporting extension has been installed.
afterConnectionDelayMillis=2000  // new parameter available in OH 3.3
.......
Bridge poller slavepowermeter [ start=**37113**, length=2, refresh=2000, type="holding", maxTries=1 ]{
.....
Bridge poller slave103bholding [ start=**32010**, length=1, refresh=10000, type="holding", maxTries=1 ]{   

I get these errors now:

2022-05-08 16:57:15.776 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=32010, length=1, maxTries=1]). Aborting. Error w w: net.wimpi.modbus.ModbusSlaveException Error Code = 6 [operation ID be37bf86-04bd-4674-9a47-f0db89ff5981]
as: net.wimpi.modbus.ModbusSlaveException Error Code = 6 [operation ID d27f7fa7-6906-498b-952b-f16579b0df70] re
2022-05-08 16:57:16.285 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=32009, length=1, maxTries=1]). Aborting. Errorin wlid. [operation ID 5149feef-10f3-443d-9cbe-87a29183ec98]
as: net.wimpi.modbus.ModbusSlaveException Error Code = 6 [operation ID be37bf86-04bd-4674-9a47-f0db89ff5981] es
2022-05-08 16:57:14.755 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=37000, length=18, maxTries=1]). Aborting. Erronvr was: net.wimpi.modbus.ModbusSlaveException Error Code = 6 [operation ID e73f794c-8f2e-437f-adcf-87525dbee575]
2022-05-08 16:57:15.265 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=37113, length=2, maxTries=1]). Aborting. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 6 [operation ID cbfa243f-0520-45f0-8c3c-0aaa9c8287e8] w
2022-05-08 16:57:15.776 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=32010, length=1, maxTries=1]). Aborting. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 6 [operation ID d27f7fa7-6906-498b-952b-f16579b0df70] es
2022-05-08 16:57:16.285 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=32009, length=1, maxTries=1]). Aborting. Errornv was: net.wimpi.modbus.ModbusSlaveException Error Code = 6 [operation ID be37bf86-04bd-4674-9a47-f0db89ff5981]
2022-05-08 16:57:16.787 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=47242, length=20, maxTries=1]). Aborting. The w
response did not match the request. Resetting the connection. Error details: org.openhab.core.io.transport.modbus.exception.ModbusUnexpectedTransactionIdException Transaction id of request (1908) does not equal response (1899). Slave response is invalid. [operation ID 5149feef-10f3-443d-9cbe-87a29183ec98] es
2022-05-08 16:57:19.243 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=37784, length=4, maxTries=1]). Aborting. The rnvesponse did not match the request. Resetting the connection. Error details: org.openhab.core.io.transport.modbus.exception.ModbusUnexpectedTransactionIdException Transaction id of request (1911) does not equal response (1908). Slave response is invalid. [operation ID c41e89e2-1764-41c3-b412-411d322c38ef]
2022-05-08 16:58:05.541 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘Inverter-2’ failed: Character I is neither a decimal digit number, decimal point, nor “e” notation exponential mark. in Inverter
2022-05-08 17:00:04.052 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=32010, length=1, maxTries=1]). Aborting. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 16a9fb1c-c5e8-443d-bc25-639afb8bf547]
2022-05-08 17:00:06.060 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=37113, length=2, maxTries=1]). Aborting. The response did not match the request. Resetting the connection. Error details: org.openhab.core.io.transport.modbus.exception.ModbusUnexpectedTransactionIdException Transaction id of request (2115) does not equal response (2112). Slave response is invalid. [operation ID 1bee68a6-00a0-4579-8236-ff93c1b87126]
2022-05-08 17:05:04.449 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=37113, length=2, maxTries=1]). Aborting. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 8074e415-f73e-4157-8573-042266dbc577]
2022-05-08 17:05:06.455 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 1 failed when executing request (ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_MULTIPLE_REGISTERS, start=32010, length=1, maxTries=1]). Aborting. The response did not match the request. Resetting the connection. Error details: org.openhab.core.io.transport.modbus.exception.ModbusUnexpectedTransactionIdException Transaction id of request (2496) does not equal response (2493). Slave response is invalid. [operation ID c99feaf7-4fa7-4d49-9291-830f724d32d6]

Seem to be every 5mins or so an on the first and last poller of the Bridge, at least the last errors.
But no errors in the last 10minutes

By the way. Is anyone else experiencing error messages from the inverters, i.e. bits in 32008, 32009 or 32010 that come and go?

That’s the other end (this dongle) saying “Not now, I’m busy.”
Bit of clue where the issues lie, I’m not sure how else you can be less demanding of it though.

I saw this with parallel connections to dongle. If
You have two separate tcp connections SDongle will get crazy, it is able to send reply from first connection to the second. I collected a sample pcap with this and I am certain it happens because I saw a reply with completely odd transaction id from other openhab connection which ran much longer.

Hi @Andreas_Pircher,

you are using a super aggressive poller refresh of 2sec (refresh=2000) or 10sec (refresh=10000). You may reduce the poll rate by increasing the refresh to something larger - like I use 1min (refresh=60000). I guess the SDonge cannot cope with such a high poll rate.

Good luck!

It can under a primary condition: you have a single TCP connection to it which is retained over long time. I know that support advices polling of 5 secs or more but its not justified by anything but their promise.

This means that even if there is a failure with an payload or something else, connection should not be terminated. Otherwise you get into re-initialization cycle and re-establishment of RTU communication between dongle and inverter itself. The more reconnects you have, the less stable dongle is.
If you get two TCP connections (ie openhab and mbpoll or other agent), then SDongle will become unstable as well.

I made a test with an even more aggressive scan of 500 ms and 250 ms inter transaction gap and it worked just fine. I reverted to 5 secs to not spam storage with too much of power data. :slight_smile: I had two inverters and two dongles and both survived the same test.