OpenHab, Modbus TCP (Volison ADM-5850G) and Wellpro WP8028ADAM configuration example

Tags: #<Tag:0x00007f5ca16c9b20> #<Tag:0x00007f5ca16c9828> #<Tag:0x00007f5ca16c94b8>

Hi there :slightly_smiling_face:
I’ve been reading this forum for a long time already and found a lot of helpful information here while learning and configuring OpenHab. I think now it’s time to give back some info from my side to the forum since I didn’t find here these devices’ config for 2nd version bindings.
I have several relatively cheap Modbus devices from AliExpress. And they work pretty well in my apartment for a several months now.

Volison ADM-5850G (Modbus TCP <> Modbus RTU/ASCII)

The base one is the Volison gateway (Modbus TCP <> Modbus RTU/ASCII). I chose it because it has Ethernet.
The only one thing I don’t like about it is that it should be accessed via Internet Explorer (other browser simply do not work with it). But the good point is that you don’t need to configure/reconfigure something too often. Beside some sections like Password, Firmware Update, Reset etc. we have 3 main settings sections:
Network section - here you can set IP address, Netmask, Gateway Address, chose between Static or DHCP IP configuration and also set DNS server.
Serial Settings - here you can configure Baud Rate, Data Bits, Stop Bits, Parity, Timeout and interface (RS-485/RS-232/RS-422) - I set RS-485. Baud rate should be the same as on all devices in your Modbus network (devices, connected to this specific gateway via RS-485 port).
Modbus Operating Settings - here we set operation mode (TCP_Master-RTU_Slaver), Max connection (it supports up to 32 connected devices), better to set real amount of connected devices to make polling faster. Local TCP port (default is 502), message timeout, ID mapping and Fixed ID Value (I don’t know what these last two stand for, so I left them as is).

Wellpro WP8028ADAM (8DI/8DO module)

First device that I connected to this gateway was Wellpro WP8028ADAM (8DI/8DO module). And about it I want to write here.
On WellPro’s page you can find User’s Manual and Software in English (direct link on the page - third one)
You can use any USB-to-RS-485 dongle (I used this) to play with their modules using this program (you can change outputs’ states using it, read inputs’ states, change device’s address and baud rate).
When baud rate is aligned on Volison Gateway and on the Input/Output module - we can wire them to each other via RS-485 and switch to OpenHab now (and don’t forget to connect Volison Gateway to your local home network :grinning:).

modbus.things configuration

For WellPro we need to setup 2 pollers (for inputs and outputs separately), wrapped by our modbus tcp thing config:

