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

finally got is running by restarting the inverter and also added
timeBetweenTransactionsMillis=1200 to the thing configuration
thx for the support

I am using a Huawei Sun2000-12KTL M2 with SmartDongle module. I would like to integrate this into Openhab. The Modbus query apparently only works with dongle version V100R001C00SPC120. How can I install this? Only versions 116 and 118 are offered to me in the upgrade portal

1 Like

You have to send a email to eu_inverter_support@huawei.com
And ask for the update for your dongle model.
Do make sure you send the SN nummer of the dongle and inverter.

1 Like

I received the firmware from support. How can I now install it? I can’t find the dongle under Upgrade in the Fusion app

Follow this guide
2020M0016 How to upgrade SDongle WLAN-FE locally using Fusion Solar App
pdf (843.6 KB)

i am currently try to fix my issue with the times coming from the inverter.
I like to update the system time and timezone of the inverter with the modbus interface

The definition of the modbus poller are defined like this and the data are coming from the inverter properly


Bridge poller slave108holding [ start=40000, length=2, refresh=60000, type="holding" ]{            
        
        Thing data SystemTimeNumber [ readStart="40000", readValueType="uint32", writeStart="40000", writeValueType="int32", writeType="holding", updateUnchangedValuesEveryMillis="5000000" ]  
    }

Bridge poller slave108aholding [ start=43006, length=1, refresh=360000, type="holding" ]{            
        
        Thing data TimeZone [ readStart="43006", readValueType="int16", writeStart="43006", writeValueType="int16", writeType="holding",updateUnchangedValuesEveryMillis="5000000" ]  
    }

in the modbus interface description we have

SN Signal Name    Read/Write  Type Unit Gain Address   Quantity Scope
42 System Time    RW          U32  N/A  1    40000     2        [946684800, 3155759999] Epoch seconds,local time
56 Time zone      RW          I16  min  1    43006     1        [-720,840]

if i send a item update via the karaf console for the item timezone
openhab:send TimeZone 120

12:02:45.812 [WARN ] [ort.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=43006, registers=ModbusRegisterArray(0078), maxTries=3, getFunctionCode()=WRITE_SINGLE_REGISTER]). Will try again soon. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 128 [operation ID c6f5634d-9ca7-420a-8f6f-4f7e224414b2]
12:02:47.037 [WARN ] [ort.modbus.internal.ModbusManagerImpl] - Try 2 out of 3 failed when executing request (ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=43006, registers=ModbusRegisterArray(0078), maxTries=3, getFunctionCode()=WRITE_SINGLE_REGISTER]). Will try again soon. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 128 [operation ID c6f5634d-9ca7-420a-8f6f-4f7e224414b2]
12:02:48.259 [ERROR] [ort.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=43006, registers=ModbusRegisterArray(0078), maxTries=3, getFunctionCode()=WRITE_SINGLE_REGISTER]). Aborting. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 128 [operation ID c6f5634d-9ca7-420a-8f6f-4f7e224414b2]
12:02:48.260 [DEBUG] [ternal.handler.ModbusDataThingHandler] - Thing modbus:data:slave100:slave108aholding:TimeZone 'Modbus Data' had ModbusSlaveErrorResponseExceptionImpl error on write: ModbusSlaveErrorResponseException(error=128)
12:02:48.261 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'modbus:data:slave100:slave108aholding:TimeZone' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Error (ModbusSlaveErrorResponseExceptionImpl) with write. Request: ModbusWriteRegisterRequestBlueprint [slaveId=1, reference=43006, registers=ModbusRegisterArray(0078), maxTries=3, getFunctionCode()=WRITE_SINGLE_REGISTER]. Description: ModbusSlaveErrorResponseException(error=128). Message: Slave responsed with error=128

Has anybody successfully tried to write back the timezone or the time?
Any hint would be welcomed , thx

What numeric values do you actually want to write? You might need a transformation.

Your device might prefer “write multi”, Modbus FC16, indeed almost certainly needs that for the 32-bit value.

as shown in the karaf console i am updating the item with a new number
my assumption is that the modbus binding converts the number item to the corresponding ```
writeValueType=“int16”

The error message did not really indicates if this is an conversion issue.
I did not find something about the error code 128

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?