Reading data from Huawei inverter SUN 2000 (3KTL-10KTL) via modbus TCP and RTU with json configuration for full GIU control

Hi I have made a new tutorial to read the inverter via modbus TCP or RTU and all configuration can be done with the openHAB3 GIU.

With the Huawei Smart Dongle-WLAN-FE you can connect with modbusTCP and Fusion solar app at the same time.
With modbus RTU you can not connect to the Fusion solar app and with modbus RTU at the same time.

To connect via TCP you need the Smart Dongle-WLAN-FE with the latest software update (SDongle_V100R001C00SPC120_package)

To connect via RTU u need a usb to modbus RS485 converter.
I connected data + to port pin 1 and data - to port pin 3 of the signal cable.
If you have a slightly different model than me, you should take a look at the manual because apparently there is a difference on the pin out of other models.
You have to remove the wlan smart dongle if you want to connect with serial RTU modbus.

For more info on how to configure usb port en modbus please read the modbus binding doc

With a new install, you can just copy the following files to openhabian.local / openhab-userdata / jsondb. If it is not a new installation, paste the configuration into the existing one and make sure the syntax remains correct. Be sure to make a backup before jou begin.I am not responsible if this goes wrong.

org.openhab.core.items.Item.json (20.0 KB)
org.openhab.core.thing.link.ItemChannelLink.json (74.2 KB)
org.openhab.core.thing.Thing.json (633.7 KB)
org.openhab.core.items.Metadata.json (9.7 KB)

And put this in the transform file

divide1.js

// Wrap everything in a function (no global variable pollution)
// variable "input" contains data passed by openHAB
(function(inputData) {
    // on read: the polled number as string
    // on write: openHAB command as string
    var DIVIDE_BY = 1;
    return parseFloat(inputData) / DIVIDE_BY;
})(input)

divide10.js

// Wrap everything in a function (no global variable pollution)
// variable "input" contains data passed by openHAB
(function(inputData) {
    // on read: the polled number as string
    // on write: openHAB command as string
    var DIVIDE_BY = 10;
    return parseFloat(inputData) / DIVIDE_BY;
})(input)

divide100.js

// Wrap everything in a function (no global variable pollution)
// variable "input" contains data passed by openHAB
(function(inputData) {
    // on read: the polled number as string
    // on write: openHAB command as string
    var DIVIDE_BY = 100;
    return parseFloat(inputData) / DIVIDE_BY;
})(input)

divide1000.js

// Wrap everything in a function (no global variable pollution)
// variable "input" contains data passed by openHAB
(function(inputData) {
    // on read: the polled number as string
    // on write: openHAB command as string
    var DIVIDE_BY = 1000;
    return parseFloat(inputData) / DIVIDE_BY;
})(input)

There is already a modbusTCP and modbusRTU bridge in things. Choose which one you want to use and delete the other. Configure them with the correct IP or serial port of your inverter.
Make sure the pollers or connected to the right bridge.

Restart openHAB and everything should work.
If it does not work, switch off the inverter + battery (if present) completely and let it restart.

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.