Need some help with a rule :/

Hey Guys,

I am new to Hubitat and home automation and was looking to see if anyone could please help me. I come from Smartthings (Webcore) but never had anything super advance since the hub never worked or had delays or was down. With that said I am sticking to using Rule Machine and all the built in apps on the Hubitat since my rules are all basic. So what I am trying to accomplish here is, when my garage is open, I want the current state of the selected lights to be saved, then the lights to dim up and down as long as the garage is opened, once the garage closes; I want the lights to return back to their original states: example if they were off, then return to off etc. For some reason I cannot get this to work, I am sure it is because I am a rookie and I am doing something wrong. Any help you guys can provide would be great. Thank you so much!

Here is what I have so far.

Two things I see. You can delete both IF garage door lines in the rule. You don't need the first IF Garage Door open. The rule would not execute unless the garage door is open because that is your trigger. You also don't need the IF door closed END REP. You are using a while so once the door closes it will no longer repeat.

I would start with those two changes and see how it goes.

Also both of your IFs are missing the END IFs, FYI. I think you should delete both but in future if you have an IF you need an END IF.

1 Like

Thanks a bunch, already learned a few things from you. I am not home to test but it should look like this right?

As for the "End IFs" good to know I have a few rules with ifs and I don't have "End IF's" probably the reason they don't work.

1 Like

Looks good. I have not used the capture and restore function in any of my automations so not sure how that will work. Might have to play with your delays, but the rule looks correct.

1 Like

Dang if this works, I am going to be stoked! Thanks a ton. I am glad people like you are on the forum.

It looks like your While loop is cycling the selected lights between 90 and 35 every 5 seconds. I'm not sure that you need to set the Office Hub Light color every 10 seconds. I don't think it's hurting anything inside the loop but I'd try to move it to before the While loop. I'd also typically recommend making the delay cancelable but since your loop is only 10 seconds you probably won't get multiple instances of this rule running if the door is closed then immediately opened again for some reason.

1 Like

Thank you. Would the cancelable also be applied on the "While" in the form of Stoppable?

Just learning :smiley: .

Rule Machine is anything but basic.

Webcore is built in to Hubitat now. I don't personally use it, but it is available. If you had an existing webcore from ST, that might be an easier transition.

1 Like

Here’s a similar example. I use this to flash my shower lights 3x if someone opens the front door while the shower is running.

1 Like

Neat, thanks. This confirms for me that the Capture should work in my rule.

Yes, so the first couple of actions would be

Cancel Delayed Actions
Stop Repeating Actions

You'd also select the "cancelable" option on both of your delays.

1 Like

Rule works flawlessly now. The capture also works. I learned a lot just by the few things you and a few others have told me. I also managed to fix a few other rules by adding the END IF, weird how some work without it and some don't.

Thank you all who commented here and helped me out.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.