# Modbus binding of rollershutter

**URL:** <https://community.openhab.org/t/modbus-binding-of-rollershutter/3273>\
**Category:** Bindings\
**Tags:** openhab, modbus, binding\
**Created:** [October 12, 2015, 2:42pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273 "2015-10-12T14:42:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens\_Zeidler](https://community.openhab.org/user_avatar/community.openhab.org/jens_zeidler/32/42106_2.png) [@Jens\_Zeidler](https://community.openhab.org/u/Jens_Zeidler)\
**Post date:** [October 12, 2015, 2:42pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/1 "2015-10-12T14:42:45Z")

</div>

Hi,

I am wondering whether it is possible to bind a rollershutter by modbus. I have tried it and the openhab.log shows to following traces:

2015-10-12 16:29:20.642 [ERROR] [i.internal.GenericItemProvider] - Binding configuration of type ‘modbus’ of item ?myRollerShutter? could not be parsed correctly.  
org.openhab.model.item.binding.BindingConfigParseException: item ‘myRollerShutter’ is of type ‘RollershutterItem’, only Switch, Contact or Number are allowed - please check your \*.items configuration  
at org.openhab.binding.modbus.internal.ModbusGenericBindingProvider.validateItemType(ModbusGenericBindingProvider.java:71) ~[na:na]  
at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:347) [org.openhab.model.item\_1.7.1.jar:na]  
at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:324) [org.openhab.model.item\_1.7.1.jar:na]  
at org.openhab.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:171) [org.openhab.model.item\_1.7.1.jar:na]  
at org.openhab.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:390) [org.openhab.model.item\_1.7.1.jar:na]  
at org.openhab.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:159) [org.openhab.model.core\_1.7.1.jar:na]  
at org.openhab.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:100) [org.openhab.model.core\_1.7.1.jar:na]  
at org.openhab.model.core.internal.folder.FolderObserver.checkFolder(FolderObserver.java:142) [org.openhab.model.core\_1.7.1.jar:na]  
at org.openhab.model.core.internal.folder.FolderObserver.run(FolderObserver.java:99) [org.openhab.model.core\_1.7.1.jar:na]

From the log point of view only Switch, Contact or Number are allowed for Modbus binding.

Can someone comment this?  
Is there any known workaround to get this working?

Many thanks ahead.  
Best regards,  
Jens

---

<div class="post-metadata">

