Timer app?

Im looking to have a switch come on for “x” number of minutes then off for “x” number of minutes continuously throughout the day(no triggers). Ex. 30 min on, then 2 off, then 30 on again, then 2 off again and repeat until the app is turned off. Appreciate any pointers!

1 Like

See the following thread. Several different methods discussed there. :sunglasses:

There really should be a simple SmartApp for this simple use case. Surprised there isn’t one already. If you can wait a few days, I’ll whip one up (travelling right now). Maybe someone will beat me to it. You shouldn’t have to use virtual devices or a Rule Engine for this common request.

2 Likes

This can be done in CoRE. Although the SmartThings platform is having increased difficulty executing timed events.

But CoRE is beyond the novitiate IMO.

I do believe anyone can do it, but some people don’t have the time or patience.

1 Like

I can agree with that. CoRE has a pretty high learning curve.

1 Like

Keep in mind that if your internet goes down, and the switch is off, it won’t turn back on until your internet comes back up.

I do something similar for my sump pump to reduce the frequency that it runs. It would have to be off for more than 6 hours to flood my basement so I use SmartLighting to turn it on every 6 hours just in case.

I would post my code, but I wrote it back when ST scheduler was so unreliable it was useless so this SmartApp relies on a momentary switch that gets pushed every minute. I use the Arduino Uno and the ST Thingshield to trigger the momentary switch.

1 Like

Just thinking aloud but I’m sure it would work.
Using CoRE.
Set up a basic piston.
Using a virtual Switch.
If virtual Switch is on.
Then turn on lights
Wait 30 seconds.
Turn off light.
Wait 30 seconds.
Repeat piston.

This way it way it will only run while virtual Switch is on and this can also be automated using Smart Lighting.

This works.
Using Basic piston.
If
Virtual switch is on.
Then
Using xxxxx light.
Turn on
Wait 30 seconds.
Turn off.
Follow up with piston #this piston name# after 30 seconds.
Else.
Turn off.

3 Likes

100% agree that core can do this.

That said I wrote a program to do this last week, but it is a little easier to use. It sounds like in your case you want to just control some kind of switch.

This program allows you to specify a switch, dimmer, color temperature lights, (color lights coming soon) and set the associated parameters (dim level, color, color temperature). You then can set the lights to stay on for x seconds and off for y seconds. So in your case x = 1800 and y = 120. You can also set it to only function during a time period (including between sunset and sunrise).

Example Scenarios…

1 - Turn a light on for 5 minutes, off for 2 minutes.
2 - Turn on a Wemo (or similar zwave / zigbee device) for 86370 seconds [23 hours, 59 minutes, 30 seconds] and off for 30 seconds to reboot a device like a roku.

I plan on adding the feature to only run during a mode so you can have lights flash based on a mode.

I haven’t actually had a chance to use this extensively.

3 Likes

BTW, had a chance to test this out. It works great.

1 Like

Eric - looks exactly like what Im after, except with a repeat function, so the switch can operate multiple (infinite) times.

I will run continuously if you leave the “Follow sunset / sunrise?” and “Use Custom Time Range?” off. Just sent “Turn on for N seconds?” to 1800 and “Turn off for N seconds?” to 120. Make sure the “Active” setting is ON.

1 Like

Eric - has been working great. Just need to further test my “on” and “off” times for my application - thanks!!!

1 Like

I’m glad it is working. It is just a variant of my Trigger My Lights app. I use the Trigger My Lights app throughout my house for several use cases so it gets a lot of testing. This one doesn’t.

1 Like

Hi Eric, would it be possible to use your Trigger My Lights app to set a timer for a switch to turn off after X minutes whenever it is turned on? I am trying just setting a value in Schedule/Minutes but I didn’t succeed yet.

Thanks in advance

It doesn’t work that way today but I can make it happen. Let me take a look.

CoRE can do that, though it may seem a bit of an overkill:

IF
   Light switch changes to on
THEN
   Using light...
      Wait X minutes
      Turn off

@sulisenator - Give this a try. Toggle Me is probably not the best solution. I have another app called Trigger My Lights. I just added a few lines of code to allow you to use a switch as a trigger. This is in a development branch of the repository, so only the code in this link will have the functionality you want. Important to note that there are two places you can select switches. The first switch selection is a switch you want to turn on (trigger, get it?). The second a little bit down the setting past the dimmers and other lights, contact sensors, motion sensors, … is a second switch selection. This is used as the trigger. So for example, you can have an on event of one switch turn another switch on and then turn it off after X minutes. I’ve also added a setting called “Unschedule for Opposite Trigger?” which in theory will allow you to select “Switch 1” as the (or one of the) switch(s) to turn on and it can also be set as a trigger. The reason for this setting is that if you turn off the trigger, I want to cancel the scheduled call to turn the lights off as it could conflict with a future “On” event. This new feature is untested.

1 Like

That makes absoluutely sense, thanks a lot!

I will test it asap. Do I need to set also the field “Switch Trigger” or just the “Switch” and “Switches” fields?

I could also use directly this, instead of the routine, to switch it on when a routine runs (e.g. “Good Morning!” ) and then off after x min, is that correct?