I ma a bit lost here. I am trying to make a rule that will turn on a couple lights but only if the house is in Store Run or Morning mode. I can add the conditions to a list but cannot say or to the modes or limit it to running if all conditions are met. The rule will turn on the lights but wil do it no matter what mode the house is in. Last night it was in Night mode and kept turning on the lights in my bedroom when I would move. thanks for the help
You need to use conditions you have defined in the actions section.
TRIGGER
You've done that.
ACTIONS TO TUN
IF
Mode Is Store Run, Day.
THEN
Do your stuff
END-IF
Just defining your conditions doesn't actually do anything. You have to define them in your actions.
Here is an example. Ignore or the Private Boolean stuff.
There are some great examples at the beginning of this thread.
thanks Somehow I completely missed the conditional action option.
You can also add the two modes to the same condition.
That will make things even easier when you add them to the conditional action.
I appreciate the replies. What am I doing wrong here now? I have the rule working to turn on the lights but if i walk out of the room and hte motion goes inactive and come back in it does not cancel the turn off part.
here is the log it does not show the lights turning off but they do at exactly 2 minute from the idle time
app:20612019-10-25 17:07:37.101 infoAction: inactive() on Master Bedroom Motion Virtual --> delayed: 0:02:00 (cancelable) (skipped)
app:20612019-10-25 17:07:37.097 infoAction: Off: Master Bedroom Lamps --> delayed: 0:02:00 (cancelable) (skipped)
app:20612019-10-25 17:07:37.095 infoAction: ELSE (skipping)
app:20612019-10-25 17:07:37.082 infoAction: active() on Master Bedroom Motion Virtual
app:20612019-10-25 17:07:37.061 infoAction: Adjust: Master Bedroom Lamps by +100
app:20612019-10-25 17:07:37.056 infoAction: IF (Master Bedroom Motion active(T) AND Mode is Day(T) OR Mode is Store Run(F) [TRUE]) THEN
app:20612019-10-25 17:07:37.004 infoMBR Lights on Triggered
app:20612019-10-25 17:07:36.992 infoMBR Lights on: Master Bedroom Motion motion active
app:20612019-10-25 17:07:32.343 infoAction: inactive() on Master Bedroom Motion Virtual --> delayed: 0:02:00 (cancelable)
app:20612019-10-25 17:07:32.329 infoAction: Off: Master Bedroom Lamps --> delayed: 0:02:00 (cancelable)
app:20612019-10-25 17:07:32.326 infoAction: ELSE (do actions)
app:20612019-10-25 17:07:32.325 infoAction: active() on Master Bedroom Motion Virtual (skipped)
app:20612019-10-25 17:07:32.321 infoAction: Adjust: Master Bedroom Lamps by +100 (skipped)
app:20612019-10-25 17:07:32.316 infoAction: IF (Master Bedroom Motion active(F) AND Mode is Day(T) OR Mode is Store Run(F) [FALSE]) THEN (skipping)
There are actually a couple problems. First, AND
and OR
are evaluated left to right with equal precedence, so I'd either parenthesize "Mode is Day OR Mode is Store Run" or combine them into a single condition ("Mode is any of Day, Store Run" or something similar). This isn't related to the issue you're seeing but may come into play when you're in a different mode.
The other thing your missing is a "Cancel Delayed Actions" action. Anything you have marked as "cancelable" will not actually get cancelled until a "Cancel Delayed Actions" runs--so what you're seeing as-written is correct, with it turning off 2 minutes after each inactive event, not just the last one when there's newer activity. I'd add this before your "Adjust..." action.
The documentation linked to above has a motion-lighting example that shows how cancellation works. I'd recommend reading the docs before you go too far in RM. That being said, is there a reason you're using RM for this automation? The built-in Motion Lighting app can handle everything you're doing with the lights (and as a bonus, it might run a bit faster since it's a much smaller app than RM; the tradeoff, of course, is that it's less powerful--but it has a ton of options, still). I'm not sure why you're manipulating a virtual sensor, which Motion Lighting can't do (unless you make use one of those "motion with switch" drivers--or you could not use RM and use Zone Motion Controller for this part), but presumably you have some use for that somewhere else...
Please see my previous post on this thread about your Mode Conditions. You can combine them into one condition.
thank you. the motion sensor is my way of controlling a light that is on a Hunter fan in Alexa. Motion sensor feeds to Amazon and a routine in Amazon triggers the light.