**Author:** ![LeXLuther422](https://community.openhab.org/user_avatar/community.openhab.org/lexluther422/32/70978_2.png) [@LeXLuther422](https://community.openhab.org/u/LeXLuther422)\
**Post date:** [October 17, 2015, 8:48pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/2 "2015-10-17T20:48:00Z")

</div>

What are you trying to achieve by having a roller shutter control? I am able with rules to convert modbus items to percent.  
Here is how I was able to use the buttons seperately  
`
Rollershutter volume “Familyroom TV [%s]” (SF_Family, Volume, TV) {samsungtv=“UP:Familyroom:KEY_VOLUP, DOWN:Familyroom:KEY_VOLDOWN, STOP:Familyroom:KEY_MUTE”}
`

---

<div class="post-metadata">

**Author:** ![Jens\_Zeidler](https://community.openhab.org/user_avatar/community.openhab.org/jens_zeidler/32/42106_2.png) [@Jens\_Zeidler](https://community.openhab.org/u/Jens_Zeidler)\
**Post date:** [October 30, 2015, 1:10pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/3 "2015-10-30T13:10:17Z")

</div>

Hi David,

this is quite easy to understand. My aim is to create (as you did with samsungtv binding) a Rollershutter item to directly communicate to my WAGO Modbus controller.

_Rollershutter myRS “RS” (livingRoom) {modbus=“slave1:\<0:\>1”}_

As you can see in the sample code above the Modbus address _0_ is used as read register to read out the actual shutter position (needed for the app-UI). The modbus write register _1_ will be used for commands to control the shutter (UP, DOWN).

What I do not understand from your sample code how you could manage that the samsungtv binding can read/write Modbus registers?

In the meantime I have been able to extend the existing org.openhab.binding.modbus implementation to my demands and it works as expected.

---

<div class="post-metadata">

**Author:** ![lorenzo\_leonelli](https://community.openhab.org/letter_avatar_proxy/v4/letter/l/5f8ce5/32.png) [@lorenzo\_leonelli](https://community.openhab.org/u/lorenzo_leonelli)\
**Post date:** [November 7, 2015, 4:44pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/4 "2015-11-07T16:44:21Z")

</div>

Hello Jens,  
could you please post the item/rules/persistence that you have used to manage rolling shutter ?  
It would be very useful for me …  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![LeXLuther422](https://community.openhab.org/user_avatar/community.openhab.org/lexluther422/32/70978_2.png) [@LeXLuther422](https://community.openhab.org/u/LeXLuther422)\
**Post date:** [November 12, 2015, 4:12am UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/5 "2015-11-12T04:12:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lorenzo\_leonelli](https://community.openhab.org/letter_avatar_proxy/v4/letter/l/5f8ce5/32.png) [@lorenzo\_leonelli](https://community.openhab.org/u/lorenzo_leonelli)\
**Post date:** [November 12, 2015, 5:42pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/6 "2015-11-12T17:42:37Z")

</div>

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

> **[Reusable Rules via Functions](https://github.com/openhab/openhab1-addons/wiki/Reusable-Rules-via-Functions)**
>
> Add-ons for openHAB 1.x. Contribute to openhab/openhab1-addons development by creating an account on GitHub.

that was implemented through switch and not rollershutter.

Any suggestions, as usual, are very appreciated 😉

---

<div class="post-metadata">

**Author:** ![lorenzo\_leonelli](https://community.openhab.org/letter_avatar_proxy/v4/letter/l/5f8ce5/32.png) [@lorenzo\_leonelli](https://community.openhab.org/u/lorenzo_leonelli)\
**Post date:** [November 12, 2015, 9:40pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/7 "2015-11-12T21:40:59Z")

</div>

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 ☹ )

---

<div class="post-metadata">

**Author:** ![LeXLuther422](https://community.openhab.org/user_avatar/community.openhab.org/lexluther422/32/70978_2.png) [@LeXLuther422](https://community.openhab.org/u/LeXLuther422)\
**Post date:** [November 17, 2015, 4:40am UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/8 "2015-11-17T04:40:21Z")

</div>

Maybe something like this for the state

```
rule	"Rollershutter Position"
when
	Item Roll_1_UP_Limit received update	or
	Item Roll_1_DOWN_Limit received update
then
	if(Roll_1_UP_Limit.state==ON) {
		postUpdate(Roll_1_Position,100)
	}
		else {
			if(Roll_1_Down_Limit.state==ON) {
				postUpdate(Roll_1_Position,0)
			} 
			else {
				postUpdate(Roll_1_Position,50)
			}
		}

```

---

<div class="post-metadata">

**Author:** ![lorenzo\_leonelli](https://community.openhab.org/letter_avatar_proxy/v4/letter/l/5f8ce5/32.png) [@lorenzo\_leonelli](https://community.openhab.org/u/lorenzo_leonelli)\
**Post date:** [November 18, 2015, 12:11pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/9 "2015-11-18T12:11:20Z")

</div>

Directly from the wiki pages I found this:

> **[Rollershutter Bindings](https://github.com/openhab/openhab1-addons/wiki/Rollershutter-Bindings)**
>
> Add-ons for openHAB 1.x. Contribute to openhab/openhab1-addons development by creating an account on GitHub.

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 ?

---

<div class="post-metadata">

**Author:** ![Jens\_Zeidler](https://community.openhab.org/user_avatar/community.openhab.org/jens_zeidler/32/42106_2.png) [@Jens\_Zeidler](https://community.openhab.org/u/Jens_Zeidler)\
**Post date:** [November 25, 2015, 3:24pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/10 "2015-11-25T15:24:33Z")

</div>

Hi,

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

1. When you have a look at `ModbusGenericBindingProvider.java::validateItemType(...)` 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) }`

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?

Cheers.

---

<div class="post-metadata">

**Author:** ![lorenzo\_leonelli](https://community.openhab.org/letter_avatar_proxy/v4/letter/l/5f8ce5/32.png) [@lorenzo\_leonelli](https://community.openhab.org/u/lorenzo_leonelli)\
**Post date:** [November 29, 2015, 8:26pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/11 "2015-11-29T20:26:37Z")

</div>

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:

> **[Rollershutter Bindings](https://github.com/openhab/openhab1-addons/wiki/Rollershutter-Bindings)**
>
> Add-ons for openHAB 1.x. Contribute to openhab/openhab1-addons development by creating an account on GitHub.

(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 … ☹

MFG

Lorenzo

---

<div class="post-metadata">

**Author:** ![Guillermo\_Schimmel](https://community.openhab.org/user_avatar/community.openhab.org/guillermo_schimmel/32/42175_2.png) [@Guillermo\_Schimmel](https://community.openhab.org/u/Guillermo_Schimmel)\
**Post date:** [January 18, 2016, 11:36pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/12 "2016-01-18T23:36:28Z")

</div>

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.

Regards

---

<div class="post-metadata">

**Author:** ![zacofunny](https://community.openhab.org/user_avatar/community.openhab.org/zacofunny/32/46537_2.png) [@zacofunny](https://community.openhab.org/u/zacofunny)\
**Post date:** [January 28, 2016, 4:37pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/13 "2016-01-28T16:37:33Z")

</div>

@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?

Cheers

---

<div class="post-metadata">

**Author:** ![lorenzo\_leonelli](https://community.openhab.org/letter_avatar_proxy/v4/letter/l/5f8ce5/32.png) [@lorenzo\_leonelli](https://community.openhab.org/u/lorenzo_leonelli)\
**Post date:** [January 29, 2016, 7:37pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/14 "2016-01-29T19:37:33Z")

</div>

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.

Config:

# Lorenzo - Test Connessione con WAGO DIGITAL OUTPUT

modbus:tcp.slave1.poll=5000  
modbus:tcp.slave1.connection=192.168.1.40:502  
modbus:tcp.slave1.id=1  
modbus:tcp.slave1.type=coil  
modbus:tcp.slave1.start=512  
modbus:tcp.slave1.length=52  
#modbus:tcp.slave1.valuetype=bit

# Lorenzo - Test Connessione con WAGO DIGITAL INPUT

modbus:tcp.slave2.poll=5000  
modbus:tcp.slave2.connection=192.168.1.40:502  
modbus:tcp.slave2.id=1  
modbus:tcp.slave2.type=discrete  
modbus:tcp.slave2.start=0  
modbus:tcp.slave2.length=56  
#modbus:slave2.valuetype=bit

Sitemap:

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]

Items:

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”}

Rules:

// 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.get(timerKey)?.cancel  
timers.put(timerKey, createTimer(now.plusSeconds(timeout)) [|  
if (relayItem.state == ON)  
relayItem.sendCommand(OFF)  
timers.remove(timerKey)  
])  
]

// 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 ) {  
MySwitch\_T\_Salotto\_Grande\_UP.sendCommand(OFF)  
MySwitch\_T\_Salotto\_Grande\_DOWN.sendCommand(OFF)  
} else { MySwitch\_T\_Salotto\_Grande\_UP.sendCommand(ON) }  
end  
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 ) {  
MySwitch\_T\_Salotto\_Grande\_UP.sendCommand(OFF)  
MySwitch\_T\_Salotto\_Grande\_DOWN.sendCommand(OFF)  
} else { MySwitch\_T\_Salotto\_Grande\_DOWN.sendCommand(ON) }  
end  
// 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)  
end  
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)  
end

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

ciao

---

<div class="post-metadata">

**Author:** ![Jens\_Zeidler](https://community.openhab.org/user_avatar/community.openhab.org/jens_zeidler/32/42106_2.png) [@Jens\_Zeidler](https://community.openhab.org/u/Jens_Zeidler)\
**Post date:** [February 12, 2016, 9:52am UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/15 "2016-02-12T09:52:53Z")

</div>

Hi all,

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

> **[Dropbox](https://www.dropbox.com/s/rnquvqjutiphrzv/org.openhab.binding.modbus-1.8.0-SNAPSHOT.jar.zip?dl=0)**

Please also have a look at post 10 in this thread:  
[item configuration:](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/10)

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

`modbus:tcp.slave1.connection=192.168.178.1:502 modbus:tcp.slave1.id=1 modbus:tcp.slave1.type=holding`

Important is to use the `type=holding`

**Item-sample:**

`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"}`

ciao

---

<div class="post-metadata">

**Author:** ![zim](https://community.openhab.org/letter_avatar_proxy/v4/letter/z/cc9497/32.png) [@zim](https://community.openhab.org/u/zim)\
**Post date:** [February 13, 2016, 6:57pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/16 "2016-02-13T18:57:47Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![woody4165](https://community.openhab.org/letter_avatar_proxy/v4/letter/w/ed655f/32.png) [@woody4165](https://community.openhab.org/u/woody4165)\
**Post date:** [March 11, 2016, 12:54pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/17 "2016-03-11T12:54:05Z")

</div>

Hi

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?

Thanks  
Woody

---

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [March 11, 2016, 1:58pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/18 "2016-03-11T13:58:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Guillermo\_Schimmel](https://community.openhab.org/user_avatar/community.openhab.org/guillermo_schimmel/32/42175_2.png) [@Guillermo\_Schimmel](https://community.openhab.org/u/Guillermo_Schimmel)\
**Post date:** [March 14, 2016, 11:44pm UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/19 "2016-03-14T23:44:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yves1](https://community.openhab.org/letter_avatar_proxy/v4/letter/y/2bfe46/32.png) [@yves1](https://community.openhab.org/u/yves1)\
**Post date:** [September 17, 2016, 7:29am UTC](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273/20 "2016-09-17T07:29:14Z")

</div>

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 ?

Thanks

[Next page](https://community.openhab.org/t/modbus-binding-of-rollershutter/3273.md?page=2)
