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”.
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.
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.
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.
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.
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!)
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.
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.