Hi there,
Is there any limitation to using nested if statements in rules?
This rule works (please excuse the noise):
rule “LoungeLightsOff”
when
Time cron “0 * * * * ?”
then
//if(sleepMode.state == ON) {
//if(loungeLightAuto == true) {
if(LLlastCheck == LLcounter) {
LLcounter = 0;
LLlastCheck = -1;
//sendCommand(HueGroup1, OFF)
sendCommand(Hue4_Toggle, OFF)
sendCommand(Hue3_Toggle, OFF)
sendCommand(Hue2_Toggle, OFF)
sendCommand(Hue1_Toggle, OFF)
//sendCommand(kitchenPIR, OFF)
loungeLightAuto = false
}
//}
//}
else {
logInfo("LLcounter", "LLcounter = " + LLcounter)
LLlastCheck = LLcounter
logInfo("LLlastCheck", "LLlastCheck = " + LLlastCheck)
}
end
However if I uncomment one of the if statements it doesn’t work:
rule “LoungeLightsOff”
when
Time cron “0 * * * * ?”
then
//if(sleepMode.state == ON) {
if(loungeLightAuto == true) {
if(LLlastCheck == LLcounter) {
LLcounter = 0;
LLlastCheck = -1;
//sendCommand(HueGroup1, OFF)
sendCommand(Hue4_Toggle, OFF)
sendCommand(Hue3_Toggle, OFF)
sendCommand(Hue2_Toggle, OFF)
sendCommand(Hue1_Toggle, OFF)
//sendCommand(kitchenPIR, OFF)
loungeLightAuto = false
}
}
//}
else {
logInfo("LLcounter", "LLcounter = " + LLcounter)
LLlastCheck = LLcounter
logInfo("LLlastCheck", "LLlastCheck = " + LLlastCheck)
}
end