So I have two out of four buttons working. Used Mutley’s Lightify Dimmer code for DTH and SmartApp. Change fingerprint and bindings as per post above.
Edit DTH under the parseCatchAllMessage function to replace the case statements as below.
switch(msg.clusterId) {
case 1:
// call getBatteryResult method to parse battery message into event map
log.debug ‘BATTERY MESSAGE’
def result = getBatteryResult(Integer.parseInt(msg.value, 16))
break
/* case 6:
def button = (msg.command == 1 ? 1 : 2)
log.debug “Command received was $msg.command”
log.debug “Data received was $msg.data[0]”
log.debug msg.sourceEndpoint
Map result = [:]
result = [
name: ‘button’,
value: ‘pushed’,
data: [buttonNumber: button],
descriptionText: “$device.displayName button $button was pushed”,
isStateChange: true
]
log.debug “Parse returned ${result?.descriptionText}”
return result
break
case 768:
def button = (msg.data[0] == 1 ? 3 : 4)
log.debug “Command received was $msg.command”
log.debug “Data received was $msg.data[0]”
log.debug msg.sourceEndpoint
Map result = [:]
result = [
name: 'button',
value: 'pushed',
data: [buttonNumber: button],
descriptionText: "$device.displayName button $button was pushed",
isStateChange: true
]
log.debug "Parse returned ${result?.descriptionText}"
return result
break */
case 8:
switch(msg.command) {
case 1: // brightness decrease command
Map result = [:]
result = [
name: 'button',
value: 'held',
data: [buttonNumber: 2],
descriptionText: "$device.displayName button 2 was held",
isStateChange: true
]
log.debug "Parse returned ${result?.descriptionText}"
return result
break
case 3: /* brightness change stop command
def result = [
name: 'button',
value: 'released',
data: [buttonNumber: [1,2]],
descriptionText: "$device.displayName button was released",
isStateChange: true
]*/
log.debug "Recieved stop command, not currently implemented!"
//return result
break
case 5: // brightness increase command
Map result = [:]
result = [
name: 'button',
value: 'held',
data: [buttonNumber: 1],
descriptionText: "$device.displayName button 1 was held",
isStateChange: true
]
log.debug "Parse returned ${result?.descriptionText}"
return result
break
}
}
switch(msg.sourceEndpoint) {
case 1:
log.debug “physical button 1”
Map result = [:]
result = [
name: ‘button’,
value: ‘pushed’,
data: [buttonNumber: 1],
descriptionText: “$device.displayName button 1 was pushed”,
isStateChange: true
]
log.debug “Parse returned ${result?.descriptionText}”
return result
break
case 2: //physical button 3
Map result = [:]
result = [
name: ‘button’,
value: ‘pushed’,
data: [buttonNumber: 3],
descriptionText: “$device.displayName button 3 was pushed”,
isStateChange: true
]
log.debug “Parse returned ${result?.descriptionText}”
return result
break
case 3:
//physical button 2
Map result = [:]
result = [
name: ‘button’,
value: ‘pushed’,
data: [buttonNumber: 2],
descriptionText: “$device.displayName button 2 was pushed”,
isStateChange: true
]
log.debug “Parse returned ${result?.descriptionText}”
return result
break
case 4:
//physical button 4
Map result = [:]
result = [
name: ‘button’,
value: ‘pushed’,
data: [buttonNumber: 4],
descriptionText: “$device.displayName button 4 was pushed”,
isStateChange: true
]
log.debug “Parse returned ${result?.descriptionText}”
return result
break