Are there any working Virtual Buttons?!

My old system relies on Virtual Buttons for several automations. I need to be able to trigger these in the app, as well as from automations and WebCore.

Apparently this doesn’t work anymore. I have tried searching several threads and I can’t even find definitive answers. Much of the old documentation hasn’t even been edited to say “Hey, this is wrong, sorry we don’t have an update for it yet”.

Yes, there are some, but you would need to be specific about what you need them to do.

@orangebucket has done considerable research into this topic.

Last time I checked the stock Momentary Button Tile was still playing up in the mobile app, though I’m not entirely sure why.

I have my own Virtual Button for a basic Button capability that can be ‘pushed’ by the Momentary.

I also have another handler I call Virtual Momentary which extends the basic button with the Switch capability, and optionally Contact Sensor and Motion Sensor, with an optional delay between the active and inactive actions just to slow things down a bit. That is handy with Alexa routines.

1 Like

There is also the old but still woorking [dfloyd : Momentary Button Tile Normally On]

1 Like

I tried both; neither are working for me.

Wait, sorry. Evidently I was using a different version of “Momentary Button Tile”. I can’t find dfloyd in github. Can you point me to this code?

Well, according to this thread, it’s extremely limited and will not work other than being triggered from Smart Lighting.

If it will work triggered from smartlighting it will probably also work triggered from webcore. The custom Automations in the official rules creator in the new app handle buttons differently.

Ultimately, I need virtual Buttons to trigger events inside ST that are not supported by their limited API.

For example, I have a keypad that I use to change the Home Monitor state; I originally controlled this from WebCore. But now that is no longer working.

The advice I received was to create a virtual device; use Webcore to update the virtual device, and have the Home Monitor update as a result of those actions using Automations.

However, The “Real Momentary Button” I was using is no longer working, and the “Momentary Button Tile” doesn’t seem to be supported either ) at least, at this point I cannot seem to get Webcore to press the virtual button. (There are no events generated when I trigger a push or set it ON in a piston)

That’s correct, that’s why people in this thread have been giving you links to other code that should work.

Yet another option is to create a “virtual switch“ and then use the power allowance feature of smartlighting to have it always turn itself off after one minute. That’s similar to a momentary button as long as you don’t intend to use it twice in less than one minute.

They are not working. I have tried the code in the link above, and it does not trigger from a piston.

I appreciate the suggestion to use the smart lighting power save feature. However, that is a hack that I can see causing problems (specifically, if something in the chain breaks down and the end result does not occur, I will be essentially locked out of control for 60 seconds. I consider ST to be reliable enough to use, but I don’t consider it reliable enough to not have to deal with that- and considering that there are half a dozen other people who use this system who are not technical, I don’t want to have to deal with that kind of issue.

1 Like

I just changed it to an old school virtual switch. I pressed it several times both from the app and from a piston, and I got one press to come through.

Do I need to update the virtual buttons too?

Hey! Thank you all for your help! After 6 years, and 125 devices, I think it’s time for me to move on to another platform. At the very least, I would be able to upgrade on my own schedule.

Take care!

1 Like

Sorry to see you go!

For what its worth… After the migration I changed all my virtual buttons to “Virtual Switch” devices. and created webcore pistons to turn them back off once they are turned on. It’s a bit of a pain but if you keep them all in the same piston it’s manageable if you ever need to make an update. It’s been working fine so far. (works for Homebridge, too!)

1 Like

I just tried exactly that, and I can’t get them to switch- not from Webcore or from a button on the app. It might fix itself in a few minutes, but for now I’m dead in the water.


  • Copyright 2015 SmartThings

  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except

  • in compliance with the License. You may obtain a copy of the License at:

  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed

  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License

  • for the specific language governing permissions and limitations under the License.

  • Momentary Button Tile - Normally on

  • Author: Damon Floyd

  • Date: 2015-09-08
    metadata {
    definition (name: “Momentary Button Tile Normally On”, namespace: “dfloyd”, author: “Damon Floyd”) {
    capability “Actuator”
    capability “Switch”
    capability “Momentary”
    capability “Sensor”

    // simulator metadata
    simulator {

    // UI tile definitions
    tiles {
    standardTile(“switch”, “device.switch”, width: 2, height: 2, canChangeIcon: true) {
    state “on”, label: ‘Push’, action: “momentary.push”, backgroundColor: “#53a7c0”, nextState: “off”
    state “off”, label: ‘Push’, action: “momentary.push”, backgroundColor: “#ffffff
    main “switch”
    details “switch”

def parse(String description) {

def push() {
sendEvent(name: “switch”, value: “off”, isStateChange: true, display: false)
sendEvent(name: “switch”, value: “on”, isStateChange: true, display: false)
sendEvent(name: “momentary”, value: “pushed”, isStateChange: true)

def on() {

def off() {

I appreciate this. At a glance, it looks very similar to what I have on there now. I will give it a shot and let you know.

1 Like

I just spent hours googling for momentary buttons and came up with nothing but gobbledygook. It seems everyone is solving this same problem in a different way. We shouldn’t need a custom DTH to toast a bagel.

I tried a few things but they all made me grumpy so I gave up and created an automation that has every single one of my virtual switches turning ON as a condition and used the “Any condition” (aka “OR”) and added all of the same virtual switches to the THEN section to turn OFF after a 1 second delay. Basically, any time ANY virtual switch is turned ON, it turns them ALL OFF one second later.

This seems to work and there’s no custom code involved. If I ever need to add a new momentary virtual switch, I just have to add it to this automation in the app UI vs remembering how someone’s custom DTH code works 6 months after I’ve completely forgotten how it went together.

Super dumb that there’s no easy, native, momentary button that works with the new app.

I solved my problem… by moving to Hubitat. :frowning:

1 Like