[Solved] Trigger based off of mode change but only when changing from a specific prior mode

How can i trigger rules based off of a mode changing from a specific mode to another mode.

For example:

  1. Current mode is Away
  2. When mode changes from Away to Home do .........
  3. When mode changes from Sleep to Home do NOTHING.

In RM, create a Triggered Rule:

When changing from Away to any other mode (AWAY is TRUE), then the true condition is met. Otherwise, the condition is false (SLEEP to HOME).

This won't work. In order for the trigger to happen, mode has to have changed to one of the triggering modes. At that point, mode is not longer away, so the condition will always be false.

Ahhhh, I see what you mean. The Define rule would have to read Mode WAS Away (which, afaik, doesn't exist yet). Would using NOT in the Define rule properties fix that though?

I think it's going to take two rules. one rule to handle the actions when mode changes to home, with private Boolean restriction enabled. in the actions of the first rule aside from what you want it to do, it needs to set its own private Boolean false. A second rule to set private boolean in the first rule true when mode changes to away.

Hi destructure00,

I'm not sure I understand what I should be doing to accomplish the above, can you please provide more detail.

Rule 1 (trigger):

Rule 2 (trigger):

Thanks @destructure00 that works perfect, setup a boolean on my Arrive Home rule which sets itself to false when I arrive home (mode changes to home).
When i leave home (mode changes to away) it sets the "Arrive home" boolean to true so Arrive Home only triggers when i go from Away->Home, perfect!!!

1 Like

Quick question... If in Rule 1 I have delayed actions, I need to also delay setting the boolean to false to make sure they execute correct?

I can't remember how Boolean affects delayed actions. You'll have to test it, or maybe someone else can comment on it. But you should be able to add a single delay to the rule rather than delaying the action and the Boolean separately.