SmartThings Community

Recycle timer / repeat on off command / cycle timer?

(Mistman ) #1

So i am in need of a way to turn a device on for xx seconds then off for xx seconds and repeat this over and over again till you tell it to stop. typically the minimum run and off time would be 30/30 also need to make it pretty for my users to change. I’m happy to pay someone to develop this. Also is it possible for this command to run local on gen 2 smart things so that if the internet goes down it will still function?

Timer app?

This is quite easy to do but you cannot make it run local currently because of restrictions in SmartThings. Only certain devices are eligible to run locally and only the official smart lighting automations. There are two different ways to do your timer, but one requires virtual devices ( which are not eligible to run locally) and the other requires custom code, and at the present time no custom code is allowed to run virtually. With that out-of-the-way, there are two options, other then writing a unique smart app, which you really don’t need and still won’t run locally.

  1. you can do this by daisy-chaining virtual switches so that when switch turns on when another turns off and some of them turn themselves on for a specific period of time and then turn themselves off again. With those two concepts you can set up a daisy chain of switches that will give you exactly what you want.

And another example

I suppose for this when you could pretty it up with a nicer input screen to collect the variables for any specific run. And you could pay someone to do that. If you want to go that direction, post in the developers section of the forum:

  1. The second way, which honestly is probably simpler although it’s going to look more complicated to begin with, is to use a community created rules engine called core. Very powerful, very sophisticated, can handle delays and iterations.

If you haven’t use custom code before first read the FAQ. But it’s pretty straightforward, you’re essentially just copying somebody else’s code and pasting it into your own account.

If after reading the FAQ that sounds like something you’d be comfortable with, you’ll find all the information you need about core in the following thread and people there will be happy to help you. :sunglasses:

For your particular situation I’d recommend using core. It’s going to seem a little more complicated conceptually to begin with, but you’ll have a lot more options.

Reliability requirements

Oh, and all of that said, assuming this is for a Z wave or zigbee device, it may not be possible to guarantee that it will run 30 seconds each time. Some people have been successful with those kinds of cycles, but usually one minute is considered the minimum reliable period. So it depends in part on what kind of device this is.

Smartthings itself, and zwave in general, should never be used for anything which could impact health or safety. In fact there’s usually a black box warning on the user guide for a zwave device. Smartthings isn’t reliable enough and Zwave does not guarantee sequential operation. So for a pool filter pump, OK. For life-support machinery, absolutely not. In between, you have to make a judgment call, but I mention that because when you’re talking about A 30/30 second schedule, you’re often talking about something which requires more reliability and precision than SmartThings can offer.

1 Like
(Mistman ) #3

thank you so much! so i could probably skate by for my house but there are going to be hundreds of people eventually needing the same thing so neither of these will be pretty or seamless for the user right? the only way to do that is to create and “publish” a smart app right? everything i do needs to be easy and intuitive for the others and i’ve got a couple of things needing to be created. are you for hire and what’s just a simple one like this run?

(Mistman ) #4

also reliability isn’t crucial at all but if smart things is going down a lot if there was a widget that could be added for say under 50$ that stores the code locally that’s probably feasible didn’t i read about something that acts like that and stores functions locally? If not is there any plans for that? seems that it makes more sense for smart things to store these functions locally, and call out periodically to the web servers with a copy command or probably even easier the reverse, if you’ve made any changes a simple save button in the cloud, could then push it locally so not even a need to call out constantly. Heck if your on the lan it would just grab a command from local, if your not then it would route through their servers. but man that would dramatically reduce their bandwidth on those poor servers as more and more users as added. anyone know if there are plans for that for the future?


SmartThings is a cloudbased system. You can’t store the code locally. Your account library is in the clouds. There are a few things that can run locally with the V2 version of the hub, basically the official “smart lighting” feature and a little bit of SHM.

What’s the specific use case being solved here?


Also, I myself can’t do any coding these days as I am quadriparetic and rely on text to speech (and trust me, you don’t want to work with groovy in a voice recognition system).

But you can find developers for hire by putting a post in the developer section of the forums.

@tgauchat might know of someone.