Skip to content

Commit 1db5f75

Browse files
authored
DVCSMP-2211 - Update Button Number and Holdable capability (SmartThingsCommunity#1458)
1 parent 7978f45 commit 1db5f75

File tree

5 files changed

+43
-24
lines changed

5 files changed

+43
-24
lines changed

devicetypes/smartthings/aeon-key-fob.src/aeon-key-fob.groovy

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ metadata {
1515
definition (name: "Aeon Key Fob", namespace: "smartthings", author: "SmartThings") {
1616
capability "Actuator"
1717
capability "Button"
18+
capability "Holdable Button"
1819
capability "Configuration"
1920
capability "Sensor"
2021
capability "Battery"
@@ -118,3 +119,7 @@ def configure() {
118119
log.debug("Sending configuration: $cmd")
119120
return cmd
120121
}
122+
123+
def updated() {
124+
sendEvent(name: "numberOfButtons", value: 4)
125+
}

devicetypes/smartthings/aeon-minimote.src/aeon-minimote.groovy

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ metadata {
1515
definition (name: "Aeon Minimote", namespace: "smartthings", author: "SmartThings") {
1616
capability "Actuator"
1717
capability "Button"
18+
capability "Holdable Button"
1819
capability "Configuration"
1920
capability "Sensor"
2021

@@ -107,3 +108,7 @@ def configure() {
107108
log.debug("Sending configuration: $cmds")
108109
return cmds
109110
}
111+
112+
def updated() {
113+
sendEvent(name: "numberOfButtons", value: 4)
114+
}

devicetypes/smartthings/cooper-rf9500.src/cooper-rf9500.groovy

+15-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ metadata {
1616
capability "Switch"
1717
capability "Switch Level"
1818
capability "Button"
19-
capability "Actuator"
19+
capability "Actuator"
2020

2121
//fingerprint deviceId: "0x1200", inClusters: "0x77 0x86 0x75 0x73 0x85 0x72 0xEF", outClusters: "0x26"
2222
}
@@ -74,20 +74,20 @@ def off() {
7474
}
7575

7676
def levelup() {
77-
def curlevel = device.currentValue('level') as Integer
77+
def curlevel = device.currentValue('level') as Integer
7878
if (curlevel <= 90)
79-
setLevel(curlevel + 10);
79+
setLevel(curlevel + 10);
8080
}
8181

8282
def leveldown() {
83-
def curlevel = device.currentValue('level') as Integer
83+
def curlevel = device.currentValue('level') as Integer
8484
if (curlevel >= 10)
85-
setLevel(curlevel - 10)
85+
setLevel(curlevel - 10)
8686
}
8787

8888
def setLevel(value) {
8989
log.trace "setLevel($value)"
90-
sendEvent(name: "level", value: value)
90+
sendEvent(name: "level", value: value)
9191
}
9292

9393
def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd) {
@@ -106,11 +106,11 @@ def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelS
106106
if (cmd.upDown == true) {
107107
Integer buttonid = 2
108108
leveldown()
109-
checkbuttonEvent(buttonid)
109+
checkbuttonEvent(buttonid)
110110
} else if (cmd.upDown == false) {
111111
Integer buttonid = 3
112112
levelup()
113-
checkbuttonEvent(buttonid)
113+
checkbuttonEvent(buttonid)
114114
}
115115
}
116116

@@ -140,12 +140,12 @@ def buttonEvent(button) {
140140
def result = []
141141
if (button == 1) {
142142
def mystate = device.currentValue('switch');
143-
if (mystate == "on")
143+
if (mystate == "on")
144144
off()
145145
else
146-
on()
146+
on()
147147
}
148-
updateState("currentButton", "$button")
148+
updateState("currentButton", "$button")
149149
// update the device state, recording the button press
150150
result << createEvent(name: "button", value: "pushed", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true)
151151
result
@@ -182,3 +182,7 @@ def updateState(String name, String value) {
182182
state[name] = value
183183
device.updateDataValue(name, value)
184184
}
185+
186+
def updated() {
187+
sendEvent(name: "numberOfButtons", value: 3)
188+
}

devicetypes/smartthings/testing/simulated-minimote.src/simulated-minimote.groovy

+17-13
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ metadata {
1515
definition (name: "Simulated Minimote", namespace: "smartthings/testing", author: "SmartThings") {
1616
capability "Actuator"
1717
capability "Button"
18+
capability "Holdable Button"
1819
capability "Configuration"
1920
capability "Sensor"
20-
21+
2122
command "push1"
2223
command "push2"
2324
command "push3"
@@ -45,42 +46,42 @@ metadata {
4546
}
4647
standardTile("push1", "device.button", width: 1, height: 1, decoration: "flat") {
4748
state "default", label: "Push 1", backgroundColor: "#ffffff", action: "push1"
48-
}
49+
}
4950
standardTile("push2", "device.button", width: 1, height: 1, decoration: "flat") {
5051
state "default", label: "Push 2", backgroundColor: "#ffffff", action: "push2"
51-
}
52+
}
5253
standardTile("push3", "device.button", width: 1, height: 1, decoration: "flat") {
5354
state "default", label: "Push 3", backgroundColor: "#ffffff", action: "push3"
54-
}
55+
}
5556
standardTile("push4", "device.button", width: 1, height: 1, decoration: "flat") {
5657
state "default", label: "Push 4", backgroundColor: "#ffffff", action: "push4"
57-
}
58+
}
5859
standardTile("dummy1", "device.button", width: 1, height: 1, decoration: "flat") {
5960
state "default", label: " ", backgroundColor: "#ffffff", action: "push4"
60-
}
61+
}
6162
standardTile("hold1", "device.button", width: 1, height: 1, decoration: "flat") {
6263
state "default", label: "Hold 1", backgroundColor: "#ffffff", action: "hold1"
63-
}
64+
}
6465
standardTile("hold2", "device.button", width: 1, height: 1, decoration: "flat") {
6566
state "default", label: "Hold 2", backgroundColor: "#ffffff", action: "hold2"
66-
}
67+
}
6768
standardTile("dummy2", "device.button", width: 1, height: 1, decoration: "flat") {
6869
state "default", label: " ", backgroundColor: "#ffffff", action: "push4"
69-
}
70+
}
7071
standardTile("hold3", "device.button", width: 1, height: 1, decoration: "flat") {
7172
state "default", label: "Hold 3", backgroundColor: "#ffffff", action: "hold3"
72-
}
73+
}
7374
standardTile("hold4", "device.button", width: 1, height: 1, decoration: "flat") {
7475
state "default", label: "Hold 4", backgroundColor: "#ffffff", action: "hold4"
75-
}
76-
76+
}
77+
7778
main "button"
7879
details(["push1","push2","button","push3","push4","dummy1","hold1","hold2","dummy2","hold3","hold4"])
7980
}
8081
}
8182

8283
def parse(String description) {
83-
84+
8485
}
8586

8687
def push1() {
@@ -125,3 +126,6 @@ private hold(button) {
125126
sendEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was held", isStateChange: true)
126127
}
127128

129+
def updated() {
130+
sendEvent(name: "numberOfButtons", value: 4)
131+
}

devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ metadata {
1919
capability "Actuator"
2020
capability "Battery"
2121
capability "Button"
22+
capability "Holdable Button"
2223
capability "Configuration"
2324
capability "Refresh"
2425
capability "Sensor"

0 commit comments

Comments
 (0)