Need developer input: Capability "Momentary" is needed in the new API!

To celebrate my 6th Year Anniversary of joining the Community:

Continuing the discussion from [Confused about Simulated Buttons and ActionTiles]…

So the response from Samsung Developer Support was in the form of a question:

Hello,
As of the moment, we do not have the capability “momentary” you are requesting, unfortunately.

May we ask what you are trying to use the momentary capability for? So we might be able to try and find a solution for you.

Kindest Regards,
David, SmartThings Developer Support, https://smartthings.developer.samsung.com


While I can start this off with our own use case (i.e., Our feature of being able to “kick off stuff” with Momentary button Tiles in ActionTiles), I would like to have other folks input (like @Mavrrick58, @RBoy, @625alex, @anon36505037, @eibyer, @jkp, etc.) to add to the response. Maybe a single consolidated response will invoke a stronger response from Support…


A device of Capability “Momentary” is an Actuator (like a Switch) that accepts the command push(). SmartApps which are subscribed to this device+command are common, as many SmartApps are looking for a simple unary trigger condition that is not a binary condition such as Switch on/off, nor Contact open/closed, nor Motion active/inactive, etc…

This is not the same as a Button, but may be used in a similar way. A doorbell DH, for example, has no commands. It is a Sensor: It senses (and fires an event) when it has been pushed or held. A Button Controller is just a set of buttons. It muddies the waters, but it would be nice if Button also had a Attribute duration indicating how long the button was held, or if it sent 2 events pushed and released - but we’re talking Momentary, not Button here.

ActionTiles is a web based UI for SmartThings that communicates via connector SmartApp - Like Alexa. We need to be able to present the user the ability to “press” a Button, but since Button’s don’t have Commands, the connector SmartApp cannot activate a Button. It cannot act as a doorbell trigger or scene trigger or panic button. Instead, the customer can spawn a Virtual Device of Capability “Momentary” which the SmartApp subscribes too. Thus, the user can “push()” that “Momentary button” in ActionTiles, or ask Alexa to “push()” the Panic button.

Yes - There are workarounds / alternatives:

  • A Momentary is like a Switch that immediately turns itself off() after being turned on() - but that issues 2 Events instead of 1. Wasteful and confusing.

  • In the our use case (ActionTiles, Alexa, etc.), the Virtual Momentary button is acting as an intermediary to some other function. A Virtual Momentary button that is linked to ring a Doorbell, via an Automation SmartApp, could just call the ring() command of that Doorbell. But no such Capability “Ring” exists - Capability “Alarm” is inaccurate. Momentary lets us cover all sorts of unforeseen unary Event triggering cases without needing exact Capabilities for them.

Virtual Switches (which are both Actuators and Sensors) are currently being used generic as binary status indicators and binary status setters (e.g., “armed/disarmed” - since there is no Capability “Security System”). Virtual Momentaries are just a simpler case. A pure Actuator.

6 Likes

The ‘button’ capability is deprecated in the classic environment and yet implemented with knobs on in the new API and may even handle rocker buttons or double buttons (not sure what else ‘up’ and ‘down’ means). I do look at it and wonder if there is an argument for a ‘released’ value. I can see why there might be issues but nothing that an extra attribute wouldn’t solve.

I also look at it and wonder why there aren’t associated commands for all those attribute values. Would it actually do any harm to allow for virtual buttons?

As for ‘momentary’, I look at all my IR remotes and see an awful lot of stateless momentary buttons. That probably says it for me.

3 Likes

I currently use two momentary buttons. One of them I am sure I can do a different way. The other momentary button I use to reset my Honeywell thermostat after I place it in a “hold”. This one would require additional code to replace with a switch. I used to use a couple of them as garage door buttons when I lived in Michigan. Not having momentary buttons makes no sense.

1 Like

Momentary buttons allow me to trigger Hue scenes not natively accessible through hue using a third party service (IFTTT).

I’ve found that some services don’t support momentary buttons (i.e. Alexa) and require a clunky workaround to get virtual switches to reset after switching on.

The use case for momentary buttons is infinite, and makes automating so much simpler. Please give them back!

3 Likes

I am not a super developer, but I do have 2 DTHs that are used by multiple people, Logitech Media Server and Nanoleaf for Classic app. Momentary buttons are used by both, or at least the Momentary Button Tile implementation of one.

Why, to expose custom commands via SmartApps and WebCore to other areas that can’t access them, such as routines, scenes, and most importantly, voice control and Action TIles.

For example, play, pause, stop, mute, volume up/down, and starting a playlist are all events that don’t require an on/off state. They simply need something to engage (a button) that creates an event that can be acted on. I don’t need to know if play is on or off, just that it has been pushed.

