Does anyone know where I can get a simple virtual button device handler? I have virtual switches and dimmers but I cant find a simple single-fire button.
This is really needed as part of Automation triggers (IF) or in the available devices list.
No no…stop thinking like a physical button.
Just a single throw DH that repeats ‘On’ when activated would work perfectly. Buttons are a crucial part of any iot ecosystem. So this must be possible. Without it, ST has lost some value.
You may need to create the handler yourself. Despite what you might hear, the Momentary capability works fine with the ‘new’ app to display a tile that fires the ‘push()’ command when pressed. So you could add a button or switch capability to that to give you an attribute you can work with.
The standard Momentary Button Tile handler might even do the job (that turns a switch attribute on and off) though you might need to run it in the Classic app first to initialise the switch state. The new app likes capability attributes to have values and the handler hasn’t been updated to initialise them.
I have my own custom DTH but haven’t really played with it enough to see if there are any deficiencies. However, if you are interested, it is this:
I tried the momentary button tile. Works great in the old app, just a blank tile in the new app.
Thanks for writing this DTH, I’m giving it a try.
It’s close to what I need. Basically I’m looking to replicate the ability to execute my “goodbye” and “I’m back” routines manually. There doesn’t appear to be any other way to do this in the new app. I’m finding that your button doesn’t respond when I push it in the app… it just spins and goes to “Checking status…”
That’s rather annoying. I can’t replicate that behaviour but that doesn’t mean a lot. I’ve added a ‘vid’ to the device handler to see if being told what to do helps the app out. It has the useful side effect of enabling the momentary action in the dashboard tile.
Hi Graham,
I have the above zigbee SOS button. It worked with my old hub but since moving to Smartthings I cant quite get it to work. I am very new to this and while I can find my way around the code, I struggle to write it! The device initially just showed as ‘Thing’ so I tried your virtual button code - I can now see the device’s battery status (edit: actually, no, Batt status was with some other code I tried) on my phone app. I can see the device is online. If I click the button then the hub interface will tell me that the device was active a few seconds ago. BUT… I don’t get a button press shown on the app so I cant get it to preform any actions. What do I need to add to your code to make this function work? I suspect it might be as simple as adding the device model but I’m not sure of the syntax. Any help (but particularly in the form of code!) would be much appreciated. Patrick
Okay, I’m really not sure how to do that. I have tried for so long but without success. There must be something out there that’s close and that I can perhaps modify? The logs on the hub can see the button press but that’s as far as I get. I can’t get it to control a device.
For example; using Type: ‘Zigbee Button’, the live logs say:
What exactly are you trying to do? I use virtual switches to be able to trigger scenes, and as part of the scene, that particular virtual switch is turned off so it’s only “on” very briefly.