Adding delayed off in nested IF loops - Rule 4.0

Ever since the updates to Hubitat that included the new 4.0 Rule Machine, I’ve been having random anomalies with the Motion Lighting App. I tried to trace the issue in the logs but wasn’t able to track down the cause. So I decided to rebuild the routine in the new Rule Machine.

Here is my current motion routine for my master bathroom lights:

The “Master Bathroom Mirror Lights” device in this rule is a GE/Jasco Z-Wave Plus Smart Motion Dimmer (26933) switch. So it’s both motion sensor and physical dimmer switch.

All works fine, but in the Motion Lighting App, I was able to set delayed offs for each mode with different “off” delay times.

As you can see in this rule, regardless of mode, all turns off after 2 minutes, (last ELSE in the rule).

I’d like write this rule with different delay times. For example, “Twilight”, delay off for 1 minute for quick bathroom trip in the middle of the night. Then “Morning-Weekday” mode set for 15 minute delayed off to have enough time to shower without having to retrigger the sensor.

I thought about incorporating the “offs” into the nested IFs and leaving off the last ELSE, but something tells me this won’t work:

Any suggestions are appreciated.


Use the Delay by mode action before the Off command.

Then you don't put a delay on the action of off.

The Motion lighting app had an issue introduced with yesterday's update that they said they will address in the next hotfix. I found that by opening each motion lighting rule and opening each configured setting within then updating those and clicking Done the motion lighting worked again.

This is a Rule Machine Rule not Motion Lighting

Added in the "Delay Actions Per Mode", works like charm.
Pasting in the final layout of the rule for reference should anyone need an example to build off of.
Thanks for your help @Ryan780 !

1 Like

@Terk , thanks for the info. Good to know the Motion Lighting App will be fixed and how you were able to work around it.

Still, I'm probably better off learning more of the Rule Machine just to understand it better. But thanks for the feedback none the less.

That is what he's using now, my response was to his original statement where he said.

I’ve been having random anomalies with the Motion Lighting App.

I use Rule Machine for many things I just have three rules in the motion lighting app. With those three I clicked each rule then clicked the motion detector option and clicked update then the on motion event and updated it then clicked done on the rule, according to the 2.1.3 release notes all you should have to do is open the rule and click done although I'm pretty sure I tried that once last night and it didn't work until I clicked on a few more of the configured settings and updated those then pressed Done.