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

You can use it as a custom component: GitHub - Emilv2/huawei_solar: Home Assistant custom component for Huawei inverters.

Currently there seem to be some issues with it and the latest HA version, I will be working on it again soon.

@kreutzer_peter

If you still have issues interpreting the time, you can take a look at my python code: Emil Vanherp / HuaweiSolar · GitLab

Concerning the extra optimizer data, I also tried to access it but failed. Please tell me if you manage to get it!

Is there a way to get the SOC and SOH state of the battery storage through modbus?
I couldn’t find anything similar in the docs.

For those interested there are new modbus definitions with battery soc and more.

1 Like

I’m planning to buy a Huawei SUN2000-2KTL-L1 which already has wifi, and a Huawei SMART POWER SENSOR DDSU666-H that will use its RS485 port. Can I use the integrated wifi to connect to OpenHab ? Or do I need to buy the SDongle ?

1 Like

You need the sdongle.

1 Like

update , was able to fix it by following the guideline from huawei forum
https://forum.huawei.com/enterprise/en/modbus-tcp-guide/thread/789585-100027
by activating the modbus again the Sdongle started to communicate with my OH3 again

hi all,

currently facing an issue with modbus tcp.
I recently update to 3.2.0.M4 (2021-11-10). The connection was still working but a day after the communication suddenly stopped working (2021-11-11). I am not aware of any change i did at that time.

2021-11-13 09:58:56.984 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/1 error: connect timed out. Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=/192.168.1.171, m_Port=502, m_ModbusTransport=null, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=192.168.1.171, port=502]
2021-11-13 09:58:56.984 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - re-connect reached max tries 1, throwing last error: connect timed out. Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=/192.168.1.171, m_Port=502, m_ModbusTransport=null, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=192.168.1.171, port=502]
2021-11-13 09:58:56.985 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=/192.168.1.171, m_Port=502, m_ModbusTransport=null, m_ConnectTimeoutMillis=10000, rtuEncoded=false] for endpoint ModbusIPSlaveEndpoint [address=192.168.1.171, port=502]: connect timed out
2021-11-13 09:58:56.985 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=192.168.1.171, port=502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=32002, length=1, maxTries=3] [operation ID cafa6fe4-dd3c-44f3-a22a-b2b2d0fb5663]

I also verified of the Huawei portal still receive data on the FusionSolar portal. Here everything looks fine. The Dongle has the version V100R001C00SPC124 and i could also not see that any update was done by Huawei.
I can also ping the dongle from the OH3 machine, so the dongle is reachable from my OH3

My bridge configuration look like this and was not changed

Bridge modbus:tcp:slave100 [ host="192.168.1.171", port="502" ,id=1 ,timeBetweenTransactionsMillis=1200 ]{

Any hint on what could be the root cause or are any other user facing similar issue?

cheers

Reading this as a non insider, the information on registers and what they do is very much scattered now across many posts so this probably no longer serves well as an example.

An update to the .things and .items file would be of most interest as that serve both probably best, text and UI users.

@Rado1 please could you update your post #1 ?

1 Like

At this moment I have openhab 2.5.11 installed.
Today they installed a SUN 2000 5KTL with sdongle.

I have two questions:

  • is this way of working supported on openhab 2.5 ?
  • I know that at this moment the inverter is configured to send data to huawei, do I understand this thread correctly that with this solution it will read the data from the modbus independ of what huawei is doing?

Hello,

It should work with 2.5.
Yes it reads the data independ

1 Like

Hi,

I’m running SUN2000-8KTL-M1 converter with SDongleA-05. Converter firmware version is SPC139, version of Dongle is SPC124. Followed this guide to setup modbus tcp: https://forum.huawei.com/enterprise/en/modbus-tcp-guide/thread/789585-100027

To test reading registers of the inverter I setup two things:

UID: modbus:tcp:740761f03e
label: Huawei Sun2000
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  timeBetweenTransactionsMillis: 1998
  connectMaxTries: 4
  reconnectAfterMillis: 8000
  port: 502
  timeBetweenReconnectMillis: 10000
  host: 192.168.0.29
  connectTimeoutMillis: 10000
  id: 1
  enableDiscovery: false

and a poller thing:

UID: modbus:poller:740761f03e:e12d93e7f0
label: Huawei Test Poll
thingTypeUID: modbus:poller
configuration:
  start: 32016
  length: 1
  refresh: 5000
  maxTries: 3
  cacheMillis: 50
  type: holding
bridgeUID: modbus:tcp:740761f03e

The poller is able to connect:

Operation with task BasicPollTask [getEndpoint=ModbusIPSlaveEndpoint [address=192.168.0.29, port=502], request=ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=32016, length=1, maxTries=3], getResultCallback()=org.openhab.binding.modbus.handler.ModbusPollerThingHandler$ReadCallbackDelegator@1045d6f, getFailureCallback()=org.openhab.binding.modbus.handler.ModbusPollerThingHandler$ReadCallbackDelegator@1045d6f]. Got a connection successfully [operation ID bd6041ab-93c0-40ab-a9b5-a43fcb0d45f4]

But I am not able to get any register data:

execute try 1/1 error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@55f78b (unit id 1 & transaction 35490). Address: /192.168.0.29:502

Timeouts while waiting to receive data. I’m slowly running out of ideas, so any help appreciated.

Here is my config

UID: modbus:tcp:9118f3277b
label: Modbus TCP Slave
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  timeBetweenTransactionsMillis: 1300
  connectMaxTries: 1
  reconnectAfterMillis: 0
  port: 502
  timeBetweenReconnectMillis: 0
  host: 192.168.1.2
  connectTimeoutMillis: 10000
  id: 1
  enableDiscovery: false

poller thing

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

No, that just says the scheduled poller task has been set up internally to openHAB.
Your poller cannot connect - wrong IP, ID, read type register address, blah. Or Modbus not enabled on dongle.

It’s much easier to troubleshoot this sort of thing with a third party Modbus poll tool, transfer to openHAB after you worked out correct settings.

The culprit was

reconnectAfterMillis > 0

Setting it to 0 fixed the problem altogether. Thanks everyone, especially @Rado1 for sharing your config :slight_smile:

1 Like

Thanks.
I saw this weekend that the new version of 3 will have features that will allow me to upgrade, yet that might take a while, getting this working first might be better.

Reading from data independently is nice.

I’m a bit confused about what you wrote about modbus.
You talk about modbus TCP & modbus RTU
Do I understand correctly, there are two different ways to connect ?

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!

3 Likes

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