Rule Machine - Get peer assistance here with setting up rules

okay this is what i have so far, where do i add the part to turn off the light ?

You can add it to your Action, both for true and false.
You can have multiple actions with Rule Machine.

Add in the Turn Off these Switches After a Delay, Pending Cancellation

I don’t think this will work with a triggered rule. It only evaluates when the trigger fires, so it won’t see the change to motion. This would have to be broken up into two rules or something…

I forgot about that.

He could just create a separate rule for turning off 4 minutes after motion is no longer detected.

I use something like this for mine in the bathroom, except mine is based on motion and the door open/closed sensor. It will turn off my lights and fan switch for me.

it seems to have worked when i walk in it turns on the light after i leave the room , 1 minute later it does turn off the light . now hopefully it dims the light at the times i have . here is what i have and it seems to be working out so far. thanks everyone for the help.

i guess i could change the time really quick and see if that part works as well .

So the lights didn’t go off with the door open because the rule evaluates true as long as the door remains open. So it evaluates true and never changes state until the door is closed regardless of motion state.

So… before falling back to the 2 rules that Bruce posted, which I readily accept would work perfectly. I tried playing with RM to make it do what I wanted with complex rules. I ended up with 2 rules still…

Rule 1
Trigger - Closet Door Open
Action - Closet Light On, Rules: Mbed Closet light off

Rule 2 (Mbed Closet Light off)
Conditions:
Closet Door closed
Closet Door open
Closet Motion active

Rule
(closet door closed AND closet motion active)
OR
(Closet door open and closet Motion active)

True: on:closet light
False delay by X minutes [cancel] Off: closet light

In rule 1 if I only put the action as light on, the light would stay on as long as the door was open if the motion sensor was never triggered. So if someone opened the door, changed their mind and walked away without entering the second rule never evaluated because it never had a state change. So in the actions, I added the action of evaluate rule 2 and presto light goes off after the delay. Light goes on if you enter the closet even if the light was already off.

So it is two rules still, but it avoids the two rules potentially flashing the light based on the timing and most importantly is helping me learn the logic. That was really the point of this particular set of rules anyway… I still don’t understand them enough to get it functioning with one rule like bamarayne but I’ll get there eventually.

Thanks for the suggestions!

I just want to point out that this logical expression is identical to “door open or motion active”. All of the various sub terms devolve to that.

Bruce that is what I finally figured out, there is no way to separate door open as what makes the light come on and still have the rest of the rule evaluate false to turn it off if the door is left open. Otherwise the light would never turn on… So I think it has to be 2 rules…

I’m sorry, I missed what you were trying to do. Could you explain again?

This too devolves to simply “motion active”. The outcome has nothing to do with the door.

@whyintheworld

I think this is what you are looking for.

Using this logic this occurs:

Lights on with motion or either door opening.
Lights stay on for 10 minutes after motion ends or after doors close
Lights stay on for 10 minutes even if doors stay open
If doors are open and motion occurs at 9 minutes the lights stay on and the timer starts over.
Lights go out 10 minutes after the doors are closed and there is no motion.

I believe this is what you were wanting. I was definitely wrong in the way I said to do it the first time.
Sorry about that.

My confusion comes because that would always resolve to TRUE if a door was left open, so when would it reset? Even if motion becomes active it is already true so it wouldn’t cancel would it?

Yep so I could just simplify rule 2 to motion active and leave out the door component. The only caveat is that the door closing would never turn off the light immediately unless no motion had been sensed.

When this all started I had 3 rules.

Rule 1 Trigger: door open
Action light on.

Rule 2 Trigger door closed
Action light off

Rule 3 Condition Motion active
True Light on
False Delay with cancel light off

That worked but if you closed the door while inside then the light went off and you couldn’t re-trigger the rule until motion had stopped and you moved again in order to change the state.

But I learned a lot… I think lol…

Yes, it would resolve to true. But, the lights being turned off is an action under True, just delayed and cancellable. When ever the motion goes false and is retriggered then the timer for the off delay is restarted. Thus, leaving the door open and walking out causes the lights to go off in 10 minutes. Walking back in after the lights go off cause the motion to go active and the lights to come back on.

It looks weird and it looks really over simple. But with the “or” commands instead of the “and” command it actually works.

For some reason I always end up with rules that start out as very complex and I just work them down to the most basic form.

Yes, the lights would come back on as long as the motion had gone back to false and you are now detecting new motion. This works really well for me in the garage.

One big difference I believe we have is that your motion sensor is timing out after several minutes. Mine resets in 15 seconds.

It may all be academic… While we were sleeping last night the garage door went up and a bunch of other random devices fired on/off. The garage door going up randomly appears to be well outside the wife’s tolerances… I had seen others report random things firing but hadn’t experienced it myself until last night.

Oh man that’s not good at all… I’ve yet to experience that.

Use two rules and a virtual switch:
1: trigger: arrival turns the switch on, and off again in X minutes.
2: trigger: garage open with condition: switch on activates lights
(Plus any additional conditions)

You need garage opening to be a trigger so arrival while already open doesn’t activate the rule, unless you want that

Thanks! I can’t believe I didnt think of that, thats exactly what I need.

My Furnace Fan turning is turning on a lot today, even though conditions do not appear to warrant. Had been working fine before.

Condition:
1)Temperature of Ecobee Sensor:Bedroom <= Ecobee Thermostat:Main Floor -3
2)Temperature of Ecobee Sensor:Bedroom >= Ecobee Thermostat:Main Floor +3

Rule:
Temperature of Ecobee Sensor:Bedroom <= Ecobee Thermostat:Main Floor -3
OR Temperature of Ecobee Sensor:Bedroom >= Ecobee Thermostat:Main Floor +3

True:
Ecobee Thermostat:Main Floor:Fan setting on
Push ‘Turned on furnace fan’ [device] to xxx-xxx-xxxx

False:
Delay by 20 minutes
Ecobee Thermostat:Main Floor:Fan setting auto

The system is running my fan
Bedroom sensor: 73 degrees
Thermostat temperature: 74 degrees.

Like I said, everything seem to work ok until today. Any idea how I can debug???

Look at Live Logging for that rule, and see what events it is responding to, rule truth, etc.