Bridge modbus:tcp:wellPro8028DiDo [ host="192.168.1.2", port=502, id=1 ] {

    Bridge poller coils [ start=0, length=8, refresh=350, type="coil" ] {
        Thing data DigitalOutput1 "Digital Output 1" [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data DigitalOutput2 "Digital Output 2" [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data DigitalOutput3 "Digital Output 3" [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data DigitalOutput4 "Digital Output 4" [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data DigitalOutput5 "Digital Output 5" [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data DigitalOutput6 "Digital Output 6" [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data DigitalOutput7 "Digital Output 7" [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data DigitalOutput8 "Digital Output 8" [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]
    }

    Bridge poller discreteInputs [ start=0, length=8, refresh=1000, type="discrete" ] {
        Thing data DigitalInput1 "Input 1" [ readStart="0", readValueType="bit" ]
        Thing data DigitalInput2 "Input 2" [ readStart="1", readValueType="bit" ]
        Thing data DigitalInput3 "Input 3" [ readStart="2", readValueType="bit" ]
        Thing data DigitalInput4 "Input 4" [ readStart="3", readValueType="bit" ]
        Thing data DigitalInput5 "Input 5" [ readStart="4", readValueType="bit" ]
        Thing data DigitalInput6 "Input 6" [ readStart="5", readValueType="bit" ]
        Thing data DigitalInput7 "Input 7" [ readStart="6", readValueType="bit" ]
        Thing data DigitalInput8 "Input 8" [ readStart="7", readValueType="bit" ]
    }
}

Outer Bridge has following parameters:
“wellPro8028DiDo” - name of thing, can be any, but it will be used in the *.items config;
“host” - local IP address of 5850G;
“port” - port of 5850G;
“id” - address of our WellPro Input/Output module (default is 1, but you need to set it on all modbus devices if you use more than one)

First inner Bridge works in both read and write mode - can read state of outputs and change them. I set refresh here to ~1/3 of a second.

Second inner Bridge is read only - it reads the state of inputs and change it. I set refresh here to 1 second.

wellpro.items configuration

Switch DigitalOutput1 "Digital Output 1 [%d]" <switch> { channel="modbus:data:wellPro8028DiDo:coils:DigitalOutput1:switch" }
Switch DigitalOutput2 "Digital Output 2 [%d]" <switch> { channel="modbus:data:wellPro8028DiDo:coils:DigitalOutput2:switch" }
Switch DigitalOutput3 "Digital Output 3 [%d]" <switch> { channel="modbus:data:wellPro8028DiDo:coils:DigitalOutput3:switch" }
Switch DigitalOutput4 "Digital Output 4 [%d]" <switch> { channel="modbus:data:wellPro8028DiDo:coils:DigitalOutput4:switch" }
Switch DigitalOutput5 "Digital Output 5 [%d]" <switch> { channel="modbus:data:wellPro8028DiDo:coils:DigitalOutput5:switch" }
Switch DigitalOutput6 "Digital Output 6 [%d]" <switch> { channel="modbus:data:wellPro8028DiDo:coils:DigitalOutput6:switch" }
Switch DigitalOutput7 "Digital Output 7 [%d]" <switch> { channel="modbus:data:wellPro8028DiDo:coils:DigitalOutput7:switch" }
Switch DigitalOutput8 "Digital Output 8 [%d]" <switch> { channel="modbus:data:wellPro8028DiDo:coils:DigitalOutput8:switch" }

Contact DigitalInput1 "Digital Input 1 [%d]" <door> { channel="modbus:data:wellPro8028DiDo:discreteInputs:DigitalInput1:contact" }
Contact DigitalInput2 "Digital Input 2 [%d]" <door> { channel="modbus:data:wellPro8028DiDo:discreteInputs:DigitalInput2:contact" }
Contact DigitalInput3 "Digital Input 3 [%d]" <door> { channel="modbus:data:wellPro8028DiDo:discreteInputs:DigitalInput3:contact" }
Contact DigitalInput4 "Digital Input 4 [%d]" <door> { channel="modbus:data:wellPro8028DiDo:discreteInputs:DigitalInput4:contact" }
Contact DigitalInput5 "Digital Input 5 [%d]" <door> { channel="modbus:data:wellPro8028DiDo:discreteInputs:DigitalInput5:contact" }
Contact DigitalInput6 "Digital Input 6 [%d]" <door> { channel="modbus:data:wellPro8028DiDo:discreteInputs:DigitalInput6:contact" }
Contact DigitalInput7 "Digital Input 7 [%d]" <door> { channel="modbus:data:wellPro8028DiDo:discreteInputs:DigitalInput7:contact" }
Contact DigitalInput8 "Digital Input 8 [%d]" <door> { channel="modbus:data:wellPro8028DiDo:discreteInputs:DigitalInput8:contact" }

Here everything is pretty clear I believe.

Sitemap

Frame label="Modbus" {
        Text label="Inputs" icon="door" {
            Text item=DigitalInput1
            Text item=DigitalInput2
            Text item=DigitalInput3
            Text item=DigitalInput4
            Text item=DigitalInput5
            Text item=DigitalInput6
            Text item=DigitalInput7
            Text item=DigitalInput8
        }
        Text label="Outputs" icon="switch" {
            Switch item=DigitalOutput1
            Switch item=DigitalOutput2
            Switch item=DigitalOutput3
            Switch item=DigitalOutput4
            Switch item=DigitalOutput5
            Switch item=DigitalOutput6
            Switch item=DigitalOutput7
            Switch item=DigitalOutput8
        }
    }

Next two parts will be about WellPro Relay module (WP8025ADAM) and Eastron SDM230 Energy Meter if someone needs this kind of examples. I post this one because I was not familiar with Modbus and with OpenHab Modbus binding 2 configuration and each new device was a challenge for me :laughing: so I really needed this kind of info but found only some pieces.


3 Likes

I think it will be ok to post about WellPro 8 Relay Outputs module (WP8025ADAM) just right here, because this device is very similar to 8DI/8DO module. All you need as preparation (if you already have one device connected to the gateway) - set new address to this module. So as I already have address 1 for Inputs/Outputs module, I set address 2 for this one and then connected it in parallel to RS-485.
Now we can switch to OpenHab configurations and add this device to things, items and sitemaps files.

modbus.things configuration

We can just put this thing right after the existing module (note, that id is 2 here - this is address of our new device)

Bridge modbus:tcp:wellPro8025Relay [ host="192.168.1.2", port=502, id=2 ] {
    Bridge poller coils [ start=0, length=8, refresh=350, type="coil" ] {
        Thing data Relay1 "Relay 1" [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
        Thing data Relay2 "Relay 2" [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
        Thing data Relay3 "Relay 3" [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
        Thing data Relay4 "Relay 4" [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
        Thing data Relay5 "Relay 5" [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
        Thing data Relay6 "Relay 6" [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
        Thing data Relay7 "Relay 7" [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
        Thing data Relay8 "Relay 8" [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]
    }
}

wellpro.items configuration

Now let’s add new items to wellpro.items:

Switch Relay1 "Relay 1 [%d]" <wallswitch> (Switches) { channel="modbus:data:wellPro8025Relay:coils:Relay1:switch" }
Switch Relay2 "Relay 2 [%d]" <wallswitch> (Switches) { channel="modbus:data:wellPro8025Relay:coils:Relay2:switch" }
Switch Relay3 "Relay 3 [%d]" <wallswitch> (Switches) { channel="modbus:data:wellPro8025Relay:coils:Relay3:switch" }
Switch Relay4 "Relay 4 [%d]" <wallswitch> (Switches) { channel="modbus:data:wellPro8025Relay:coils:Relay4:switch" }
Switch Relay5 "Relay 5 [%d]" <wallswitch> (Switches) { channel="modbus:data:wellPro8025Relay:coils:Relay5:switch" }
Switch Relay6 "Relay 6 [%d]" <wallswitch> (Switches) { channel="modbus:data:wellPro8025Relay:coils:Relay6:switch" }
Switch Relay7 "Relay 7 [%d]" <wallswitch> (Switches) { channel="modbus:data:wellPro8025Relay:coils:Relay7:switch" }
Switch Relay8 "Relay 8 [%d]" <wallswitch> (Switches) { channel="modbus:data:wellPro8025Relay:coils:Relay8:switch" }

Sitemap

And for sitemap let’s add new item inside the Modbus frame:

Text label="Relays" icon="wallswitch" {
    Switch item=Relay1
    Switch item=Relay2
    Switch item=Relay3
    Switch item=Relay4
    Switch item=Relay5
    Switch item=Relay6
    Switch item=Relay7
    Switch item=Relay8
}

Here is the result:

2 Likes

Welcome to the openHAB Community :heart:

First post and a good tutorial, don’t see that very often :smiley:
Thank you for sharing this knowledge!

1 Like

Greetings
I want to use an ADM-5850G to monitor and manage in HMI-SCADA system via internet from a PC from one location an automation to another location with modbus TCP -Modbus RTU. Do you think it corresponds to such an application? On PC Master the HMI application is TouchWin Xinje and on PLC Slave it is a Xinje PLC.

1 Like

Hello @Rinus and welcome to the openHAB community.

But I need to give you a little slap on the fingers! :raised_hand_with_fingers_splayed:

You just necrobumped a stale topic.

What you should have done is create a new topic link to this one and ask a full question.

Please consider reading this topic as a new user.

I’m sorry I caused you so much trouble, I asked (so I thought) information for alexkov
Alexey Kovynev about the product he described in his post.

Nah! That’s not it.
Problem is, we had a few months back a big discussion in this community about auto closing topics because there are stale, but this setting can not be applied to old topics only new ones.
So you are not to blame :smiley: Since the system allows it :slight_smile:

All I wanted to tell you (and other reading this) that there is a better way of asking about this.
I only answered because I got a notification about this old topic.

Hi!
This device is supposed to be used to perform Modbus communication via TCP by Ethernet instead of RTU (2 wires). I think you can use this device as a part of your infrastructure behind a router in local network and after proper setup (port forwarding etc.) it should work. But I’m not sure if this will be secure enough. I’d probably better keep all Modbus TCP communication local only and expose some other communication method to internet.
Anyway it’s a quite wide topic and you need some investigation. I only use this device locally to collect some data (and send commands) from Openhab/HA using it.

1 Like

thank you for the advice. I’m grateful :+1:

It’s not a safety issue (but I remembered for the future), it’s an irrigation automation in my garden. I do this because I want to learn automation, and now I have reached “TCP / IP” communication. Thank you for your kindness.