How to Create a Virtual Button (Virtual "Momentary")

Here's what I did. I'll post it to the ST forum, as it may be useful to others.


SmartThings Community Post: https://community.smartthings.com/t/release-working-virtual-button-dht-for-action-tiles/162384

1) Created a new DHT using the built in "Simulated Button" example.

2) Edited the code,

  - adding the capability "Momentary" to it

  - for some some reason the Command endpoint in the DHT were called 'push1', where AT expects it to be called 'push'   

3) Saved, Published and Created a new button device based on this DHT

4) Tested it internally in ST by way of the Smart Lighting app, created a temporary rule to turn on a lamp when the vbutton is pushed; works fine.

5) Authorized the Virtual Button to AT, and now it appears in the library and it creates a working pushbutton tile for it.

I've posted the tweaked code on my github here: https://github.com/MaxVonEvil/SmartThingsStuff/blob/master/ATvirtualbutton.groovy


...Max

Is this article helpful for you?