How to Make a rule to do this

I have a rather complicated scenario that I am not sure how to set up in rule machine.

Night time switch is on.
Mode changes from Away to Home.
Door 1 opens, turn on lights.

So basically I want to turn on some lights at night when a door is opened, but only if the mode had changed from away to home. What happens is we come home. Come into garage. Get out of car. Open door to house, then want lights to come on. But if we haven't been gone then I don't want the lights controlled by the door.

I hope some of that makes sense.

After second thought, I don't think what I posted will work. Let me think about this for a bit.

Scott

I was thinking maybe some sort of variable that would be set for previous mode then current mode???

To throw another wrinkle into this, I only want it to turn the lights on the first time the door opens.

I am currently doing this with an app I wrote. I use state variables. It works fine. I am just trying to move my custom apps that I had imported from ST to standard apps in HE. It may not be possible to get all things converted over.

How are you setting your mode? Presence sensors or something else?

Mode gets set a number of different ways, presence, switches. It shouldn't matter how the mode changes as it should work in any case.

I get that; I was trying to think of a way to trigger your rule....

Don't waste a lot of time on this. As I said I have an app that works ok. Just kinda wondering.

Believe me, it can be done. There are way more smarter people here that can work around RM than I. There are some new conditional statement rule making available with, but I am not as well versed in that as I should be.

I appeciate the help. I need to step away from it for now. Sometimes that helps to trigger something in my mind as to how to do it. At my age my mind needs a lot of triggering...:slight_smile:

I dont think it's copmlicated.

Triggered ruel with conditions.
Door=trigger
Mode change = trigger or action
Night time switch on = condition
Restricton "only when away mode"

If it's triggered by mode change to Home but the restriction is only when away mode, How would it get triggered as the mode would not be away when the trigger occurs.

Not sure but you could try this........

Or maybe this

I'm not real up on RM. But the issue I see with that is what if the mode changes from Night to Home? It should only work on Away to Home. It appears that your suggestion will trigger whenever the mode changes to Home. Cause at that point mode will not be Away.

I don't have a "home" mode....I was using my "day" mode to represent your "home"

I think what I can do.

Create 2 global variables. One called Previous Mode and the other call Current Mode.
Create 1 rule that is triggered on mode change which will copy Current Mode to Previous mode then set Current Mode to the new mode.

Then use those variables in a new rule that says if Previous Mode is Away and Current Mode is Home then look for door to open and turn on lights. With the nighttime restriction.

How does that sound?

Sounds good give it a try

If you set "home mode" as action so it becomes home mode and turn on the lights as well thru opening the door but only if night switch is on and only if mode is at the momen in away.

maybe I didn't understand 100% what you want to achieve.

Running into a lack of knowledge here. I created a rule as follows:

Is the % the way to specify the values? Especially not sure of %Mode. Didn't know if that would give me the mode value or not.

In addition I want to set another variable (enable enter lights) to true if it is night time. I thought about doing another rule to compare the previous and current mode to variables and set the enable enter lights. But my problem is how do I know which rule will execute first If 2 rules are triggered by mode change? Is there someway in the rule pictured above to add another IF to set my enable if it is nighttime? I need the current and previous variables to get set no matter what but not the enable if it isn't night time.

I realized that. I just changed my reply to reflect home instead of day.