Is there a way to create a capability with a pushButton
display type that also has a label? I’m looking to create something similar to a momentary button, but the capability is rendered differently. I copied the momentary
presentation, so I am assuming ST is doing something custom here. In my simplest case, I just want a label and a button that performs a command. See my capability vs momentary with the same presentation. I don’t see any way to add the additional status next to the button, or why the button is styled differently.
I believe it is not currently possible showing a label or a “status” in the pushButton
capability because it has never appeared for me either.
I’ll ask the corresponding team about that and let you know.
Thanks @nayelyz . I am going to go with a toggleSwitch in standby mode. It has a label. The only difference is the button. I’ll just have to fake an off state for now. Thanks again
@nayelyz Any update on this? I keep running into a need to press a button and just execute a command. I have a state, but there is no ‘off’ command. This is related to my other question about a statelessPowerToggle. This is needed for actions that are started but can’t be stopped or undone.
Just FYI, I’ve had a modicum of success with textbuttons. They look ok if you have more than 1 action
I already asked the team what’s the progress about this request but so far I have no updates. I’ll keep you posted.
Linking this post:
In my case, I am planning to use a very similar customized pushbutton in routine/scene. My button only has one command that just sends a simple string if pushed. However, since the button has no attribute, I am not sure what to put in the presentation json file’s automation and condition field.
All i want to do is in a scene/routine, the button will be pressed once. Is it possible? Thanks!
Hi, @jackj
So, if I understand correctly, do you want to send a “push” command from the “actions”/“then” section of a Routine?
If so, it is not possible with this capability. For it to appear in the “then” section if we select the device, the capability needs a configuration in the “automation.actions” section of its presentation which isn’t included because its purpose is only to get events from physical buttons.
You can check its presentation with this command:
smartthings capabilities:presentation button -j
Got it. I think I sort of get it to work by creating a capability that is similar to the momentary capability example. The only thing that appears to be a problem was the label shown in the automation scene. From momentary capability presentation, the automation is as following:
"automation": {
"conditions": [],
"actions": [
{
"label": "{{i18n.label}}",
"displayType": "list",
"list": {
"alternatives": [
{
"key": "push",
"value": "{{i18n.commands.push.label}}",
"type": "active"
}
]
}
}
]
From my understanding, the value within the alternatives section determines the word it gonna show under the automation interface. For momentary capability, the label corresponds to some value like this
{{__PO_CODE_CAPABILITY.SMARTTHINGS.MOMENTARY…}}
and it converts to a legit word in the automation
I tried to replace this value with a direct string for my customized capability and it only shows invalid text… Is there any way we can create our own label? In fact, I am always kind of confused about this i18n.label thing. Thanks!
You recently created that capability, right? It should have an English translation already
Other developers have mentioned that in the Automation view (Routines tool), the label that appears is the one you define in the presentation which means you could use plain text (Eg. “my label”) and it should work which is not the case for the Detail View…
As a reference, when you call {{i18n.label}}
you’re trying to get the field below from the translation of the capability:
Got it. Thanks!