- Make sure that you are using the same device (zwave.me z wave plus secure wireless wall controller)
- set device to inclusion mode (on the instructions that come with the device)
- Smartthings should recognise this as a z wave device - add what it finds
- go to smartthings IDE and change device type to this one
- should now work with button controller smartapp
If the above steps dont work - go to live logging and let me know what you see when you press buttons
the latest version of the code is here:
/**
* Copyright 2015 AdamV
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
*/
metadata {
definition (name: "Secure Wall Controller", namespace: "Z-Wave.me", author: "AdamV") {
capability "Actuator"
capability "Button"
capability "Battery"
fingerprint deviceId: "0x1801", inClusters: "0x5E, 0x8F, 0x73, 0x98, 0x86, 0x72, 0x70, 0x85, 0x2D, 0x8E, 0x80, 0x84, 0x5A, 0x59, 0x5B, 0xEF, 0x20, 0x5B, 0x26, 0x27, 0x2B, 0x60"
}
simulator {
status "button 1 pushed": "command: 9881, payload: 00 5B 03 DE 00 01"
status "button 1 held": "command: 98C1, payload: 00 5B 03 E4 02 01"
status "button 2 pushed": "command: 9881, payload: 00 5B 03 E0 00 02"
status "button 2 held": "command: 98C1, payload: 00 5B 03 E6 02 01"
status "button 3 pushed": "command: 9881, 00 5B 03 E1 00 05"
status "button 3 held": "command: 98C1, payload: 00 5B 03 E8 02 01"
status "button 4 pushed": "command: 9881, payload: 00 5B 03 E2 00 06"
status "button 4 held": "command: 98C1, payload: 00 5B 03 EA 02 01"
status "wakeup": "command: 8003, payload: FF"
}
tiles {
standardTile("button", "device.button", width: 2, height: 2) {
state "default", label: "", icon: "st.Home.home30", backgroundColor: "#ffffff"
}
valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat") {
tileAttribute ("device.battery", key: "PRIMARY_CONTROL"){
state "battery", label:'${currentValue}% battery', unit:""
}
}
main "button"
details(["button", "battery"])
}
}
def parse(String description) {
def results = []
if (description.startsWith("Err")) {
log.debug("An error has occurred")
}
else {
def cmd = zwave.parse(description.replace("98C1", "9881"), [0x98: 1, 0x20: 1, 0x84: 1, 0x80: 1, 0x60: 3, 0x2B: 1])
if (cmd) {
results = zwaveEvent(cmd)
// log.debug(cmd)
}
// if(cmd) results += zwaveEvent(cmd)
// if(!results) results = [ descriptionText: cmd, displayed: false ]
}
log.debug("Description from device: $description")
def BUTTON_IDs = [ 1, 2, 5, 6 ]
// Split string by comma xter, will return an array.
String [] sections = description.split( "," )
// log.debug("sections: $sections")
// Remove all whitespace from beginning and end of each section string.
for (def i = 0; i < sections.length; i++) {
sections[ i ] = sections[ i ].trim()
}
// log.debug("Trimmed sections: $sections")
// Fetch the command and payload strings from the sections array.
String command = sections[ 1 ]
String payload = sections[ 2 ]
// log.debug( "Command: $command" )
// log.debug( "Payload: $payload" )
// Get the command ID and payload ID from these strings.
String commandID = command[-4..-1]
String payloadID = payload[-2..-1]
// log.debug( "CommandID: $commandID" )
// log.debug( "PayloadID: $payloadID" )
// Coerce the payloadID to a Number from a string (using base 10 as radix)
Integer payloadIDint = payloadID.toInteger()
// log.debug(payloadIDint)
// Determine which button was pressed.
if ( commandID == "9881" && payloadIDint == BUTTON_IDs[ 0 ]) {
Integer button = 1
results = createEvent(name: "button", value: "pushed", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true)
log.debug( "Button $button was pushed" )
}
else if ( commandID == "9881" && payloadIDint == BUTTON_IDs[ 1 ]) {
Integer button = 2
results = createEvent(name: "button", value: "pushed", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true)
log.debug( "Button $button was pushed" )
}
else if ( commandID == "9881" && payloadIDint == BUTTON_IDs[ 2 ]) {
Integer button = 3
results = createEvent(name: "button", value: "pushed", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true)
log.debug( "Button $button was pushed" )
}
else if ( commandID == "9881" && payloadIDint == BUTTON_IDs[ 3 ]) {
Integer button = 4
results = createEvent(name: "button", value: "pushed", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true)
log.debug( "Button $button was pushed" )
}
else if ( commandID == "98C1" && payloadIDint == BUTTON_IDs[ 0 ]) {
Integer button = 1
results = createEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was held", isStateChange: true)
log.debug( "Button $button was held" )
}
else if ( commandID == "98C1" && payloadIDint == BUTTON_IDs[ 1 ]) {
Integer button = 2
results = createEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true)
log.debug( "Button $button was held" )
}
else if ( commandID == "98C1" && payloadIDint == BUTTON_IDs[ 2 ]) {
Integer button = 4
results = createEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true)
log.debug( "Button $button was held" )
}
else if ( commandID == "98C1" && payloadIDint == BUTTON_IDs[ 3 ]) {
Integer button = 4
results = createEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was pushed", isStateChange: true)
log.debug( "Button $button was held" )
}
else {
log.debug( "Commands and Button ID combinations unaccounted for happened" )
}
return results
// return commandID
}
def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) {
def encapsulatedCommand = cmd.encapsulatedCommand([0x98: 1, 0x20: 1])
// can specify command class versions here like in zwave.parse
if (encapsulatedCommand) {
log.debug(encapsulatedCommand)
return zwaveEvent(encapsulatedCommand)
}
}
def zwaveEvent(physicalgraph.zwave.commands.centralscenev1.CentralSceneNotification cmd) {
log.debug( "keyAttributes: $cmd.keyAttributes")
log.debug( "sceneNumber: $cmd.sceneNumber")
log.debug( "sequenceNumber: $cmd.sequenceNumber")
// log.debug( "payload: $cmd.payload")
}
def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd) {
[ createEvent(descriptionText: "${device.displayName} woke up"),
response(zwave.wakeUpV1.wakeUpNoMoreInformation()) ]
}
def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
def map = [ name: "battery", unit: "%" ]
if (cmd.batteryLevel == 0xFF) { // Special value for low battery alert
map.value = 1
map.descriptionText = "${device.displayName} has a low battery"
map.isStateChange = true
} else {
map.value = cmd.batteryLevel
log.debug ("Battery: $cmd.batteryLevel")
}
// Store time of last battery update so we don't ask every wakeup, see WakeUpNotification handler
state.lastbatt = new Date().time
createEvent(map)
}
def configurationCmds() {
def cmds = []
def hubId = zwaveHubNodeId
(1..4).each { button ->
cmds << zwave.configurationV1.configurationSet(parameterNumber: 240+button, scaledConfigurationValue: 1).format()
}
(1..4).each { button ->
cmds << zwave.configurationV1.configurationSet(parameterNumber: (button-1)*40, configurationValue: [hubId, (button-1)*40 + 1, 0, 0]).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: (button-1)*40 + 20, configurationValue: [hubId, (button-1)*40 + 21, 0, 0]).format()
}
cmds
}
def configure() {
def commands = [ ]
for (def i = 1; i <= 4; i++) {
commands << zwave.associationV1.associationSet(groupingIdentifier: i, nodeId: zwaveHubNodeId).format()
commands << zwave.sceneControllerConfV1.sceneControllerConfSet(groupId:i, sceneId:i).format()
}
log.debug("Sending configuration: ${commands}")
delayBetween(commands, 1250)
}