Help with Rules Machine logic

I am trying to create what I thought was a simple rule.

The trigger is my front door being opened.

If the front porch light is one, I want it to be changed from 50% to 100% intensity.

If the light is not on, do nothing.

I can get everything working except for the condition. Regardless of what I try, if I open the front door, it sets the light to 50%, even when the light is off.

Any help for this Rules machine n00b would be greatly appreciated.

Cheers! :slight_smile:
=C=

Don't even need that for what the OP asked

Trigger front door open.

Actions

IF (front door open AND light is ON) THEN
DIM porch light to 100%
END IF

If you then want it to go back to 50% after a close with a delay then

Trigger front door 'changed'

Actions

IF (porch light OFF) Exit rule
IF (front door open) THEN
Cancel delays
DIM porch light to 100%
ELSE
DIM porch light to 50% delay X mins
END IF
2 Likes

Thank you sir, that did the trick. :slight_smile: I see where I went wrong now.

Cheers! :slight_smile:
=C=

1 Like

Make sure to check the "Cancel?" flag on this action, which will make the action show as something like:

Dim: Porch Light to 50% --> delay X minutes (cancelable)

Otherwise, the "Cancel Delayed Actions" action does nothing, and re-opening the door won't "reset" this countdown.

1 Like

Well spotted/ noted :+1: that's problem with doing it from memory rather than building a real rule.

Also note that you don't NEED the open as a condition on the 1st rule (because it has to be true for the rule to trigger) but I added it to help clarify things.

2 Likes

Thank you for this statement. It helped clarify the relationship between trigger and condition. For a while I was wondering why we needed both trigger and condition.
John

1 Like

FTR, I have a second rule that handles the close. Returns the list to 50% 30 seconds after the door closes.

Now I need to parameterize the original value in case I change it later on so that it just returns it to it's previous state before the door was opened. :slight_smile:

Thanks again for all the help.

Cheers! :slight_smile:
=C=

You can do that with capture and restore. By using my 2nd example after cancel delays add capture this light then instead of 50% after else do restore after 30s cancelable.

You need to do it in one rule for this though.

1 Like

Interesting. Had not seen that feature. Thank you. I've now deleted the CLOSE rule and implemented this with a timer.

Cheers! :slight_smile:
=C=

1 Like

ok, I implemented it as you described, but it's not working right.

here's what I've got.

The problem is that it's not resetting the bulb to 50% after 5 minutes.

Thoughts on what I've done wrong?
=C=

Yes it's nothing like my example rule :rofl:

Try this

Triggers

Door contact 'changed'

Actions

"Simple condition"
IF (front door light is OFF) Exit Rule
"Normal conditions"

IF (front door open) THEN
Cancel delays
Capture front door light
Dim: Front door light: 100
ELSE
Restore: front door light -> delayed 0:05:00 (cancelable)
END IF

That will do the job

1 Like

Thank you. that works.

=C=

1 Like