Only Run Routine Once Then Reset?

Hello everyone!

As I am working my way through the transition from WebCoRE to the built in Rule Engine, I am realizing that the new Rule Engine is quite capable of accomplishing most of the automations that I had on WebCoRE. That’s a great thing and thanks to ST for all of the hard work that they have put into this.

I was super surprised as to how fast motion events are triggered! It’s almost instant.

Saying that, I know I saw somewhere that you can set a rule to only run once a day but…what about once until conditions change?

For instance, I have set a group of rules to control a bathroom toilet fan. If the door stay closed for 10 minutes and motion is detected then turn on fan. This works just fine but…Once I turn off the fan manually, the fan kicks back on as soon as motion is detected again.

What I would prefer, without having to add a VS, is once the fan is turned off manually, it doesn’t turn back on. This can be reset once the door opens.

For now, I just added another condition that says, if fan stays off for 10 minutes then turn it back on once motion is detected again. This works fine as well.

Any clues?

Thanks!

In standard routines, there is no way to track the state of actions or elapsed time etc. The condition of “was the fan turned off manually” is what you need to evaluate as a precondition for turning the fan back on when the door is closed for 10 mins and there is motion.

Many folks are using virtual switches and other devices to track state. For example, is it between 10 pm and Sunset (e.g. Nighttime) which can’t be done with standard routine logic because of the mix of specific and relative times.

So, I would create a virtual switch to represent the state of manually turning off the fan and have a routine to turn the virtual switch on when the fan is turned off (Yes, it was manually turned off) from its switch button and turn it off when you open the door (it was turned off programmatically). Then add a precondition to your existing routine that checks whether the virtual switch is off.

1 Like

Yep, I first started off with a VS that represented “Occupied” of the toilet room (water room). Then as I got into it, I thought, hmmm, I wonder if I even needed that. Almost sounds like yep, you need it. I have went from over 300 devices to now having about 250. Didn’t want the limitations to catch up with me so I was trying to avoid having VS that would eat up my rule limitations.

Saying that, I’m still surprised as to how fast things are running locally. The amount of rules needed in order to replace some of my WebCoRE Pistons is kinda ridiculous but ayyee, it’s working…

I tried Hubitat and for some reason, my experience has been shaky, like really, really shaky.

I already have VS for most of my rooms as sorta “Master Switches” for those room. For example, “Alexa, turn off Living Room.” In this example, all connected devices turn off. Awesome! I also have VS for most of those room to pause any automations. For example, “Alexa, turn off living room automation.” Works like a charm. To follow that up, I had another Piston to automatically turn that particular automation back on after a specified amount of time.

Hopefully they will add just a few more conditions (variables) to really make the build in rule engine as powerful enough to tackle most task…

Attached are a few more examples.

Thanks!



Thinking about it a little more, you might be able to get away with a simpler precondition like “If the fan is off” depending on where your motion sensor is in relation to your fan switch. If you can turn the fan off and leave the room without tripping the motion sensor then that would work. I suspect you’ll need to play around a bit to decide the best option.

If you’re willing to use cloud based rules, Sharptools gives you more flexibility since they support variables and complex flow conditions but you have to purchase their premium service to get access to variables.

1 Like

The room where the toilet is located has 4 walls, a door and…a toilet (window too but that’s irrelevant). I have a contact sensor on the door, a motion sensor behind the toilet (trial and error for best location) and, two smart switches, one for the light and one for the fan. Most of the house is set up this way.

I’m thinking that the VS approach is the best solution but was hoping to avoid the extra device and extra rules associated with turning that VS on and off.

I’ll play around with it a little more but seems to be, at this point, a limitation of the rule engine in its current state.

Thanks so much for your speedy response. Im actually excited about redoing everything because this time, I can eliminate some of the unnecessary rules I had in webCoRE and really focus on what really matters.

Another thought…Is there an evaluation in the current rule engine that can determine if it was manually or programmatically? This was iffy even in WebCoRE.

Thanks again!

Some drivers can recognize a button push that turns off/on a device and that can be used as a trigger condition. I use that in some routines that control button vs motion behavior at night for my motion dimmers. However, as I mentioned, there is no way to store that as state and use it as a precondition with some other trigger events.