I have a zigbee motion sensor for my bathroom with two rules, one for turning the hue lights on when motion is detected, and another that triggers when the sensor is inactive then runs an action on a 6 minute delay to dim all the lights. The problem I keep running into is if I re-enter the bathroom while the action to delay the turn off for 6 minutes is running, the lights can turn off while I am inside. Not sure how to tackle this
This would probably best be handled by one rule: trigger on motion active, turn on lights, wait for condition: motion inactive with desired duration, then turn off lights. A trigger event will cancel the wait, avoiding the undesirable outcome you describe.
Even better: is there a reason you're writing a rule for this? The built-in Motion Lighting app can handle this with ease, and without going into full-blown Rule Machine, either Basic Rule or Simple Automation Rules can handle this scenario without this much work on your part.
im so used to rule machine that I thought this was the only way to do this. I will look into the motion lighting app as well thank you for all of the suggestions!
@bertabcd1234 is providing sound info! I recently bragged that after nearly 3 yrs on HE, I converted 100% off of RM! It was short lived - as sadly there is no 'if motion elsewhere, turn off'... and I had to write an exception as @bravenel explained it wasn't going to be.
After my GF goes off to work, I use her lack of presence to run a 'single human' setup. But in so many cases, my complex rules really got simple (and worked better TBH) after I switched from RM to Basic Rules, Mode/Motion Lighting App and Notifications. SAR, (the simple automation rules) I was able to take out of the stack, simplifying even further. The best part of M2L app is it really solved my confusion over retriggers... that problem is just - gone. I once tried like crazy to get a grip on delay vs wait vs cancel vs... programmer... I lost that battle!