Execute Rule B, only if Rule A has run in X history

Hoping to get a bit of direction.. I am admittedly not great at Rule Machine. I tried searching but my terms were too generic I think, and couldn't find anything similar to my scenario.

I have 2 welcome home rules for my kids coming home from school. I don't have presence sensors for them, yet. so I am using their arrival time (window) for each and the front door sensor as the trigger.

But because there is some over lap in their time conditions for their arrival, I would like rule B to only run after Rule A has run... so that Rule A runs on the first door opening, and Rule B on the second - is there a way to sequence them this way?

Thanks,
MK

Ps. Taking suggestions for a Presence sensor suitable for kids that could go in a backpack or jacket. (they don't have cell phones and won't anytime soon)

One way could be having a Boolean Variable for each child.
Have then both True initially.
Rule A has to have the BV-A set to True for the rule to run.
In the rule set BV-A to false.
Wait 1 hr.
Set BV-A to true.

Do the same for child B.
This way the rule can only run in your time window and the BV is true.
Or something on those lines anyway.

1 Like

I'm currently using smartthings arrival sensors and iris key fobs for the presence for kids that don't have mobile devices.

1 Like

Each rule has a "private boolean" variable built in for free, so I was also going to suggest something like the above as well (you shouldn't need to actually create a local variable, though you could use one or a global variable if it's easier for some reason). There are rule actions you can use to set these variables for any rule, so you could have rule A set the private boolean on rule B, then only have the actions on rule B run when the private boolean is True (and those actions would probably need to include setting it back to false).

It's hard to give specific recommendations without seeing the rules, but I'm guessing you've got the other complications figured out (e.g., if both just trigger on door opening with no conditionals, your A and B actions might run every time after the first time unless you have some other method to restrict the running of A actions, etc.--maybe you're using time for this or something).

I'm curious what ideas others will find for presence sensors. The ST fobs seem like a neat idea, but I know some people have battery problems with similar devices (not sure about these or which generation). I'm guessing they're too young to use/remember a code on a smart lock that you also might not have, but that could be another option. :slight_smile: (You could trigger something based on a specific user code, which I guess you could also do with an indoor keypad or dashboard/tablet or even just a button, but I wouldn't count on someone remembering to do any of that after they're already in.)

1 Like