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

I can’t see the value you are writing.

Yes. Does your device allow you to write just one register?

This is information you need from Huawei, that is what is rejecting your write attempt. They can be applying any rules they like, like only allowing 30 minute intervals or only write by FC16.

well the modbus interface description tags the registered as indicated in post #86

for writing the following is described in the huawei description

Frame Format for a Normal Response from a Slave Node
Data Field Length Description
Function code 1 byte
0x06
Register Address
2 bytes
0x0000–0xFFFF
Register Value
2 bytes
0x0000–0xFFFF

I will also open an support case in the huawei support line

l operate 32 optimzer.

I am able to get general information like Optimzer total number, Amount of online and a sequence number indicating a new file can be uploaded.
In the modbus description it is written that if the sequence number is increasing a file can be uploaded from the inverter that give some monitoring of the optimizer

I am using the modbus binding from openhab and i could not find any feature description that handles files.
Does any body have some java or python scripts that you can share with the community?

There are no file transfer standards for Modbus. This’ll be some HTTP API perhaps.

I have now managed to read out the inverter. To implement a PV excess charge, I need the current load in my house. I have connected a DTSU-666H to the inverter. Can I read it out? Which register do I have to use?

Try this

Bridge poller slavepowermeter [ start=3700, length=115, refresh=1000, type="holding" ]{
    
        Thing data Powermeter                        [ readStart="37113", readValueType="int32",updateUnchangedValuesEveryMillis="5000000" ]
        Thing data Battery charge-discharge power    [ readStart="37001", readValueType="int32",updateUnchangedValuesEveryMillis="5000000" ]
        Thing data Current-day charge capacity       [ readStart="37015", readValueType="int32",readTransform="JS(divide100.js),updateUnchangedValuesEveryMillis="5000000" ]
        Thing data Current-day discharge capacity    [ readStart="37017", readValueType="int32",readTransform="JS(divide100.js),updateUnchangedValuesEveryMillis="5000000" ]

If you have a fresh install you can folow this tutorial and have everything in the GIU

Thank you for your help. I get values ​​from the inverter via register 37113. However, these are not valid. The current load is around 500W, I get values ​​from -400 to -600

Bridge poller slavepowermeter [ start=37113, length=2, refresh=1000, type="holding" ]
{
  Thing data Powermeter	[ readStart="37113", readValueType="int32",updateUnchangedValuesEveryMillis="5000000" ]
 }

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?