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?
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.
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?
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)
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
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.