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
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
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 )
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)
}
}
Directly from the wiki pages I found this:
about the “Example for binding shutter using HTTP GET commands” I try to ask what follows:
Does anyone already have worked with this and have suggestions ?
Hi,
Sorry for my late reply but currently I only have limited time for this topic.
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.
So I took the decision to implement the modbus Rollershutter binding by my own.
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.
Cheers.
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 …
MFG
Lorenzo
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:
Regards
@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
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:
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
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
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=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
Hi,
Thanks for this, can You also show wago side ? How You set up values for this and reset them.
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
@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 ?
Thanks
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.
Jens
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 (https://www.dropbox.com/s/rnquvqjutiphrzv/org.openhab.binding.modbus-1.8.0-SNAPSHOT.jar.zip?dl=012). 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
Yves
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
Jens
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:
modbus:tcp.slave1.connection=10.0.1.63:502
modbus:tcp.slave1.type=holding
modbus:tcp.slave1.id=1
modbus:tcp.slave1.start=12288
modbus:tcp.slave1.length=3
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.
Helmut