I’m trying to achieve the following; “if terrace door is open, don’t shut it’s rollershutters”.
The basics are working fine, so I can up/stop/down the rollershutter [OG_Buero_ROL_TUE_Ost] and a sensor [OG_Buero_SEN_TUE] provides OFF (= door open) and ON (= door closed) state for that specific door.
My question is if there’s a better way to tell OH to leave the rollershutter-state as it is (like something compareable to “blocking”) or if it’s already “the” solution?
rule "ROL/Sperre Bürotüre"
when Item OG_Buero_ROL_TUE_Ost received command then
if (OG_Buero_SEN_TUE.state == OFF)
{
var Number OG_Buero_ROL_TUE_Ost_OLD = OG_Buero_ROL_TUE_Ost.state
sendCommand(OG_Buero_ROL_TUE_Ost,OG_Buero_ROL_TUE_Ost_OLD)
}
end
In such case you should not use the item that is linked to the rollershutter on the UI!
Create a (proxy-) item of the same type which is not linked to any thing instead.
Use a rule that triggers on this proxy-item. In that rule check to state of the door as you did in your example and in case the door is close send the command to the item operating the rollershutter.
Your code is going is a loop.
Receive command - send command - receive command …
As @opus said you need to use a proxy item and use that to send the command to your rollerShutter item:
rule "Block rollershutter"
when
Item proxy_Roller changed
then
if (OG_Buero_SEN_TUE.state == ON) { // Door closed
OG_Buero_ROL_TUE_Ost.sendCommand(proxy_Roller.state as Number)
}
end
Hi guys - many thanks for your help, but when I add this to my rules/items nothing happens, it doesn’t matter if the door is open or closed. I don’t get any errors/warnings or log entries. I’ve even restarted OH.
rule "ROLLO/Sperre Bürotüre"
when Item PROXY_OG_Buero_ROL_TUE_Ost changed then
if (OG_Buero_SEN_TUE.state == ON)
{
OG_Buero_ROL_TUE_Ost.sendCommand(PROXY_OG_Buero_ROL_TUE_Ost.state as Number)
}
else if (OG_Buero_SEN_TUE.state == OFF)
{
// send Telegram for error handling
}
end
…further down below the rule-snippet in my “master rollershutter rule”: