Modbus TCP on Huawei SUN2000

I have a Huawei SUN2000 6KTL-L1 Solar Inverter with WiFi interface. I like get data value from local Inverter without retrive from FusionSolar Cloud.

I try to get value from modbus-tcp with QModMaster and work. The problem is polling data with OpenHAB Modbus Binding. I search from forum community and found the same my problem (SUN2000-6KTL-L1 Modbus TCP).

After many test also with cli modbus command (mbpoll) I think I understand the openhab modbus binding problem:

If I try to execute this command from CLI

mbpoll [HUAWEI_LOCAL_IP] -1 -a 0 -r 30071 -c 1

it’s try 1 time, go in timeout and exit.

If I try polling (without -1 option)

mbpoll [HUAWEI_LOCAL_IP] -a 0 -r 30071 -c 1

this first time go in timeout but the second request return 342 (the correct device model).

The problem of mbpoll and OpenHAB Binding are that you try to send modbus message immediately after opening the TCP / IP connection. I modify source code of mbpoll and add 1 second of delay after open TCP/IP connection. The command return the value also after first command. Surely there is a bug on the inverter which requires some delay before being able to accept modbus messages

Unlike mbpool, OpenHAB Modbus Binding after command go in timeout, close the connection and opens a new one. It would be interesting to add a delay parameter after TCP/IP connection but before sending modbus commands. Do you think it is possible ?

The modbus id of the Inverter is correct to be 0.


Look closer at modbus binding settings. There are parameters related to delay - timeBetweenTransactionsMillis and reconnectAfterMillis. Maybe these will help?

Thank you @splatch.

I didn’t know that the first transaction was also delayed with the timeBetweenTransactionsMillis parameter. Once the parameter is set to 1000 ms, OpenHAB is able to interrogate the Inverter without errors. In my configuration I query Inverter with only one register.

The only undesirable effect with this parameter is that the various queries in the same connection are delayed by 1 second between them. From what I was able to understand, the delay would only be necessary on the first query of the single TCP / IP connection.

@splatch already responded with the answer I was about to comment. That is the best workaround with the current settings available in the binding.

You might want to check if something shorter than 1s would work as well.

As you pointed out, the delay is ensured with all transactions, not just the first transaction after reconnect.

@splatch with a value less than one second the inverter does not respond