Whats the best practice for a Timer these days?

Can sharptools itself manage a timer (i guess stopwatch since if its counting up?) feature? Or should i run that through webcore?

We have a fountain pump for our patio fountain and when we run it i want it to run no more than 4 hours. otherwise in summer the water can run dry and burn out the motor.

What id like it for a timer tile so i can see how long its already been running. I can easily program a shutoff after 4 hours from start, but id like to just have a tile that also shows me a running timer (i guess stopwatch?) of the current runtime. Is that trying to do too much ?


One approach for a ‘timer’ is to use a dynamic ‘Delay’ action with an expression along with the various date features to determine how long to wait.

The concept is discussed a bit in this announcement post from when Dynamic Delays were released:

:clock2: Dynamic Delay - Rule Engine

It’s a bit of an anti-pattern to frequently update a variable periodically with a accumulating duration. Instead, a better approach would be to snapshot either your start time or target end time in a variable and then use the related date expression features noted above.

For the display side of things, an ideal solution would probably be to use the new Custom Tiles: Access to Things and Variables feature that is in beta, but you would need some basic HTML + JavaScript knowledge for that approach.

Since you’re on SmartThings, there’s also a number of community developed drivers targeting this space. I don’t personally use them, but I’ve seen them mentioned in the SmartThings community a few times.

One method that’s consistently worked for me is this:

Create a variable called $FrontDoorTimer. Its default state is stop.

Create a rule that changes $FrontDoorTimer to tick when the door opens and changes to stop when the door closes.

A second rule has a trigger based on $FrontDoorTimer staying tick or tock for 30 seconds, then swap the value of the variable (that is, tick becomes tock and vice versa). In my use case, an audible message plays throughout the house letting me know “the front door is open” every 30 seconds until someone closes it.

I do this for my weather station updates too (minus the audible notifications).