From capabilities reference, we can find 3 attributes on button
capability.
which:
button
numberOfButtons
supportedButtonValues
These attributes are clear and intuitive, but numberOfButtons
doesn’t make any change on new-app.
What is that?
From capabilities reference, we can find 3 attributes on button
capability.
which:
button
numberOfButtons
supportedButtonValues
These attributes are clear and intuitive, but numberOfButtons
doesn’t make any change on new-app.
What is that?
Number of Buttons indicates how many different buttons a device has. Then you can assign a different action to each button, using, for example, the official smart lighting feature.
Is that what you were asking?
3 buttons
4 buttons
That’s exactly what I want to do.
But that didn’t work for me so instead I separate components for each button.
Thanks you for about your answer, I’ll try it more.
I’m not sure what “didn’t work”. The numberOfButtons
is simply the number of buttons the device has.
Using components is exactly what you need to do with the new app and is generally the way to go.
Older classic apps such as Smart Lighting and webCoRE recognised a buttonNumber
carried in the event data. This was used to support multiple clicks as much as multiple buttons as back then the button capability only had pressed and held values.
If you need examples:
Well, sorry I’m little bit confused.
Back to the basic, button
capability has 3 attributes, and we use numberOfButtons
to report how many button does a device have.
But how can I notify to ST about which button pressed?
I couldn’t find attribute which I can set index of button.
Due to I’m working with Schema Connector, I’m not comfortable with groovy DTH. However I could find a hint from your example.
Thank you very much!
Since your device will communicate first with your application/Cloud, you can configure your Schema Connector instance to update these states at the SmartThings app using Device State Callbacks. You must use the component Id to specify which of the buttons has been pressed, e.g.:
...
"deviceState": [
{
"externalDeviceId": "<deviceId>",
"states": [
{
"component": "button1",
"capability": "st.button",
"attribute": "button",
"value": "held"
}
]
}
]
Note: For a better reference of OAuth Tokens used in Callback Interaction Types, check the Reciprocal Access Token documentation.
If you feel that this information has cleared your doubts, please mark it as a Solution. However, if you have any other questions, please let me know.