diff --git a/devicetypes/smartthings/aeon-key-fob.src/aeon-key-fob.groovy b/devicetypes/smartthings/aeon-key-fob.src/aeon-key-fob.groovy index eac86516fe8..b6d376fc1c3 100644 --- a/devicetypes/smartthings/aeon-key-fob.src/aeon-key-fob.groovy +++ b/devicetypes/smartthings/aeon-key-fob.src/aeon-key-fob.groovy @@ -15,6 +15,7 @@ metadata { definition (name: "Aeon Key Fob", namespace: "smartthings", author: "SmartThings") { capability "Actuator" capability "Button" + capability "Holdable Button" capability "Configuration" capability "Sensor" capability "Battery" @@ -118,3 +119,7 @@ def configure() { log.debug("Sending configuration: $cmd") return cmd } + +def updated() { + sendEvent(name: "numberOfButtons", value: 4) +} diff --git a/devicetypes/smartthings/aeon-minimote.src/aeon-minimote.groovy b/devicetypes/smartthings/aeon-minimote.src/aeon-minimote.groovy index e12be97bca7..4906fac6bc8 100644 --- a/devicetypes/smartthings/aeon-minimote.src/aeon-minimote.groovy +++ b/devicetypes/smartthings/aeon-minimote.src/aeon-minimote.groovy @@ -15,6 +15,7 @@ metadata { definition (name: "Aeon Minimote", namespace: "smartthings", author: "SmartThings") { capability "Actuator" capability "Button" + capability "Holdable Button" capability "Configuration" capability "Sensor" @@ -107,3 +108,7 @@ def configure() { log.debug("Sending configuration: $cmds") return cmds } + +def updated() { + sendEvent(name: "numberOfButtons", value: 4) +} diff --git a/devicetypes/smartthings/cooper-rf9500.src/cooper-rf9500.groovy b/devicetypes/smartthings/cooper-rf9500.src/cooper-rf9500.groovy index a669426a66a..2f83f77440f 100644 --- a/devicetypes/smartthings/cooper-rf9500.src/cooper-rf9500.groovy +++ b/devicetypes/smartthings/cooper-rf9500.src/cooper-rf9500.groovy @@ -16,7 +16,7 @@ metadata { capability "Switch" capability "Switch Level" capability "Button" - capability "Actuator" + capability "Actuator" //fingerprint deviceId: "0x1200", inClusters: "0x77 0x86 0x75 0x73 0x85 0x72 0xEF", outClusters: "0x26" } @@ -74,20 +74,20 @@ def off() { } def levelup() { - def curlevel = device.currentValue('level') as Integer + def curlevel = device.currentValue('level') as Integer if (curlevel <= 90) - setLevel(curlevel + 10); + setLevel(curlevel + 10); } def leveldown() { - def curlevel = device.currentValue('level') as Integer + def curlevel = device.currentValue('level') as Integer if (curlevel >= 10) - setLevel(curlevel - 10) + setLevel(curlevel - 10) } def setLevel(value) { log.trace "setLevel($value)" - sendEvent(name: "level", value: value) + sendEvent(name: "level", value: value) } def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd) { @@ -106,11 +106,11 @@ def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelS if (cmd.upDown == true) { Integer buttonid = 2 leveldown() - checkbuttonEvent(buttonid) + checkbuttonEvent(buttonid) } else if (cmd.upDown == false) { Integer buttonid = 3 levelup() - checkbuttonEvent(buttonid) + checkbuttonEvent(buttonid) } } @@ -140,12 +140,12 @@ def buttonEvent(button) { def result = [] if (button == 1) { def mystate = device.currentValue('switch'); - if (mystate == "on") + if (mystate == "on") off() else - on() + on() } - updateState("currentButton", "$button") + updateState("currentButton", "$button") // update the device state, recording the button press result << createEvent(name: "button", value: "pushed", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true) result @@ -182,3 +182,7 @@ def updateState(String name, String value) { state[name] = value device.updateDataValue(name, value) } + +def updated() { + sendEvent(name: "numberOfButtons", value: 3) +} diff --git a/devicetypes/smartthings/testing/simulated-minimote.src/simulated-minimote.groovy b/devicetypes/smartthings/testing/simulated-minimote.src/simulated-minimote.groovy index 62057238b6e..c2bb0cd1fad 100644 --- a/devicetypes/smartthings/testing/simulated-minimote.src/simulated-minimote.groovy +++ b/devicetypes/smartthings/testing/simulated-minimote.src/simulated-minimote.groovy @@ -15,9 +15,10 @@ metadata { definition (name: "Simulated Minimote", namespace: "smartthings/testing", author: "SmartThings") { capability "Actuator" capability "Button" + capability "Holdable Button" capability "Configuration" capability "Sensor" - + command "push1" command "push2" command "push3" @@ -45,42 +46,42 @@ metadata { } standardTile("push1", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: "Push 1", backgroundColor: "#ffffff", action: "push1" - } + } standardTile("push2", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: "Push 2", backgroundColor: "#ffffff", action: "push2" - } + } standardTile("push3", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: "Push 3", backgroundColor: "#ffffff", action: "push3" - } + } standardTile("push4", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: "Push 4", backgroundColor: "#ffffff", action: "push4" - } + } standardTile("dummy1", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: " ", backgroundColor: "#ffffff", action: "push4" - } + } standardTile("hold1", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: "Hold 1", backgroundColor: "#ffffff", action: "hold1" - } + } standardTile("hold2", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: "Hold 2", backgroundColor: "#ffffff", action: "hold2" - } + } standardTile("dummy2", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: " ", backgroundColor: "#ffffff", action: "push4" - } + } standardTile("hold3", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: "Hold 3", backgroundColor: "#ffffff", action: "hold3" - } + } standardTile("hold4", "device.button", width: 1, height: 1, decoration: "flat") { state "default", label: "Hold 4", backgroundColor: "#ffffff", action: "hold4" - } - + } + main "button" details(["push1","push2","button","push3","push4","dummy1","hold1","hold2","dummy2","hold3","hold4"]) } } def parse(String description) { - + } def push1() { @@ -125,3 +126,6 @@ private hold(button) { sendEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was held", isStateChange: true) } +def updated() { + sendEvent(name: "numberOfButtons", value: 4) +} diff --git a/devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy b/devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy index 6bd1858fb5f..3f68e62471c 100644 --- a/devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy +++ b/devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy @@ -19,6 +19,7 @@ metadata { capability "Actuator" capability "Battery" capability "Button" + capability "Holdable Button" capability "Configuration" capability "Refresh" capability "Sensor"