I recently needed to create some buttons on my wife’s AT panel for manually overriding irrigation schedules and such. Basically she wanted some push-buttons, which would immediately run the drippers on specific circuits for a couple of minutes and then shut off again.
I tried a few DTH’s I found in the forums, unfortunately none of them seemed to be what I was after. Some trial and error (and a helpful nudge from @tgauchat thanks), I tweaked the existing ‘Simulated Button’ DTH so it works both from within the ST Classic app and when you authorize it to ActionTiles.
Really wasn’t much that needed to be changed, AT looks for the Momentary capability, so that was added. Second the endpoint in the original DTH was for some reason called ‘push1’, changed that to ‘push’, which is the one AT will execute.
Note: the hold endpoint does not appear to be supported by AT as of now, yet that’s IMHO something you would only use on a physical button anyway. In AT you would just create another tile button I suppose.
Anyway if you need something similar, here’s the McGyver’ed DTH:
Hi Robin, yes - routines are certainly useful, yet I guess my choice hinges on that I use Webcore pistons for most of my automation rules these days as they give me the best flexibility.
Second, do correct me if I’m wrong, however I haven’t come across a good way with the native smartapps (like button manager, smart lighting or said routines, to use a button press to trigger a switch to turn on and then turn off after a while, like you can do with a motion detector. That combo seems not to be available.
Btw, this is what the working end-result looks likes in AT:
This is really nice. My wife is always asking me to turn on a Rachio sprinkler zone for some number of minutes. I will shameless may borrow from your excellent work to implement a similar button using the RULE feature in HousePanel. Thanks so much for sharing this. Looks amazing.
@MaxVonEvil Why wouldn’t just creating a Virtual Switch (which is local), then a Smart Lighting rule to turn off after two minutes (with Power Allowance, also local), not work for you?
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
Thanks for sharing this Device Handler, Max.
I have to share a little bit of recurring education on the topic of Capability “Button” vs Capability “Momentary”:
A Button is a Sensor (i.e., it has Attributes and reports when pushed or held), but not an Actuator (i.e., it does not have any Commands). A Button is like a Contact Sensor - it tells you when it is pushed (opened), but: A SmartApp cannot send any Commands to a Sensor that isn’t also an actuator. A SmartApp cannot, for example, tell a Contact Sensor to be “closed”. It can’t tell a Smoke Detector or Leak Sensor to pretend there is smoke or water present. See this link: You will note that Button has no Commands: https://docs.smartthings.com/en/latest/capabilities-reference.html#button
Due to #1, a SmartApp (like ActionTiles) cannot do anything with a Button. ActionTiles cannot push() or hold() a Button. Just as ActionTiles cannot open or close a contact sensor.
SmartThings included a unique Capability “Momentary” which has a Command “push()” but no Attributes. In other words, it is just an Actuator and not a Sensor. It would be like a smart outlet that you could turn on/off remotely, but not physically, and that would never report its state back to SmartThings. Why bother? Well - There are a lot of physical devices in the world which react to Momentary presses: Elevator call buttons, Doorbell button, Start button on a computer, etc… The Capability for Momentary is described here: https://docs.smartthings.com/en/latest/capabilities-reference.html#momentary
Unfortunately, there are indications that SmartThings intends to deprecate or discontinue Capability “Momentary”. The latest Capability list is published here: https://smartthings.developer.samsung.com/docs/api-ref/capabilities.html#Capabilities - I have written to Developer Support and requested Momentary be added back; but they were unhelpful. They simply don’t understand the special use cases we deal with all the time in the Community: ActionTiles, WebCoRE, Virtual Devices, etc., etc…
But wait: Can’t “Virtual Devices” be special and have custom Commands and/or Attributes?
Yes - In the legacy SmartThings API this is permitted. That’s why you can have a “Virtual Button” and add a push, hold, etc., Commands to it for SmartApps to use.
But custom ad hoc Commands & Attributes are not permitted in the new API: All the Commands and Attributes must come from an officially published Capability.
ActionTiles is a “SmartApp” - not a “Device”. ActionTiles can issue a push() Command to a Momentary, but cannot “be” a physical button and sendpush() Events to SmartThings (for other SmartApps to respond to). Maybe this will be an interesting way to handle the situation in the future - but it isn’t trivial, because ActionTiles will need to be published as both a SmartApp and as a Device Type. Getting a Device Type published is hard. Would ActionTiles just be a Button? Or a set of Buttons? Or something more complex that needs a whole new Capability?
The short term implication is that your DH posted in this Topic, and all the folks who are using some variation of Virtual or Real Devices claiming Capability “Momentary” is completely functional with ActionTiles and within specifications for SmartThings SmartApps.
But that all goes aways when SmartThings enforces the new API rules: Deprecates Capability “Momentary” and forbids Capability “Button” from having any ad hoc custom Commands.
It is a messy loose end that’s been around for ages and no one at SmartThings is helping to resolve it.
Hi Terry thanks for elaborating on this. It appears we’re on somewhat wobbly ground one way or the other when it comes to the ST API. Having worked with several software companies, an identifiable danger sign is when they begin to acquire Ivory Tower syndrome; “Everything we need to see, we can see from up here - Absolutely no need to venture out in the fields. Thar’ be dragons!”
Anyway, I digress - this DTH is a quick fiix which might only work for so long. If/when the API goes tits up, I’m sure someone will step up to the plate with another workaround. As @Alwas suggested one could use a virtual switch. I personally like the visual feed back of a button, thus I suppose one could set up a regular vswitch, flip it back to off after one second with Webcore and then do whatever additional stuff you need it to do. Just a thought.
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
The new SmartThings API / Samsung Developers team actually has somewhat “responsive” tech support, but so far they are not as in-tune with the real-world edge cases we continuously explore here in the ST Community.
We could reach out to (i.e., pester) them with our concern regarding the deprecation of “Momentary” (and, ummm, several other rather surprising Capability changes); but unless this is handled in a comprehensive, clear, and unified manner, then nothing will happen.
What Samsung SmartThings (and “we”) needs are “Developer Advocates” - a role they eliminated years ago.
With such significant changes to the API, such a team of resources are needed more than ever. This role used to be very trendy for all the various platforms that popped up over the past 5+ years. I can’t say for sure if only SmartThings has pulled away from offering it.
As we often say, smartthings is very powerful but not very discoverable. However, this is a very creative and active community, when you come across any fairly straightforward use case the odds are high that it’s already been solved and the solution published. Or that the answer is “webcore.“
By the way, you keep writing “DHT.” Do you mean “DTH,” “device type handler”?