Most of the feedback I get is for more presets and getting the set up correctly so they can be used for voice control, and to some extent Action Tiles. The way Smartthings is now, this can’t happen at all without some type of momentary function. Managing an on/off state for these types of things isn’t really doable.

Google Assistant (don’t speak Alexa) doesn’t have “push” ability, merely on/off. So I have to subsribe to the “on” event, and use the DTH that turns the button/switch back off for the next time. That DTH, the Momentary Button Tile doesn’t even work in the new app currently, devices report “offline”.

So for now, momentary buttons are a big way to make Smarthings more functional and compensate for otherwise limited usefulness in automation and voice control.

1 Like

I think it’s a complete joke that someone at Samsung can’t see the unlimited uses of momentary buttons in Smartthings they can be so so so helpful for creating virtual buttons to make things happen that are not switched on or off.

Removing this functionality will make this platform look extremely messy when the only work around is to have a switch turn it self off how silly does it look to need to write more code to turn a button off than to actually carry out what you wanted!

3 Likes

I agree that momentary is not just needed it is very important. I hope Samsung gets it together and think hard about this.

2 Likes

Any news on this subject? I know I’m soooo late to the party but I just started looking into the new app and only now noticed that all my momentary buttons (and some other device types) don’t work any more. I have a whole bunch of them using them for purposes others mentioned earlier. I agree that this functionality is needed.

The Momentary capability works just fine in the new app.

What isn’t yet offered is the support for custom capabilities on the device details page that would allow other momentary actions.

Well, that’s good. Then maybe I was looking at this the wrong way. What started my search was the fact that my virtual Alexa Helper Momentary Buttons don’t work in the new app. So if the ‘Momentary’ capability is not the problem then what is? Is there a ST native device handler for a Virtual Momentary Button?

I think the problem with some device handlers is that they don’t initialise their attributes when they are installed. The new app is rather keen on attributes having values. However that should only really matter if it is a new installation and I don’t think it is simple as that. The Momentary Button Tile seems to be particularly quirky. It can work, it just doesn’t seem to want to without being given a kick.

I’m not a developer so I’m not sure what to make of that… How do I give it a kick?

Could I ask how did you make that?

I’m trying do that but doesn’t work.
I mean, which attribute and value and capability should I use?

Maybe something like this?

capability “Momentary”

def installed(){
sendEvent(name: ‘Momentary’ value: ‘pushed’)

The momentary capability is supported, but it is the status only. You can not activate it via the app. It has to be activated via the device. So virtual devices do not work since there is no physical device.

That screenshot comes from a virtual device using this:

https://github.com/orangebucket/Anidea-for-SmartThings/blob/master/devicetypes/orangebucket/anidea-for-virtual-button.src/anidea-for-virtual-button.groovy?ts=4

It is just a simple button that generates ‘pushed’ events (the ‘down_6x’ status is just used to initialise the button status without fearing setting off an automation). The Momentary capability calls the ‘push()’ method which sends the button pushed event.

I mostly use it as a momentary button with ActionTiles but the Momentary action works fine in the new app too.

*It doesn’t work in the Classic app because I deliberately left the ‘tiles()’ block out. *

The Momentary capability works fine in the app. You click on the button and it runs the ‘push()’ method, just as it is supposed to. I used it thirty seconds ago to push a virtual button, and ten minutes ago to push a physical button remotely.

The Momentary capability isn’t documented as even having any attributes.

Not really, because the Momentary capability is defined as purely an actuator. It simply means that the device handler has a ‘push’ command.

You do see the ‘momentary’ attribute being used, but it isn’t defined as part of the Momentary capability, at least not in the Classic documentation or in the Developer Workspace.

sorry, should have clarified, new app. Are you able to “push” a virtual momentary button in the new app?

What I am saying is that adding the ‘Momentary’ capability to a device handler adds a tile (for want of a better word) on the device details page like the following:

Screenshot_20200514-150919_SmartThings

If I hit the button on the Momentary tile it runs the push() method. In this particular handler it makes the other three (virtual) capabilities displayed go to their active state and back again, so I suppose you can call that a Momentary Contact Sensor / Motion Sensor / Switch.

In an earlier post (number 8 or thereabouts) there is a screen shot of it in a handler with a virtual button. In that case I get it to ‘push’ the button. So to me that is a Momentary Button.

So if we are talking about the Momentary capability, then yes the ‘new’ app supports it.

If we are talking about having multiple momentary actions, as you can implement using tiles in the Classic app, then no, I am not suggesting that at all.

People talk about the Momentary Button Tile not working in the ‘new’ app and it certainly behaves a bit strangely with the new app if installed on a new device. However install a copy of the code as a custom handler and that is much happier. Seed its switch attributes and it is happier still.

3 Likes