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

You have to remove the wlan and reboot the inverter.
I could not make it work with the wlan antenna.
I am sending no data to the huawei portal.

Excellent news (in these dark corona days): it works!
The SUN2000L is slightly different form its predecessor:

  • COM-pinout connector = pin 1 - & pin 2 + (not pin3 as I did all my previous tests without result)
  • WLAN can stay active together with RS485, working both at the same time
  • offline “No irradiation” does not cut off the communication
  • hotplugable COM-port, no restart needed

With my test setup, seen frequent ‘Try 1 out of 3 failed when executing request’. 2nd retry often is enough to obtain the data. Even after extending all settings to ‘refresh=10000’ kept me seeing this messages. Any idea, suggestion?

1 Like

Nice.
I just looked at my manual and the pin out is really different then.
Because pin 1 and 2 would not work with my inverter.
Offline "no irradiation"does not cut off all communication you can only see E-total,E-day ,warnings and alarms.
do you use an exact copy of my things file?(if not show me your things file)
I still think the WLAN causes your problem.(mine runs super stable without errors)

I have never done a lot of tests with the WLAN module(it was allways causing issues) because I prefer to keep everything local. If I have some time tomorrow I will test some more with the WLAN module plugged in to see what happens and if it is causing your problem.

I know your inverter modbus definitions are a little bit different I will send you my modbus definitions so you can compare with yoursSUN2000-3-10KTL-M0 MODBUS Interface Definitions.pdf (461.5 KB)

You can also find your inverter modbus definitions on the internet or ask your installer.

Just did a quick first test with exact your things and items, even used the sitemap.

Downloaded, printed a hard copy; will compare them tomorrow with ‘Solar Inverter Modbus Interface Definitions (V3.0)’

For this huge data amount, what type of ‘Persistence’ do you use/advise?

Take care with your physical RS485 wiring. Twisted pair, avoid running alongside power cables, ensure good termination. Most USB dongles include one terminator which willoften “do”, but consider another if the cable is over a couple of metres and the other end is unterminated.

Show complete error messages for more help.

For persistence en graphing i use grafana and influxdb.
you can make nice graphs with grafana.
i followed this tutorial InfluxDB+Grafana persistence and graphing
It is not a huge amount of data i reinstalled openhab 6 months ago and this is the volume of data for all my items i persist.

81M	/var/lib/influxdb/data/openhab_db

I am only persisting the gSolar group in the inverter items file.
This is my influxdb.persist

Strategies { 

    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"
    everyMinute : "0 * * * * ?"

     // if no strategy is specified for an item entry below, the default list will be used
    default = everyMinute
}

/* 
 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).
 */
Items { 
    
     Heatpump * : strategy = everyMinute,restoreOnStartup
     gShelly * ,gSolar *,gHeatpump * ,gSystem * : strategy = everyChange,restoreOnStartup,everyMinute
     Sun_Azimuth *                   : strategy = everyHour
     gVerlichting * ,ComfoAir * ,  gIrrigation * ,gIrrigation_Times *  ,gVac * ,gVacStat * ,gVacCons * , gVacHist * ,gVerlichtingsinput * : strategy = restoreOnStartup 
     }
                    

I just plugged in the WLAN module and then I get this error

2020-03-21 10:29:28.630 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - Last request: 64 03 7d 10 00 08 54 50

2020-03-21 10:29:28.630 [ERROR] [t.wimpi.modbus.io.ModbusRTUTransport] - failed to read: CRC Error in received frame: 0 bytes: 

2020-03-21 10:29:28.631 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute try 1/1 error: I/O exception: IOException CRC Error in received frame: 0 bytes: . Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@629267 (unit id 100 & transaction 53715). Serial parameters: SerialParameters@160024f[portName=/dev/ttyUSB-RS485,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]

2020-03-21 10:29:28.632 [ERROR] [pi.modbus.io.ModbusSerialTransaction] - execute reached max tries 1, throwing last error: I/O exception: IOException CRC Error in received frame: 0 bytes: . Request: net.wimpi.modbus.msg.ReadMultipleRegistersRequest@629267 (unit id 100 & transaction 53715). Serial parameters: SerialParameters@160024f[portName=/dev/ttyUSB-RS485,baudRate=9600,flowControlIn=none,flowControlOut=none,databits=8,stopbits=1,parity=none,encoding=rtu,echo=false,receiveTimeoutMillis=1500]

