Help with rule structure

Looking for some advice on how to structure something.

Essentially what I'm trying to do is put a dog rule in place where I can turn some outside lights on when the front door opens during my night mode (or between sunset and midnight) and then have it turn off with some logic.

I do have a motion sensor out front, but that isn't often triggered in that area of the front yard so this is what I'm thinking...

The trigger would be the front door changing and the action would be turning on the front flood light during my evening mode. This part is fairly simple. The part I'm struggling with is the logic to turn it back off.

I figured, setting a 'wait for event' could work so that I could wait for the front door to change again to turn the light off, but how would that look in rule machine? It doesn't seem like I could do something like IF mode is evening THEN turn on front flood light AND wait for event?

I'm probably missing something simple, just trying to reprogram myself to think about the trigger based rules that Hubitat is offering.

Any thoughts would be helpful.

Thanks.

Here’s an option that should work:

A couple of things come to mind:

Try to avoid using changed if you can, as it just burdens your rule with figuring out what the change was. You can always have two rules to accomplish something, and often this will be much simpler, both to think about and implement.

When you have an IF-THEN, what follows is a list of actions to run (in order) when the test is true. So one of those could be to turn on the lights, followed by a Wait for Events, or Wait for Conditions. Then, think through what happens after the Wait -- turn off the lights. Consider this

IF(Mode is Evening) THEN
   Turn on lights
   Wait for Conditions: Door is closed OR Not Mode is Evening
   Turn off lights
END-IF

That's just an example, for a rule that presumably was triggered by Door opens. In this example, the Wait would end when mode changed to something other than Evening, or the door closes -- whichever happens first, due to the OR in the conditions.

1 Like

Thanks guys- You've given me enough to figure out what I needed. Just trying to learn the ruleset.

Thanks again,
Frank

1 Like

i'm using simple automation for that.. has everything you need.

i also do have a hue motion lux sensor there so i do have a corresponding rule if the lights are not already on at night and there is motion at the front door turn on light.

1 Like