How to create a virtual timer for a light

The Unofficial SmartThings Blog
Jump to: navigation, search

If you are using a motion sensor to turn on a light, the official smart lighting feature will also give you the option to have the light turn off after a certain number of minutes of inactivity. But how can you get a similar timer effect if you are turning the light on with some other method like someone arriving home or just turning on a switch?

SmartThings offers a "power allowance" feature which lets you set up a device so that it will always turn itself off after a specified number of minutes.

That's very useful, but what about those situations where you want to sometimes put a device on a timer, and other times just control it based on other factors like lux value or geopresence or manually?

There are several different ways to do this. This how to covers a method using one virtual switch and three smart lighting automations.

1. Create a virtual switch to be the timer. [1]

Once you have created the virtual switch, it will show up in any list of your switches, including in Smart Lighting.

(If you have not already installed Smart Lighting, do so now. [2])

2. Create the first smart lighting automation to set the timer. Use the "power allowance" feature in smart lighting to set the virtual timer switch to always turn off after X minutes.

You do this by selecting the virtual switch as the one you want to "control" and then saying that you want to turn it "off" (not on) and then when asked how you want to "trigger" it, scroll all the way to the bottom of the page and there will be an option for "power allowance exceeded." After you select that, you will be given a new page where you can fill in the number of minutes.

3. Create the second smart lighting automation to have the real device "follow"' the virtual switch. That way the real device will turn on whenever the virtual switch turns on, and turn off again whenever the virtual switch turns off.

You do this by selecting the real switch as the switch that you want to "control," choose "turn on" and then when asked how you want to "trigger" it say by switch and then choose the virtual switch from that second list. You will also be given the option to "turn off as well" – – choose that so that the real switch will also turn off when the virtual switch turns off.

4. Create the third smart lighting automation to trigger the virtual switch. Now you just need to set up something to turn the virtual switch on based on the trigger conditions you want, like time of day or someone arriving home or a particular mode. Usually this would be a smart lighting automation, but it could also be a routine or another smart app. Or you can just turn the virtual switch on by voice with Echo or Google home.

There you have it. The trigger condition occurs, the virtual switch turns on, the real device turns on because it is following the virtual switch, the virtual switch turns itself off because of the power allowance, and the real device turns itself off because it is following the virtual device. A virtual timer.

To change the length of time, open the smart lighting automation from step two (The one that uses the power allowance feature) and change the amount of time there.

You can set up different virtual timers for different trigger conditions or different lengths of time. Just remember that once you set a power allowance, that will always apply to that particular device for the conditions specified in that smart lighting automation.

You can also use the same method to set up a countdown timer which delays a switch turning on for X minutes. The only difference is that in step 3 instead of having the physical device come on when the virtual timer comes on, you will have the physical device come on when the virtual timer goes off. You also need to change the default "turn off as well" so that it will not apply.

For questions and discussion see the community forum thread [3]