2020-03-21 10:29:28.633 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@9d07f5[slaveId=100,functionCode=READ_MULTIPLE_REGISTERS,start=32016,length=8,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException CRC Error in received frame: 0 bytes:  [operation ID 44e1ad62-0077-4927-bebc-f893b60b2d98]


I think this explains your error.

Exactly the same, thanks for testing!
Choices I have to make or take the downside of it.

I just plugged the WLAN module out and the error remains.
I had to take the power of the inverter and let it reboot to get everything back to normal.
I just read the quick guide and it said if the smart dongle(WLAN module) is configured you are advised to install the smart dongle before connecting the signal cable.
Maybe you can give that a try?
But why do you want to use the smart dongle you can have the same fuctions in openhab?

Checked both register definitions versions one by one, all appear to be equal.

Did some another test; see the screenshot below; left my WLAN active and connected to RS485 over usb and pulled all the meaningfull holding registers with a scan rate of 1000ms. A significant larger datastream without any errors over an interval of 10 minutes (Modbus Poll limit unregistered - used setting files available on request).

My installer is supervising his installations for errors as a free service, on the Huawei platform.

My idea on the dropped answer issue: I suspect that the openhab modbus binding is connecting/disconnecting after each poll. On reconnect, there might by a (longer) wait time (penalty) when the WLAN is active.
Can the poller things be configured to keep the COM port open, once connected?

Why would you think that would matter? Modbus is a master-slave protocol. The slave has no idea when it is going to be queried, until it is queried. However long it takes the master to prepare to query is immaterial.
It might make a difference to slave response time, if it has to handle extra tasks too on WLAN.

CRC errors are a pretty reliable indicator of crap on the serial line. Have you considered that the WLAN may contribute to RF interference, or noise via the RS485 interface’s power feed?

Earth loop and termination issues can create time-based weirdness, where a busy line can run error free, while transmission silences allow errors to appear.

If you want you can make rules that send e-mail’s or send push messages when the inverter is giving an error.Then you can contact your installer.every installer does this without any effort, because the alarms come in automatically.I am planning to make this rules for error notification when i have some free time.
You can see the alarms with the modbus connection.normal state is 0 and error is 1
In my site map the alarms are visual.

Thanks for this critical information.

Test setup was on a crappy W10 2.5.2, now on a fresh installed RPI3b potential free setup; powerbank fueled, wifi and only usb-RS485 short wired 2 cm, not even 1 error.
Pushed it to the limit by increasing the poll freq to 1000 ms and all is running fine now!

@Rado1 for easy use I crammed all pollers under 1 serial brigde in the things file and added ‘reconnectAfterMillis=500’ to it

So it is running fine with the WLAN module?
If i read the docs the ‘reconnectAfterMillis=500’ is a TCP bridge parameter.
And we are using a serial bridge?
Does this parameter work on a serial bridge?
If you remove it do you get error’s?
Maybe I should also take a look at my cabling because I have not used a shielded cable.
Thanks for the tip i set all pollers under 1 serial bridge :grinning:

It’s not generally needed except in adverse environments e.g. heavy machinery. Twisted pair usually suffices, but much depends on the wiring route.and electrically noisy neighbours.
Do pay attention to RS485 termination.

A screaming WLAN antenna on 2 cm might be too close?

@Rado1 all is in place and both active. Embedded the usb-rs485 (allmost) in the COM-connector.

It might well be, you wouldn’t really expect 9600 serial to care, but RFI is weird.

Dropped the ‘reconnectAfterMillis=500’ without errors @ 1000 ms for all readings.
To be sure all detection is done correctly, unplugged a few seconds and got noticed in the log.

Bridge modbus:serial:slave100 [ port="/dev/ttyUSB0" ,id=1 , baud=9600, stopBits="1", parity="none",dataBits=8, encoding="rtu"]

Nice
I am going to replace my cable to the inverter with a shielded one and see what it gives. I can’t bring everything close to the inverter because I have multiple modbus modules on the RS485 bus.

I removed the timeBetweenTransactionsMillis= parameter from the tutorial it got in there because i used it for testing with my other DI and DO modbus modules.There is no need for it in reading out the inverter.

1 Like