Modbus binding of rollershutter

you might try something like

Rollershutter myRS "RS" (livingRoom) {modbus="UP:slave1:1, DOWN:slave1:3"}

Where I believe slave1:1 is the contact for up and slave1:3 is the contact for down

Hello, thank you for your reply.

I put in tems:
Rollershutter myRS “RS [%d %%]” (All) {modbus=“UP:slave1:6, DOWN:slave1:7”}

and in sitemap:
Switch item=myRS label=“test rollershutter”

But i do not get any effect on my Digital Outputs.

My feeling (nothing more than that) is that the use of rules is necessary to manage DO for rollershutter, therefore I’ll try to customize this solution

that was implemented through switch and not rollershutter.

Any suggestions, as usual, are very appreciated :wink:

At the moment I can control rollershutter via DI and DO with Openhab switches. I’d rather use items dimmer or rollershutter to have a visual feedback on the GUI of what is the status of the blind … (I don’t know if I was clear :frowning: )

Maybe something like this for the state

rule	"Rollershutter Position"
	Item Roll_1_UP_Limit received update	or
	Item Roll_1_DOWN_Limit received update
	if(Roll_1_UP_Limit.state==ON) {
		else {
			if(Roll_1_Down_Limit.state==ON) {
			else {

Directly from the wiki pages I found this:

about the “Example for binding shutter using HTTP GET commands” I try to ask what follows:

  1. The measure of the status of the RS measured with variable “newState” works only if the stop button is pushed. When someone pushes for example the UP button when the rollershutter is going DOWN then the RS is stopped but the “newState” is not updated.

Does anyone already have worked with this and have suggestions ?


Sorry for my late reply but currently I only have limited time for this topic.

  1. When you have a look at you will see that RollershutterItem.class is not supported. That means whatever you do with Rollershutter items and Modbus binding will not work.

  2. So I took the decision to implement the modbus Rollershutter binding by my own.

  3. How does it work: The Modbus binding needs to be configured as follows:
    { modbus:slave1:>readReg:<writeReg) }

    readReg: Percent: 0-100 state of rollershutter set by MODBUS controller
    writeReg: UP/DOWN cmd (UP value++ / DOWN value–)
    writeReg+1: STOP cmd (value=1, must be reset by MODBUS controller)

As you can see I need 2 consecutive writeReg to control the rollershutter. This was the only way to have a quick and simple implementation inside the modus-binding module.
Furthermore it is important to know that both writeReg needs to be cleared with ZERO after the command has been processed by the modus controller.

  1. I have to check how I can deploy my code to the github-repository. Or am I allowed to upload my SNAPSHOT version directly here in this post?


Hey Jens,
thanks for your reply.

I personally have used 2 digital Output coils and 2 switches to manage my rollershutter customizing what I found here:

(Let me know if you are interested in the code)

About your question 4) which would be very interesting for me, in order to test your solution, unfortunately I cannot answer … :frowning:



Hi guys

I am interested in your code.

I’m managing my shutters via MQTT, controlling a small IoT device built by myself. I have UP and DOWN commands.

I have now in place the rollershutter demo from the documentation.

But the problems that I have:

  1. The actual state doesn’t show until I press STOP
  2. It never sends the STOP command to the shutter. Is not a problem because it have its own hard stop, but would be nice to stop it anyways.
  3. I can’t send a value like 33% and expect the shutters to go to that point and stop.


@Jens_Zeidler do you have any update on this? The working rollershutter solution for Modbus is what I’m waiting for.
@lorenzo_leonelli could you put your code here?


Hi, sorry for my late reply. I’m managing rollershutter with contacts, so I hope in future i can using a rollershutter item as well.


Lorenzo - Test Connessione con WAGO DIGITAL OUTPUT


Lorenzo - Test Connessione con WAGO DIGITAL INPUT



Switch item=MySwitch_T_Salotto_Grande_UP icon=“socket” label=“Tapp. Salotto Grande UP” visibility=[MySwitch_T_Salotto_Grande_DOWN==OFF]
Switch item=MySwitch_T_Salotto_Grande_DOWN icon=“socket” label=“Tapp. Salotto Grande DOWN” visibility=[MySwitch_T_Salotto_Grande_UP==OFF]


Contact MyContact_T_Salotto_Grande_UP “Pulsante Tapparella Salotto Grande UP” (All) {modbus=“slave2:2”}
Contact MyContact_T_Salotto_Grande_DOWN “Pulsante Tapparella Salotto Grande DOWN” (All) {modbus=“slave2:3”}

Switch MySwitch_T_Salotto_Grande_UP “Tapparella Salotto Grande UP” (All, G_Stanze_Salotto, gTapparelle) {modbus=“slave1:18”}
Switch MySwitch_T_Salotto_Grande_DOWN “Tapparella Salotto Grande DOWN” (All, G_Stanze_Salotto, gTapparelle) {modbus=“slave1:19”}


// lambda expression that can be used as a function (here: with 5 parameters)
val org.eclipse.xtext.xbase.lib.Functions$Function5 rolloLogic = [
org.openhab.core.library.items.SwitchItem relayItem,
org.openhab.core.library.items.SwitchItem relayItemOpposite,
java.util.Map<String, org.openhab.model.script.actions.Timer> timers,
String timerKey, int timeout |
timers.put(timerKey, createTimer(now.plusSeconds(timeout)) [|
if (relayItem.state == ON)

// Contatti Fisici Tapparella Salotto_Grande
rule "rollo up Salotto_Grande"
when Item MyContact_T_Salotto_Grande_UP changed to OPEN then
if(MySwitch_T_Salotto_Grande_UP.state == ON || MySwitch_T_Salotto_Grande_DOWN.state == ON ) {
} else { MySwitch_T_Salotto_Grande_UP.sendCommand(ON) }
rule "rollo down Salotto_Grande"
when Item MyContact_T_Salotto_Grande_DOWN changed to OPEN then
if(MySwitch_T_Salotto_Grande_UP.state == ON || MySwitch_T_Salotto_Grande_DOWN.state == ON ) {
} else { MySwitch_T_Salotto_Grande_DOWN.sendCommand(ON) }
// Contatti Logici Tapparella Salotto_Grande
rule "up Salotto_Grande"
when Item MySwitch_T_Salotto_Grande_UP changed to ON then
rolloLogic.apply(MySwitch_T_Salotto_Grande_UP, MySwitch_T_Salotto_Grande_DOWN, rolloTimers, “Salotto_Grande”, 17)
rule "down Salotto_Grande"
when Item MySwitch_T_Salotto_Grande_DOWN changed to ON then
rolloLogic.apply(MySwitch_T_Salotto_Grande_DOWN, MySwitch_T_Salotto_Grande_UP, rolloTimers, “Salotto_Grande”, 17)

sorry for the late reply, please let me know if I can be still helpful anyhow


Hi all,

I have placed my own implementation on dropbox. The link is as follows:

Please also have a look at post 10 in this thread:
item configuration:

The Modbus configuration (openhab.cfg) shall be as shown below:

modbus:tcp.slave1.connection= modbus:tcp.slave1.type=holding

Important is to use the type=holding


Rollershutter myRS "rollershutter" (livingRoom) {modbus="slave1:<0:>1"}

-> reg 0: is read register and keeps the actual shutter pos, must be written by WAGO controller
-> req 1: is write register, value <0 for UP command, value >0 for DOWN command, WAGO must reset this value after processing
-> reg 2: is write register, value ==1 is STOP command, WAGO must reset this value after processing

Next used Item:

Rollershutter myRS2 "rollersutter2" (livingRoom) {modbus="slave1:<3:>4"}


1 Like


Thanks for this, can You also show wago side ? How You set up values for this and reset them.


I was just looking in implementing openHAB shutters via MQTT with an ESP8266 connected to relays.
I haven’t found any examples on how to do it (found only shutters via HTTP/GET.

Can you share your code?


@woody4165 - Unless your ESP8266 is running Modbus, you might be better to start to start a new thread with MQTT in the title

I would be glad, please start a new thread MQTT related, or send me an email so I can show you what I did.

Hello Jens_Zeidler,

Thanks for sharing your implementation.
I have just installed openhab2.
Do you know if the new modbus binding (1.9) already include what we need for the shutter, or should we download your binding ?


Hi Yves,

Unfortunately not yet. I am going to prepare a pull request to contribute
these extension. As long as it’s not yet done you will need to take this
one to be found below.


Hi Jens,

Thanks for replying to my request.
I will be happy to contribute as much as I can.
From what I have understood, I should replace the current modbus binding (1.9) by your own ( Am I correct ?
The version 1.9 seems to have some improvements, including the float_swap that I’m using for the temperature. I have checked the knx binding (I’m not using it) just to see how it is done. It think we could probably learn from it to improve the modbus binding (rollershutter, dimming, etc.).
What do you think ?
Best Regards


Hi Yves,

I was able to move my local changes to the actual HEAD.
Please find below the according link for the jar file.

Best regards

1 Like

Hallo Jens!
Thanks for your work! I tried “your binding” in version 1.8 in openhab 1.8.3.

Unfortunately, I have no success.

In Codesys - globale variables I defined

	myWord0 AT %MW0:WORD
	myWord1 AT %MW1:WORD;   
	myWord2 AT %MW2:WORD;

In openhab.cfg I defined:


In default.items I defined:

Rollershutter   Roller "Roller"       (Roller) {modbus="slave1:<0:>1"}

… but “nothing” reaches my SPS. I checked the principle connection with switches / coils / MX an everything was fine.

Do you have a hint for me? Does anybody has a hint for me?

Thanks a lot.