Turn off Appliance Module for 30 minutes, then turn back on automatically

I have an appliance module hooked up to the filter pump on my aquarium so that I can shut the pump off for feeding times. I am wanting to have the pump turned back on after 30 minutes. I have forgotten a couple of times to turn it back on and came home to lots of near-death fish. I’ve been trying to reverse engineer a couple of apps, but I have no experience with them to speak of.

Is this at a fixed time each day? What triggers the turn off?

I use a fixed time smartapp to turn on/off the two banks of my aquarium lights.

It is not at the same times. My schedule varies, so it is only when I turn off the module from my phone.

My not-so-pretty approach to this would be to use a motion sensor that will turn off the filter when motion is detected and turn it back on after a set amount of time you specify. You might have to ask one of the coders to alter the “Light Follows Me” smart app to do the reverse, send the Off command when motion is detected and On when motion stops. It’s probably an easy edit.

I would put a box on top of the motion sensor so it doesn’t see any motion :smile:, remove the box and put it back on when you’re going to feed. Now this would not be a good idea if there are kids in the house that might move the box :blush:

I took the power allowance app and reversed the on and off. Let me know if it works.

/**
 *  Power Allowance (reversed)
 *
 *  Author: SmartThings (eddited by baldeagle072)
 */
definition(
    name: "Power Allowance (reversed)",
    namespace: "baldeagle072",
    author: "SmartThings",
    description: "Turn on a switch after a certain amount of time after it has been turned off",
    category: "Green Living",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet@2x.png"
)

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

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

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

	unsubscribe()
	subscribe(theSwitch, "switch.on", switchOnHandler, [filterEvents: false])
}

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

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

Oh cool even better. No need for a motion!

This app does not seems to work.
my application is almost the same, to turn back the aquarium filter after turn off.
i set to 5 min to test it out, but it is not turn back on after 5min.

Hi Folks - I have no coding ability - wondering if anyone can fix the code above to make it work. 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!

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. (A working version of what baldeagle did above.)

/**
 *  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()
}