How can I use a rollershutter?

Hello,

in use a Raspberry with openhab 2 and modbus Binding.
I want use habpanel for alle function.
At the moment i have my signals as things and Items. So I can switch digital Outputs how lights.

I have two digital Outputs for a rollershutter.
do1 for Up, do2 for down ( constant Signal ) , stop do1 and do2 = FALSE. do1 and do2 are single items.

But the rollershutter Widgets use only one Item.
I dont know, how i build a rollershutter item with my Signals. I read about rollershutter types but how can i use my items?
And for stop i need a item that send the item do1 and do2 with false. how and where can I build this “virtual” item?

I new in openhab and find olny example with knx. But i use modbus.
Have everyone an example for me?

regards,
jamhacker

Create a Proxy Rollershutter Item. This is what you put on your sitemap and use in Rules. Then create Rules that forward the commands to the Rollershutter Item to your various Items.

It doesn’t matter what binding is being used. Once you are using Items it doesn’t matter what binding is used.

I dont work with rules and sitemap until now.

I think i need only one examle to understand the function.

  1. I have my things

Bridge poller coils [ start=0, length=99, refresh=300, type=“coil” ] {
Thing data UP “up1” @ “Modbus” [ readStart=“0”, readValueType=“bit”, writeStart=“0”, writeValueType=“bit”, writeType=“coil” ]
Thing data DOWN “down1” @ “Modbus” [ readStart=“1”, readValueType=“bit”, writeStart=“1”, writeValueType=“bit”, writeType=“coil” ]

  1. items

Switch GO_UP “GO_UP” { channel=“modbus:data:SPS:coils:UP:switch” }
Switch GO_DOWN “GO_DOWN” { channel=“modbus:data:SPS:coils:DOWN:switch” }
Rollershutter rollershutter_Test1 “Test1 [%d %%]” <rollershutter>

This work over Papier_UI and for lights, too.
But how can i use a rollershutter?

  1. sitemap

Switch item=rollershutter_Test1 label=“rollershutter_Test1” icon=“rollershutter” mappings=[UP=“UP”, STOP=“STOP”, DOWN=“DOWN”]

  1. rules

rule "Item rollershutter_Test1 "
when
Item rollershutter_Test1 received command
then
switch(receivedCommand.toString.toUpperCase){
case “UP”: {
sendCommand(GO_UP ,1)
}
case “STOP”: {
sendCommand(GO_UP ,0)
sendCommand(GO_DOWN,0)
}
case “DOWN”: {
sendCommand(GO_DOWN,1)
}
}
end

Can I use it so? Whats wrong?
Or have someone a easy example for me, that i can use?

Your GO_UP and GO_DOWN Items are Switch type. You’ll want to send them ON or OFF commands.

This are digital Outputs of a plc. i can switch it over Papier ui for tests.
I have Chance it to number? The other code is right?

You’ve configured them with the Modbus binding, as coils. When you send ON/OFF to openHAB switch Items, the binding converts to numbers to send over Modbus (because modbus is always numbers at heart)

ok thank you, i set all to type number.
But i never work with sitemap and rules. I not sure how I bind the rollershutter Widget with the modbus coils.

I use the habpanel with a rollershutter widget.
I write in the rule: item.sendCommand(1) and item.sendCommand(0).

The logger look like ok i think (parameter names are differnt):

Item ‘Roll_EG_Test1’ received command UP
Item ‘rolloHoch’ received command 1
rolloHoch predicted to become NULL
Item ‘Roll_EG_Test1’ received command DOWN
Roll_EG_Test1 changed from 0 to 100
Item ‘rollorunter’ received command 1
rollorunter predicted to become NULL

My problem is, that i get no change in the parameter on the plc about modbus.
I send the right commands with “0” and “1” ?

item:

Number rolloHoch “rolloHoch” { channel=“modbus:data:SPS:holding:rolloRauf:number” }

rule:

rule “Item Roll_EG_Test1”
when
Item Roll_EG_Test1 received command
then
switch(receivedCommand.toString.toUpperCase){
case “UP”: {
rolloHoch.sendCommand(1)
}
case “STOP”: {
rolloHoch.sendCommand(0)
rollorunter.sendCommand(0)
}
case “DOWN”: {
rollorunter.sendCommand(1)
}
}
end

things:

Bridge modbus:tcp:SPS “SPS” @ “Modbus” [ host=“192.168.178.24”, port=502, id=2 ]{

 Bridge poller holding "holding" @ "Modbus" [ start=12288, length=10, refresh=600, type="holding" ] {
    Thing data rolloRauf "Byte1memory" @ "Modbus" [ readStart="12288", readValueType="int16", writeStart="12288", writeValueType="int16", writeType="holding" ]
    Thing data rolloRunter "Byte2memory" @ "Modbus" [ readStart="12289", readValueType="int16", writeStart="12289", writeValueType="int16", writeType="holding" ]

There was nothing wrong with the way you had your modbus coils linked to openHAB Switch Items. You just needed to use sendCommand(ON) in your rule, to suit a Switch type Item.