Skip to content

Instantly share code, notes, and snippets.

@nayelyzarazua-bluetrail
Last active April 5, 2021 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nayelyzarazua-bluetrail/0c55f5db722843d70242be6c89a3a2cd to your computer and use it in GitHub Desktop.
Save nayelyzarazua-bluetrail/0c55f5db722843d70242be6c89a3a2cd to your computer and use it in GitHub Desktop.
ButtonDisplay
/**
* Test DTH for pushButton display of a custom capability.
*/
metadata {
definition (name: "startButton", author:"nayely", vid:"c1d85a31-6661-341c-94fb-9ddd42420392", mnmn: "SmartThingsCommunity") {
capability "schoolwater29967.startbutton"
}
simulator {}
tiles {}
}
def installed() {
log.trace "Executing 'installed'"
initialize()
}
def updated() {
log.trace "Executing 'updated'"
initialize()
}
def startButton(){
log.trace "startButton"
//other actions
}
private initialize() {
log.trace "Executing 'initialize'"
sendEvent(name: "buttonValue", value: "true")
}
//Definition
{
"id": "schoolwater29967.startbutton",
"version": 1,
"status": "proposed",
"name": "startbutton",
"attributes": {
"buttonValue": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"value"
]
},
"setter": "setButtonValue",
"enumCommands": []
}
},
"commands": {
"startButton": {
"name": "startButton",
"arguments": []
},
"setButtonValue": {
"name": "setButtonValue",
"arguments": [
{
"name": "value",
"optional": false,
"schema": {
"type": "string"
}
}
]
}
}
}
//Presentation
{
"dashboard": {
"states": [
{
"label": "{{buttonValue.value}}"
}
],
"actions": [
{
"displayType": "pushButton",
"pushButton": {
"command": "startButton"
}
}
],
"basicPlus": []
},
"detailView": [
{
"label": "Start",
"displayType": "pushButton",
"pushButton": {
"command": "startButton"
}
}
],
"id": "schoolwater29967.startbutton",
"version": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment