Interval Timer Quick Fix?


(Sean O'connor) #1

Hi everyone. Long time reader, first time poster - and I think I’m in for a doozy.

The switch on my sump pump gave out this morning leaving it forever in the on position. I felt pretty smart grabbing a smart plug and plugging the pump into it so I could toggle on/off manually. I ordered the new part, but it won’t come until tomorrow.

I’m looking for an easy fix (not using WebCore if possible - I don’t quite have the time to overcome the learning curve there) to set my switch to turn on for 20 seconds every 20 minutes to drain my pit (we live in a wet area and have had snow and rain for a week to boot).

Does anyone have any simple solutions that’ll set me up to at least sleep through the night and wait for the part to arrive?

Thanks!


(Robin) #2

Using native ST features the best you can do is turn it off after 1 minute (using power allowance in smart lighting)… you can’t do 20 seconds.

If that could work for you I can you talk you through the 20 minutes part.

In a nutshell it will involve a simulated switch (or something real like an unused smart outlet) and a bunch more smart lighting rules.


(Robin) #3

Much easier with webCoRE but I know you don’t want to learn webCoRE right now… that said I can build the piston for you to make it easy… you could just import it.


(Sean O'connor) #4

This could work! I tried to figure it out, but didn’t see power allowance settings or know how to create a simulated switch.


(Robin) #5

Simulated device:

Log into the IDE
go to my devices
Click +new device
Name - ‘timer’
Network ID - mash something random on the keyboard
Type - simulated switch
Pick your location
Pick your hub
Click create

Automation:

Will post I a bit…


(Robin) #6

Smart Lighting Rule 1 (turn off pump after 1 minute):

Rule 2 (turn on timer when pump turns off):

Rule 3 (turn off timer after 20 minutes):

Rule 4 (turn on pump when timer turns off):


#7

The following How To in the community – created wiki will walk you through how to create the simulated switch and use power allowance as a timer. So that’s the one you would set to run for one minute

http://thingsthataresmart.wiki/index.php?title=How_to_create_a_virtual_timer_for_a_light

Then you need to create a second one which turns itself off after 20 minutes.

Then daisychain them so when the 20 minute one turns off the one minute one turns on and vice versa.

Now start the 20 minute one manually.

The 20 minute switch will run for 20 minutes, then turn itself off.

When the 20 minute one turns off, that triggers the one minute switch to turn on. It runs for one minute, then turns itself off.

When the one minute switch turns itself off, the 20 minute Switch will then turn on.

What you need for the daisychain

2 switches, each using The power allowance feature, but for different periods of time.

Four smart lighting rules:

Power allowance rule for switch A

Power allowance rule for switch B

Turn switch A on when switch B turns off.

Turn switch B on when switch A turns off

Note that once you start this, the daisychain will run forever, you will have to actually change one of the rules to get it to stop.

Otherwise, I’m sure @RobinWinbourne could design a webcore piston for you that would do all of the above plus provide for some kind of emergency override option. :sunglasses:

While the daisychain method is easier to set up, long-term the webcore merhod is probably easier to maintain because you’ll be able to see all of the logic in one place. But it’s up to you.


(Sean O'connor) #8

This is GREAT! I just set up the rules and am going to test it out. Fingers are crossed.

Thanks for the quick assist. This should help us get through the night so I can fix the real problem. :slight_smile: :slight_smile:


(Robin) #9

We’re on the same page… cross posting again lol


(Robin) #10

Yeah… for something like this you can’t beat a good old fashioned float switch… keep ST well away lol


(Sean O'connor) #11

So true. For what it’s worth, this problem has certainly sparked an interest in ST programming. It’s great to use these tools to my advantage when I can get creative like this - at least buys me enough time to avoid hiring a plumber.

You were both a huge help. I really appreciate it.


(Robin) #12

btw… good point from JD… these 4 automations will run forever unless you delete or change one of the rules (breaking the chain).

Alternatively, click ‘more’ on one of the rules, and set it to only run in a certain mode. That way you can break the chain by changing mode.

If you need to restart the chain, just change mode back and turn one of the two switches on.


(Sean O'connor) #13

I’ll probably remove the chain once I fix the issue - I previously had the switch on a sun up / sundown timer.


(Robin) #14

Figured as much… was really just closing out for the benefit of others who stumble across this in the future, and want something more long term (like watering the plants or something)


(Robin) #15

With webCoRE it would just need this… no simulated switches and one simple piston:


(Johnny Dang) #16

You can use this to turn it off in seconds instead of minutes.

/**

Turn me off quick
Author: seateabee@gmail.com
Heavily based on Power Allowance by SmartThings
Date: 2013-06-28
*/
preferences {
section(“When a switch turns on…”) {
input “theSwitch”, “capability.switch”
}
section(“Turn it off how many SECONDS later?”) {
input “secondsLater”, “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 switchOnHandler(evt) {
log.debug "Switch ${theSwitch} turned: ${evt.value}"
def delay = secondsLater * 1000 /*Because delay is counted in mill-seconds, multiple seconds by 1000 to get the proper delay. */
log.debug "Turning off in ${secondsLater} minutes (${delay}ms)"
theSwitch.off(delay: delay)
}