From 9eff7d85f8bab8f7a06efc7c9dacbfc16b823612 Mon Sep 17 00:00:00 2001 From: ZWozniakS Date: Fri, 10 Jan 2020 15:01:07 +0100 Subject: [PATCH 1/2] Added and integrated Everspring Wall Switch --- .../aeotec-wallmote.groovy | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/devicetypes/smartthings/aeotec-wallmote.src/aeotec-wallmote.groovy b/devicetypes/smartthings/aeotec-wallmote.src/aeotec-wallmote.groovy index 1c91a27b9e9..4dfa383f955 100644 --- a/devicetypes/smartthings/aeotec-wallmote.src/aeotec-wallmote.groovy +++ b/devicetypes/smartthings/aeotec-wallmote.src/aeotec-wallmote.groovy @@ -26,6 +26,7 @@ metadata { fingerprint mfr: "0086", model: "0082", deviceJoinName: "Aeotec Wallmote Quad", mnmn: "SmartThings", vid: "generic-4-button" fingerprint mfr: "0086", model: "0081", deviceJoinName: "Aeotec Wallmote", mnmn: "SmartThings", vid: "generic-2-button" + fingerprint mfr: "0060", model: "0003", deviceJoinName: "Everspring Wall Switch", mnmn: "SmartThings", vid: "generic-2-button" } tiles(scale: 2) { @@ -44,14 +45,14 @@ metadata { } def getNumberOfButtons() { - def modelToButtons = ["0082" : 4, "0081": 2] + def modelToButtons = ["0082" : 4, "0081": 2, "0003": 2] return modelToButtons[zwaveInfo.model] ?: 1 } def installed() { createChildDevices() sendEvent(name: "numberOfButtons", value: numberOfButtons, displayed: false) - sendEvent(name: "supportedButtonValues", value: ["pushed", "held"].encodeAsJson(), displayed: false) + sendEvent(name: "supportedButtonValues", value: supportedButtonValues.encodeAsJson(), displayed: false) sendEvent(name: "button", value: "pushed", data: [buttonNumber: 1], displayed: false) } @@ -90,14 +91,9 @@ def parse(String description) { def zwaveEvent(physicalgraph.zwave.commands.centralscenev1.CentralSceneNotification cmd) { def button = cmd.sceneNumber - def value - // 0 = pushed, 1 = released, 2 = held down - if (cmd.keyAttributes != 2) { - value = cmd.keyAttributes == 1 ? "held" : "pushed" - } else { - // we can't do anything with the held down event yet - return [] - } + + def value = buttonAttributesMap[(int)cmd.keyAttributes] + def child = getChildDevice(button) child?.sendEvent(name: "button", value: value, data: [buttonNumber: 1], descriptionText: "$child.displayName was $value", isStateChange: true) createEvent(name: "button", value: value, data: [buttonNumber: button], descriptionText: "$device.displayName button $button was $value", isStateChange: true) @@ -170,4 +166,30 @@ def getChildDevice(button) { log.error "Child device $childDni not found" } return child -} \ No newline at end of file +} + +private getSupportedButtonValues() { + if (isEverspring()) { + return ["pushed", "held", "double"] + } else { + return ["pushed", "held"] + } +} + +private getButtonAttributesMap() { + if (isEverspring()) {[ + 0: "pushed", + 2: "held", + 3: "double" + ]} + else {[ + 0: "pushed", + 1: "held" + ]} +} + +private isEverspring() { + zwaveInfo.model.equals("0003") +} + + From 37337c62161b02fecffd77f1f56c9963f625afa4 Mon Sep 17 00:00:00 2001 From: ZWozniakS Date: Mon, 13 Jan 2020 12:08:09 +0100 Subject: [PATCH 2/2] Added missing supproted button values for the child button --- .../smartthings/aeotec-wallmote.src/aeotec-wallmote.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devicetypes/smartthings/aeotec-wallmote.src/aeotec-wallmote.groovy b/devicetypes/smartthings/aeotec-wallmote.src/aeotec-wallmote.groovy index 4dfa383f955..fe7dec85d15 100644 --- a/devicetypes/smartthings/aeotec-wallmote.src/aeotec-wallmote.groovy +++ b/devicetypes/smartthings/aeotec-wallmote.src/aeotec-wallmote.groovy @@ -145,7 +145,7 @@ def createChildDevices() { child = addChildDevice("Child Button", "${device.deviceNetworkId}:${i}", device.hubId, [completedSetup: true, label: "${device.displayName} button ${i}", isComponent: true, componentName: "button$i", componentLabel: "Button $i"]) - child.sendEvent(name: "supportedButtonValues", value: ["pushed", "held"].encodeAsJson(), displayed: false) + child.sendEvent(name: "supportedButtonValues", value: supportedButtonValues.encodeAsJson(), displayed: false) child.sendEvent(name: "button", value: "pushed", data: [buttonNumber: 1], descriptionText: "$child.displayName was pushed", isStateChange: true, displayed: false) } }