Help coding a Delay-ON sequence?

(Dale C) #1

Lots of ways to do delay-off but I couldn’t find a smart app to do delay-on. I think my only solution will be to write a smartapp?

I am trying to modify my existing app so that it controls two switches but with an adjustable delay-on timer for the second switch.

It is a thermostat operation and when it gets too hot I am calling for the evap cooler to turn on the fan and turn on the water pump. I want the pump to turn on immediately but the fan I want to delay turning on for 2 minutes to give time for the water pump to soak the pads.

Delay the State of a Switch?
Can I program outlet to turn on and off every four hours?

I’m sure you can use code for this using “run in,” and hopefully others will be able to comment on that.

But it’s also very easy to do this without custom code using a daisy chain.

You have your desired trigger turn on a virtual switch which is set up to turn itself off after X minutes.

Then you have your actual switch set up to turn on when the virtual switch turns off.

( I hate Mondays) #3

You can always use switch.on([delay: 120000]) - this will delay the on() by 2 minutes. Cannot cancel the command though, once requested, it will happen in 2 minutes.

( I hate Mondays) #4

I am not sure, but I think RM can do this (if you have it). Also, CoRE can do this as well, you can have a piston looking for temperature above setpoint, then chain two actions:

Using evap cooloer
    Turn on

Using water pump
    Wait 2 minutes
    Turn on

That should do it…

(Dale C) #5


I got the smartapp tweaked with the delay and got the beta in GitHub.

I did that way and it certainly worked. I hadn’t thought of using a virtual switch as a inverted switch trigger. Thanks! However, I ended up continuing with the smartapp route because it is just awkward to make a simple room temp setpoint settings change. With my two stages of cooling fan speed it just was a little user unfriendly to the family to make a change.