Delay the State of a Switch?

For some reason, this question has come up six times in the last three weeks. That is how do you set something up to have a delayed on. Each time the use cases have been just enough different that I’ve ended up writing a different post as an answer instead of just writing an FAQ, but the main concept is the same every time.

I should also add, as i have in each previous post, that I’m sure there are much more elegant ways to do this with code, or possibly just with core (the new rules engine smart app that’s being developed, but it’s still in beta), so I’m not saying that this is the best way to do it.

This is just a really easy way to do it without needing any other custom code except for a virtual switch or two. :sunglasses:

The Daisy Chain approach: one switch comes on when another goes off

The idea is to build a daisy chain. You have a virtual switch which comes on with whatever your initial trigger was. In your case it might just be the guest mode turned it on.

You use the power allowance smart app in the marketplace to have that virtual switch turn itself off after X minutes.

Then you have smart light turn another virtual switch on when the first switch turns off.

And finally, you use the smart app in the marketplace that ties a switch to a routine to have a routine start when that second virtual switch comes on. “Hello home phrase” is the original term for “routine” but they mean the same thing.

( oh, we should also note that at some point you have to have the second switch turned off so it will be ready to turn on again the next time. you can have that routine turn the second virtual switch off again, or you can use power management with it, or whatever you want to do to get it ready for the next time. )

So that’s really all there is to it. The point is that you have one switch that operates as a timer and that switch turning off is what turns your delayed switch on.

( or in some cases you might just need power allowance, or just need one virtual switch – – it just depends on the specifics of what you trying to do. )

Again, this isn’t the most elegant approach, but it’s easy to set up. :sunglasses:

Here’s one discussion:

And for anyone who needs it, the FAQ on creating a virtual switch:

2 Likes