Hi,
I wont to control my rollershutter with the new Alexa Skill. This are represented by HomeKit Items, wich don’t represent rollershutters.
My idea is now to simulate an switch with rules. The rollershutter should work like normal, but an “alias switch” should represent the state of the shutter. If the switch recives a command (ON or OFF), the shutter should move.
At the moment I have this two rules. But they behavior like a loop, if I move the shutter for example to 95% close state.
The first rule works exactly like expected, but the second creates the loop…
import java.util.concurrent.locks.ReentrantLock
var java.util.concurrent.locks.ReentrantLock lock = new java.util.concurrent.locks.ReentrantLock()
// Items:
// Rollershutter ZWave_Shutter_Schlafzimmer "Rollladen Schlafzimmer"
// Switch Alias_Switch_Rolladen_Schlafzimmer "Rollladen Schlafzimmer"
rule "Rolladen Schlafzimmer Movement"
when
Item ZWave_Shutter_Schlafzimmer changed
then
logInfo("Rolladen Schlafzimmer Movement", "der Rolladen hat sich bewegt")
lock.lock()
try {
if (ZWave_Shutter_Schlafzimmer.state < 5){
sendCommand(Alias_Switch_Rolladen_Schlafzimmer, OFF)
logInfo("Rolladen Schlafzimmer Movement", "Rolladen ist oben - Alias Switch -> off")
}else{
sendCommand(Alias_Switch_Rolladen_Schlafzimmer, ON)
logInfo("Rolladen Schlafzimmer Movement", "Rolladen ist oben - Alias Switch -> on")
}
} finally{
lock.unlock()
}
end
rule "Rolladen Schlafzimmer Alias Switch"
when
Item Alias_Switch_Rolladen_Schlafzimmer received command
then
logInfo("Rolladen Schlafzimmer Alias Switch", "Switch received command")
lock.lock()
try {
if (Alias_Switch_Rolladen_Schlafzimmer.state == ON){
sendCommand(ZWave_Shutter_Schlafzimmer, 100)
logInfo("Rolladen Schlafzimmer Alias Switch", "Rolladen wird herunter gefahren")
}else{
sendCommand(ZWave_Shutter_Schlafzimmer, 0)
logInfo("Rolladen Schlafzimmer Alias Switch", "Rolladen wird hoch gefahren")
}
} finally{
lock.unlock()
}
end
Has anybody souch a setup? Any suggestions so solve my problem?
PS: Openhab2, Zwave binding for shutters
Greats
Julian