Return from Away in RM?

Is there a way to use ‘Return from Away’ in RM? I set up a simple automation to turn in some lights when either my wife or I return home (cell phones arrive) but only if the other is not already home. In SA, I did this with a restriction ‘only if mode is away’ to prevent it from running if one person is already home. I tried to duplicate this in RM using;

IF (Mode is Away(F) AND
Time between Sunset and Sunrise(T) [FALSE]) THEN
On: Front Door Light, Bookcase Lamp, Kitchen Sink
Unlock: Front Door Lock

but it doesn’t run. I think what’s happening is the presence sensor is switching the mode before the IF-THEN runs, so the IF is never true.

What I really want is a trigger ‘return from away’ rather than ‘me, wife, any, present’, but in triggers/mode ‘return from away’ isn’t an option? I suppose I could make conditions like “NOT IF me home, and wife returns AND NOT IF wife home and I return’ but that seems inelegant?

This is your rule.
Modify it how you'd like to fit your needs
Hope this helps.
I haven't updated the rule the life 360 is included in combined presence, so should be removed from the triggers. The only trigger for me should be combined presence.

Thanks for the response.

You’re using your rule to change the mode from away to home, I already have mode manager doing that. If I’m understanding this correctly, I need to disable the mode manager return from away and use this rule instead? That is to say, if I just used your rule but changed the THEN to ‘run Steve’s stuff’, it still wouldn’t run because mode manager already made your IF false?

I don't use mode manager. I run all of my mode changes in Rule Machine.
If you just want somethign to run based on what that mode change, then set up a rule in rule machine to trigger "steve's stuff' with mode as a condition.

here is a similar rule based on time of day. adding in a condition for mode would restrict that to a certain mode. Is this what you're looking for kind've?

The quirk is that I want to run it based on what the mode changed from (away, in my case), the RM mode triggers all seem to be what the mode changed to (pick from the list)?

Though it does allow mode changed, period... maybe that’s an angle...

Yah that's a tough one. I think you coudl do that with a boolean but I am NOT the one to ask about that. Variables are my weakness. you'd use true and false to represent that. I think that @aaiyar might be able to weigh in on that one. There are others, but I'm drawing a blank on who's good at this.

@zarthan or @marktheknife

1 Like

Is there a way to make the triggers AND instead of OR?

If so,

Virtual steven, Virtual amy any arrives
Mode becomes Day, Evening

Would be what I’m looking for. Or better yet;

Virtual steven, Virtual amy any arrives
Mode becomes NOT Away

YOu wouldn't need that in triggers. The triggers only prompt the rule to evaluate, you could use or/and in your conditional statement

that would work
triggers would be mode becomes changed and presence becomes changed for both.

mode becomes changed
presence becomes changed

Virtual steven, Virtual amy any arrives
Mode becomes NOT Away

but I believe it would trigger on any mode change except away, though after looking at it
do cool stuff

Yeah, but the ‘becomes’ is only available in the triggers, the modes are ‘is’ in the conditions...

I must be making this harder than it is. Haha.

Anyway, thank you for trying. I’ll keep digging.

you're talking trigger events or conditions? Let's make sure that we're on the same page here.

I’m good with either, e.g. as a triggers;

Amy, Steven, any, present
Mode becomes NOT away.

Or as ‘actions’ (with trigger Amy, Steven, any, present);

IF mode becomes NOT away
Run Steve’s stuff

I use a global variable for this with a delay in a couple of rules to tell if the mode changed from away.

Simply if the mode changed and door = 0 I just got home.



Thanks, I haven’t tried global variables, maybe that’s what I need. I’m starting to think using RM In lieu of mode manager to manage the mode change back from away is clean though. That way I could run whatever else I like just before I switch the mode back to whatever it should be if not away...

If I understand correctly the requirements,

Trigger is Amy Stephen -Any Arrive

From there:
(conditional action)

If Amy or Steven Any present
Exit rule

Else if time between sunset and sunrise
And Amy or Steven Arrive
Then on XYZ bulbs
Unlock lock

End If

I’m far from a RM expert, my brain wasn’t exactly built to do these kinds of logic expressions!

However, I think @at9’s suggestion is a good one. Make a rule that sets a GV when mode changes to away. Then create another rule triggered by arrival, with actions that run only if the GV was set to away, and also reset the GV.

I think that’s it! Let me try that, but I think that’s it!

I do exactly what @at9 suggested, except in Node-RED. I save the mode to a variable called "previous_mode", which changes 5 minutes after the mode changes. During the intervening time, which is sufficient for my flows, mode-dependent automations can be modified based on what the previous mode was ....

Edit: and as he suggested, this is easy to replicate in RM with a global variable