Skip to content

Commit

Permalink
Button 7 and 8 event changes
Browse files Browse the repository at this point in the history
I created 2 new methods that are consistent with other buttonPress methods
tapUp1Response and tapDown1Response

switch.on and switch.off calls these methods as well for further consistency and all no physical execution of buttons 7 and 8.
  • Loading branch information
stephack authored Jun 22, 2017
1 parent f961955 commit 43001f9
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions devicetypes/darwinsden/wd100-dimmer.src/wd100-dimmer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,15 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) {
}

def on() {
sendEvent(tapUp1Response("digital"))
delayBetween([
zwave.basicV1.basicSet(value: 0xFF).format(),
zwave.switchMultilevelV1.switchMultilevelGet().format()
],5000)
}

def off() {
sendEvent(tapDown1Response("digital"))
delayBetween([
zwave.basicV1.basicSet(value: 0x00).format(),
zwave.switchMultilevelV1.switchMultilevelGet().format()
Expand Down Expand Up @@ -307,10 +309,10 @@ def zwaveEvent(physicalgraph.zwave.commands.centralscenev1.CentralSceneNotificat
// Up
switch (cmd.keyAttributes) {
case 0:
// Press Once
result += createEvent(tapUp1Response("physical"))
result += response("delay 100")
result += createEvent([name: "switch", value: "on", type: "physical"])
sendEvent(name: "status" , value: "Tap ▲")
sendEvent(name: "button" , value: "pushed", data: [buttonNumber: "7"], descriptionText: "$device.displayName Tap-Up-1 (button 7) pressed",
isStateChange: true, type: "$buttonType")

if (singleTapToFullBright)
{
Expand Down Expand Up @@ -352,10 +354,10 @@ def zwaveEvent(physicalgraph.zwave.commands.centralscenev1.CentralSceneNotificat
// Down
switch (cmd.keyAttributes) {
case 0:
result=createEvent([name: "switch", value: "off", type: "physical"])
sendEvent(name: "status" , value: "Tap ▼")
sendEvent(name: "button" , value: "pushed", data: [buttonNumber: "8"], descriptionText: "$device.displayName Tap-Down-1 (button 8) pressed",
isStateChange: true, type: "$buttonType")
// Press Once
result += createEvent(tapDown1Response("physical"))
result += response("delay 100")
result += createEvent([name: "switch", value: "off", type: "physical"])
break
case 1:
result=createEvent([name: "switch", value: "off", type: "physical"])
Expand Down Expand Up @@ -391,6 +393,18 @@ def zwaveEvent(physicalgraph.zwave.commands.centralscenev1.CentralSceneNotificat
return result
}

def tapUp1Response(String buttonType) {
sendEvent(name: "status" , value: "Tap ▲")
[name: "button", value: "pushed", data: [buttonNumber: "7"], descriptionText: "$device.displayName Tap-Up-1 (button 7) pressed",
isStateChange: true, type: "$buttonType"]
}

def tapDown1Response(String buttontype) {
sendEvent(name: "status" , value: "Tap ▼")
[name: "button", value: "pushed", data: [buttonNumber: "8"], descriptionText: "$device.displayName Tap-Down-1 (button 8) pressed",
isStateChange: true, type: "$buttonType"]
}

def tapUp2Response(String buttonType) {
sendEvent(name: "status" , value: "Tap ▲▲")
[name: "button", value: "pushed", data: [buttonNumber: "1"], descriptionText: "$device.displayName Tap-Up-2 (button 1) pressed",
Expand Down Expand Up @@ -533,4 +547,4 @@ def updated()
def cmds= []
cmds << setDimRatePrefs
delayBetween(cmds, 500)
}
}

0 comments on commit 43001f9

Please sign in to comment.