mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-07 21:21:56 +00:00
DVCSMP-2211 - Update Button Number and Holdable capability (#1458)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ metadata {
|
||||
capability "Actuator"
|
||||
capability "Battery"
|
||||
capability "Button"
|
||||
capability "Holdable Button"
|
||||
capability "Configuration"
|
||||
capability "Refresh"
|
||||
capability "Sensor"
|
||||
|
||||
Reference in New Issue
Block a user