I have a scene that I want to run when the door is locked, problem is, I want it to check for 3 different time of days using:
rule "Play arrival message when the door is locked"
when
Item FrontDoor_DoorLock changed to ON
then
if(Scene_Arriving_Home.state == ON && gPresenceSensors.state == ON){
gOutsideFrontLights.sendCommand(OFF)
KitchenBarSw1.sendCommand(ON)
Scene_Arriving_Home.postUpdate(OFF)
}
But, then I want to also only run this, if its night time so using vTimeOfDay I need to check for EVENING or BED or NIGHT.
I recommend failing fast. Check whether it’s the right time to run the ruke and if not exit. I’ve documented that approach in Design Pattern: How to Structure a Rule.
If the rule was loaded it means it’s syntactically correct, I personally have some rule with many nested statements.
Like @rossko57 said, you could try to insert some logInfo() at the beginning of every “if” to see if you are matching the states, otherwise there is something wrong either with the logic or the items’ states values…these are the only things I can think of.
Thanks @rlkoshak for the link…it gives many useful hints (and of course the rule above could be better rewritten…I was giving the quicker answer.