Rule Question | How To Example

How in the heck would I do this? One rule or two?

If, Mode is Early Morning AND,

Sensor 1 detects motion, Early Morning lighting comes on.

BUT IF, Mode is Early Morning and, within 30 seconds, sensor 2 detects motion, Day lighting comes on.

THEN IF, neither sense motion during Early Morning Mode, all lights turn off.

I’m honestly not sure how best to ask the question but maybe this will get the ball rolling.

This is where I'm at thus far:

You might be able to do this all in one rule, but I think it's simpler to split it out ("keep it simple..." and whatnot). Here's one way with two rules plus one app.

Zone Motion Controller

Create a Zone Motion Controller instance to "aggregate" Sensor 1 and Sensor 2 into one sensor. This make things easier later, though there are workarounds if you don't want to do this.

Rule 1

(Write this one second, but I'm putting it first because you might be wondering where some of the stuff in the other rule comes in if I don't...also, just make sure you make that "Wait for events" thing happen before you want this to "reset," which if you were pickier about you could probably make another rule that does based on Early Morning becoming active, but this might be good enough.)

Triggers: Sensor 2 active

Actions:

IF (Private Boolean is False) THEN
  Set Private Boolean False: Rule 2
END-IF
Wait for events: Time is 04:00 AM 
Set Private Boolean True: This Rule
Set Private Boolean True: Rule 1

Rule 2

(Here you can see how I'm using Private Boolean, set for this rule in the other rule, to trick this one into doing different things based on the other sensor.)

Triggers: Sensor 1 active OR Private Boolean becomes False

Actions:

Cancel Delayed Actions
IF (Mode is Early Morning)      
  IF (Private Boolean is True) THEN
    Turn on early morning lights
    Set Private Boolean False: Rule 2
    Delay 0:00:30 (cancelable)
    Set Private Boolean True: Rule 2
   ELSE
    Turn on day lights        
    Set Private Boolean True: Rule 2
  END-IF
  Wait for events: Zone Motion Controller Sensor inactive
  Delay 0:05:00 (cancelable)
END-IF

There are probably other ways to do this, but this is one that seems like it should do everything you're asking for. I have not tested this and it is likely I missed something, but hopefully it gets you (or someone else who can verify my logic) started. :slight_smile:

1 Like

Perfect...thank you. This will help me get started for sure. I'll try wrapping my head around Private Boolean. :flushed:

2 Likes