Mode change back to whatever mode manager would do? (Take II)

There is an old thread, which was supposed to be the same exact question.
It was derailed from the start to discuss a particular problem the topic-starter had, but the original question is valid (and unanswered).

How do I tell RM to switch the mode to whatever it should have been based on the MM logic, without recreating the logic in the rule?

The only idea I have is to create a virtual presence device and trigger it to be "back from away", but it's kinda meh.

Honestly, I'm not sure it is possible. How do you have Mode Manager configured? Are you using time, presence, buttons, or switches to change mode?

A mix of all of them. What I wanna sometimes do is emulate "someone is back" in the rules for whatever purpose (e.g., a cat sitter came to visit the cats).

I guess it's either a virtual presence or a virtual switch.

The best I can come up (and it's not great) is to write your current modes to a hub variable. This way Mode Manager can continue to manage the modes, but you can track them in a way that only requires writing a rule without recreating the logic. If it was "day" mode when you left and the house transitioned to "day away", the logic could keep the hub variable as "day" since the rule to write the variable would only track "home" modes.

From there, it is just writing other rules based on the "someone is back" logic that you need. Cat sitter types their key code (or however you define their presence) and this triggers a rule to look at the variable and set the current house mode as appropriate.

3 Likes

This approach works well. Before Hub Variables, we had Global Variables. And I would track mode in a Global Variable.

1 Like

This is neat! What about changes over time (in our example, let's say it's time to switch to Evening mode)? The mode manager won't do it since it's in Away, but I'd like to switch the mode to Evening when the cat-sitter comes.

Stupid Ultraloq doesn't share or get codes to/from Hubitat (at least not for me).

Changes over time is where this breaks down since you would need to recreate some of the logic in rule machine to keep the Hub variable accurate. The good news is that you would only need one additional rule to do it.

Required Expression:
Mode is Away

Actions:
7am
5pm
10pm

Triggers:
If 7am, set hub variable to Day
else-if 5pm, set hub variable to Evening
else-if 10pm, set hub variable to Overnight

You have to recreate your changes over time, but it would only run if the house was set to away mode. It's not needed if you are home, since the variable would update automatically based on your other rule.

Now, I freely admit, that you could just collapse everything into one rule that writes the hub variable based on time and not worry about presence.

Yeah, it looks more and more like recreating the MM logic in RL - something I wanted to avoid :slight_smile:

Seriously, I think just having the option of "change the mode back to whatever MM would do" as a RM action option is much clearer way to go. I wonder what @bravenel thinks about it...

I think this becomes incredibly complex very quickly, given that Mode Manager itself has a lot going on (times, presence sensors, buttons, switches). How many modes are even a possibility for when the cat sitter comes? What event marks that happening? How is this anything more than a conditional action about when the cat sitter arrives?

There are some ways to solve my particular problem (e.g., when the lock code is used, turn on a virtual switch, and use "back for away by switch" in the MM), but I don't want this topic to go the route the previous one went (i.e., solving a particular use case).

My question was more general ā€“ can we have a "return from away in MM" command in RL. I guess your answer is "probably not", and it's fine, thanks for the input!

Mode Manager doesn't expose any of its internals for Rule Machine to set or act on (most apps don't, with HSM being the notable exception). Plus, it offers choices for how this can be done in the ways you mentioned. So, yeah, 'definitely not' is the answer for Rule Machine adding this function.

2 Likes

Fair enough, thanks, Bruce!

Actually, you've got me thinking about it. Might be doable.... (groan)

3 Likes

Those pesky users and their nuts ideas!

(I hear you so much! :hugs:)

OK, so just to be clear, you want to be able to set the mode according to the time table, right? Doing this from a rule would not take into account any setting in Mode Manager other than the Set Mode at Times table setting for the current day and time.

Exactly. I don't want to duplicate the logic of when morning becomes day on Saturday.

Like this:

BOOM! That's precisely it.

Once "Cleaning" is done, you want the mode to return to what is supposed to be at this time of day.

Woot-woot!

Never mind, hub reset itself to GMT after last update or reboot with log clearing.