Virtual Switches that turn themselves off?

Hello. I am using IFFT to turn a switch that turns my lights on. The phrase I am using is “Good Night” which turns my lights off. When I say that, the switch turns on which is expected behavior. The problem is it remains on until I turn it off. What that means is if my lights are on during the day and I say “Good Night” the lights won’t turn off because the switch is still on from when I said “Good Night” the previous night. Is it possible to automatically have the switch turn off without turning the lights off?

Yes, but you have to use a different type of Switch, a “virtual momentary.” This kind is like a doorbell button, it is off most of the time and just turns on briefly when activated, then turns itself off again.

See the virtual device FAQ for details:

The other alternative is to use the same kind of switch that you are using now, but set up an additional automation with SmartLights feature in the mobile app using the “power allowance” option so that this switch always turns itself off after one minute.

Either way works, so it’s just up to you which you prefer. :sunglasses:


You could also make a simple rule in webCoRE that says:

If switches changes to On
Then with switch
Wait 1 second
Turn Off

I use to do this because Alexa doesn’t recognizes buttons…Or at least she didn’t.

Now I mostly have on/off triggers such as:

If any of these are on
Then using virtual switch turn on

If all of these are off
Then using virtual switch turn off

This keeps the virtual switch in sync…well for the most part.

1 Like

I wrote this “stateless” virtual button for just such cases. I use them for my AC units so I can turn them on with the switch, off with the remote and the virtual switch on will still work the next time I use it. It does display it’s current “or last” setting. But it has both an ON and an OFF tile so you can issue either command.

It’s simple enough. It just doesn’t care that it was previously on when you request it to turn on it still sends the on command.

Here is the code for my "stateless virtual switch"


How do you remove a SmartLights routine once you’ve created it? I made one for a porchlight to turn off after 5 minutes of being on but when I go back into Lights and Switches, Smart Lights, it’s not listed.

Technically smart lights rules are not “routines,” they are “automations”.

I can’t give you a screenshot because I can’t use the mobile app right now (they broke VoiceOver navigation a few months ago and it’s not fixed yet).

But here are the steps The last time I used it.

One) Open the mobile app

Two) choose routines and automations in the bottom Nav bar. This will take you to that section of the app.

Three) now it will open to either “routine” or “smartapps”. There will be two tabs at the top of the screen with these labels. Choose the one that says “smartapps”

  1. now you will see the list of smart apps that you have installed, including the official smart lighting feature.

  2. choose “smart lighting”. This will take you to a page that lists all the rules you have created so far, and also has an option to create a new rule.

  3. select the rule you want to delete. This will open its set up wizard. Scroll all the way to the bottom of the page and you should see a “remove” tab. Click on that and you will be given the option to delete the rule.

Thanks for the fast reply. For some reason I couldn’t see it there but I could from the IDE so I deleted it there. Funny thing is I recreated it just to change the time and now I can see the yellow Smart Lighting Icon and can open and edit there. I think my phone is haunted.