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.