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

When the value is - you are taking power from the grid.You can raise the refresh to make the value more Stable.

Thanks … I could have come up with that myself

Concerning the optimizer information from the inverter.
the following info can be added to the modbus definition.

add this poller to your bridge

Bridge poller slave109holding [ start=37200, length=3, refresh=60000, type="holding" ]{
    
        Thing data OptiTotal  [ readStart="37200", readValueType="uint16",updateUnchangedValuesEveryMillis="5000000" ]
        Thing data OptiOnline [ readStart="37201", readValueType="uint16",updateUnchangedValuesEveryMillis="5000000" ]
        Thing data OptiSeq    [ readStart="37202", readValueType="uint16",updateUnchangedValuesEveryMillis="5000000" ]
   }

here the relevant items.

Number              OptiTotal "Total Number of Optimizer [%d]"  {channel="modbus:data:slave100:slave109holding:OptiTotal:number"}
Number              OptiOnline "Number of Online Optimizer [%d]"  {channel="modbus:data:slave100:slave109holding:OptiOnline:number"}
Number              OptiSeq "Sequence Optimizer [%d]"  {channel="modbus:data:slave100:slave109holding:OptiSeq:number"}

concerning the additional info per optimizer i got this document from huawei support.
modbus_V3.pdf (730.9 KB)

any hint on how to implement the sequence of modbus calls with the existing modbus binding?
Or is this something can can only be done by an external script?

If you refer to 6.3.7.1 “Uploading Files” using “Huawei defined function 0x41”, no, the binding does not support nonstandard functions such as 0x41 Huawei uses.

I need to read/extract data about production of energy from Inverter Sun2000 6KTL-M0 with WlanDongle and smart smart meter DTSU666H .

I want to use a raspberry pi to command a relay/switch/ boiler/heat-pump when PV system start to export to grid energy or to stop when i don`t have energy from PV .

1.With a user " owner" is possible to read this data ?

2 .from Modbus what info are available for this issue ?

3 .What data from register map are relevant for this operation ?

  1. from smart meter DTSU666H what data are available ?

5 .Is necessary extra hardware for this functions?

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