Turn the switch back ON after x minutes OFF

“CORE” in this context is a community-developed smartapp. All software, not hardware. :wink:

Thanks JDRoberts … I think this will work, let me try out later and post the results.

I thought the Core mentioned is the Spark Core which require some hardware knowledge.

1 Like

Thanks bobbles … will see if the virtual switch approach from JDRoberts is stable enough for doing this.

Spark Core is third-party cloud with a hardware piece. So is particle.Io

But the “CoRE” that people will recommend on this forum for rules management is a smartapp (software only) written for the SmartThings platform by community members here. CoRE = Community’s own Rules Engine.

Thanks JDRoberts … the Virtual Switch Approach work out perfectly. it took 3 smartapps to do this.
Let’s see how well this work out and closely monitor the switch state for sometime.

1 Like

Glad to hear it! Core is definitely a much more elegant approach, and you may want to switch over to it once it’s in full release. :sunglasses:

I have a minimote that I use to control my fishtank filter (2) and lights (2). I have button 1 programmed to turn off filter for X minutes then turn it back on. I used Rule Machine for that but it’s probably time to migrate to CoRE.

The other buttons I have programmed to turn OFF/ON the filters on button hold.

I would create a simulated (virtual) switch in the IDE, then create an IFTTT recipe that then flips that switch based of whatever trigger you wanted (an email received, facebook post, alexa phrase, whatever…)

Then use Smart lighting to turn off (or on) when your simulated switch is toggled for a time.

Hi Folks - I have no coding ability - wondering if anyone can fix the code here (Turn off Appliance Module for 30 minutes, then turn back on automatically) to make this request work. That smartapp won’t turn on the device after X minutes off. Looked everywhere and can find a tonne of off smartapps that do similar for things to go to the off state- just no back ON apps? There are a few folks like me been looking for such an app. Any help would be greatly appreciated

Thanks
BBucKK

PS - Happy New Year!

Use Smart Lighting.
Here is a screenshot of what you need. I think.
Just alter times accordingly.

Thanks bobbles - I did look at Smart Lighting but it would require the unit to be turned off and then back on at a specific time. What I am seeking is if the switch somehow gets turned off at any time, after X minutes it will get turned back on. It is a failsafe for folks like me using Smartthings for aquarium functions (yes I know it is always risky to use Smartthings for critical functions) - that is way folks like me looking for a bit of protection in the form of this failsafe.

Thanks
BBucKK

No problem.
In that case I suggest you use CoRE.
You can set up a piston something like this.

IF
SWITCH changes to OFF

THEN
Using SWITCH.
Wait 30 minutes.
Turn On.

This way every time the switch is turned off, a timer starts and when it matures it will turn the switch back on.

Thanks - using Core and works like a charm!

@geesantoso,

I’ll have to look some more into the virtual switch but I wonder if a physical switch would be helpful (placed close to the aquarium)? Seems like you could press the button to turn off the filter for 15 minutes and then turn power back on.

https://www.lowes.com/pd/Iris-Next-Gen-White-Wireless-Home-Automation-Button/999925306

Good luck!!

-Patrick

@JDRoberts answer is great and accomplishes the original task very well. However, if you are using something like the Amazon Alexa, this setup leads to an awkward trigger syntax. i.e. when I want to turn the fish take filter off for 15 minutes, I have to tell Alexa to “turn on Feed the Fish” (my virtual switch name). This might work for some situations, but others work better with a “turn off X” command.

Luckily, JDRoberts’ instructions only need a small addition to make this work.

  1. Use Smart Lights to turn ON your virtual switch when the real switch turns OFF
  2. Use Power Allowance to turn the virtual switch OFF after X minutes
  3. Use Smart Lights again to turn ON the real switch when the virtual switch turns OFF
  4. Trigger the sequence by saying “Alexa, turn off the lights” (or whatever the real switch is called) and it will turn back on automatically.

Note: the difference between these two answers is that JDRoberts uses a trigger to directly affect the virtual switch, which requires an ON command. This method links the ON --> OFF transition to the virtual switch so the trigger becomes an OFF command, which seems more natural to me.

1 Like

I know this is an old thread, but I came across the need to resolve a similar situation. For those that might be still looking for a solution to this that doesn’t require virtual switches or WebCore, here’s a quick flip of the Power Allowance app that, instead of waiting X minutes to turn a device Off, waits X minutes to turn it back on.

/**
 *  Turn Back On
 *
 *  Turn a switch back on after some time.
 */
 
definition(
    name: "Turn Back On",
	namespace: "smartthings",
	author: "SmartThings",
    description: "Turn a switch back on after some time",
    category: "My Apps",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
    iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
) 

preferences {
	section("When a switch turns off...") {
		input "theSwitch", "capability.switch"
	}
	section("Turn it back on how many minutes later?") {
		input "minutesLater", "number", title: "When?"
	}
}

def installed() {
	log.debug "Installed with settings: ${settings}"
	subscribe(theSwitch, "switch.off", switchOffHandler, [filterEvents: false])
}

def updated() {
	log.debug "Updated with settings: ${settings}"

	unsubscribe()
	subscribe(theSwitch, "switch.off", switchOffHandler, [filterEvents: false])
}

def switchOffHandler(evt) {
	log.debug "Switch ${theSwitch} turned: ${evt.value}"
	def delay = minutesLater * 60
	log.debug "Turning on in ${minutesLater} minutes (${delay} seconds)"
	runIn(delay, turnOnSwitch)
}

def turnOnSwitch() {
	theSwitch.on()
}
1 Like

I’ve also done this with Alexa… since I like using the voice control in my system more than the automations… I built into EchoSistant that you can say this…

Alexa, turn on the fan for xx minutes in the bedroom. (xx minutes = any number of minutes you choose, you can also say xx hours and xx minutes)
or…
Alexa, turn off the fan for xx minutes in the bedroom.

Either way it performs the command and after the desired time it will reset the switch.

You can also say, Alexa, turn on/off the switch in xx minutes… it will delay for the desired time and then perform the commanded actions.

1 Like

Very nice! Mine was for a specific device that I always wanted off for 30 minutes, so I didn’t want to have to have add any extra “for xx hours”. This has the added advantage that it works with physical switches (you can turn a switch off and it will turn itself back on).

Yes, that’s what I love about SmartThings. Our ability to tailor our homes to be exactly what we want. Mine works with any kind of switch that Alexa can detect in SmartThings, virtual or real.

I sleep with fans on in the bedroom, so I’ll go to take a nap, which never at the same time or for the same amount of time. If I want to get up at a specific time, I can tell Alexa to turn off the fans at xx time. Or if I want to sleep for 45 minutes, I’ll tell her to set an alarm for 45 minutes and to turn off the fans in 43 minutes…

So many options… choice is fantastic, especially when each family member uses it in different ways.

2 Likes

100% agree! EchoSistant looks awesome. I’ll have to play around with it when I have some free time.

2 Likes