Skip to content

Commit

Permalink
DVCSMP-2211 - Update Button Number and Holdable capability (SmartThin…
Browse files Browse the repository at this point in the history
  • Loading branch information
juano2310 authored Nov 11, 2016
1 parent 7978f45 commit 1db5f75
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 24 deletions.
5 changes: 5 additions & 0 deletions devicetypes/smartthings/aeon-key-fob.src/aeon-key-fob.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -118,3 +119,7 @@ def configure() {
log.debug("Sending configuration: $cmd")
return cmd
}

def updated() {
sendEvent(name: "numberOfButtons", value: 4)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ metadata {
definition (name: "Aeon Minimote", namespace: "smartthings", author: "SmartThings") {
capability "Actuator"
capability "Button"
capability "Holdable Button"
capability "Configuration"
capability "Sensor"

Expand Down Expand Up @@ -107,3 +108,7 @@ def configure() {
log.debug("Sending configuration: $cmds")
return cmds
}

def updated() {
sendEvent(name: "numberOfButtons", value: 4)
}
26 changes: 15 additions & 11 deletions devicetypes/smartthings/cooper-rf9500.src/cooper-rf9500.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -182,3 +182,7 @@ def updateState(String name, String value) {
state[name] = value
device.updateDataValue(name, value)
}

def updated() {
sendEvent(name: "numberOfButtons", value: 3)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ metadata {
capability "Actuator"
capability "Battery"
capability "Button"
capability "Holdable Button"
capability "Configuration"
capability "Refresh"
capability "Sensor"
Expand Down

0 comments on commit 1db5f75

Please sign in to comment.