Automation triggered by Mode being turned off

Hi all, I am trying to set up some automations based in Modes. It's all pretty straightforward when a trigger is a particular Mode -- when the mode turns on do X, Y, Z. However, I am interested in creating some rules based on when a particular mode, namely Away, goes back to whatever other mode (Day, Evening, etc.).

Is there a way to set up a rule (in RM or elsewhere) that uses a trigger when a mode is turned off rather than turned on?

Hmm.. Maybe i'm under complicating this, but wouldn't the trigger just be "mode changes", and in conditions you set "if mode changes to all other mode than Away"..?

1 Like

Unfortunately, this would also trigger moving from, e.g. Day to Evening, which is not what I want...

I believe there is a mode transition or something like that in the simple automation app. You could use that to control a switch or something to then trigger a more complex rule in RM.

1 Like

If I understand correctly, you want to trigger rules when returning from Away Mode.

  1. Go to Settings > Location & Modes > Mode tab (top) > Add mode 'Present' or ’Home'.
  2. Mode Manager > Based on presence > and setup 'Home'.
    Also, optionally: Use time settings when returning from Away.
  3. Create your automations based on Home, which is Not-Away.
1 Like

"when a mode is turned off", in a purely event driven scheme, is actually a description of two events in sequence: first changing mode to Away, then waiting for mode to change to something else.

Just checked and indeed there is. However, it only allows for transitioning between of any two specific modes, e.g. Away -> Day. So for it to cover a case when I could get back home during Day or Evening mode I would need two rules, etc.

However, I thought of another potential workaround. Have 'Away Switch' that is 'on' when mode changes to Away and turns 'off' for any other mode (would just need to add 'off' action to each of my other mode definitions). The only question is -- if a mode changes from e.g. Day to Evening would Hubitat see the Away Switch that was off during Day "switching" to another off during Evening as a trigger event or just ignore it (as I would like Hubitat to do)..?

I think that almost achieves what I am trying to do. If I understand correctly how modes work if I came back home during times that now define my Day mode this would instead move to Home. And the same if I came back during times that are now defined as Evening? So for instance any lighting automations that I have specific to Day vs. Evening would be ignored given it would be all Home mode, I suppose?

I have a similar rule, this is how I solved it. Should work fine for what you described as well. No need to create any extra virtual devices or variables.

This is brilliant! Exactly what I was after. Cheers!

1 Like

Late to this party. I had a similar requirement and reading through tis post I made a slight change to @MrPancake solution by replacing
image

with
image

So it will still work if I create more modes later