UPDATE: While it may be useful to play with the driver below, I do not recommend using it. See the one on my later post for something that is closer to functional, albeit one that as of my writing does indeed work like the switch/switch level device I'd prefer it not work like (but that may be the best we can do).
Original post:
OK, so I modified what appears to be a different version of DTH above to use the button model instead of the nonsensical switchLevel capabilities it was using. I am clearly not interpreting the events from the button correctly, since it gives me unexpected button numbers and events but does at least register something for each turn I make...and really each time I come vaguely close to touching the device (it must be extremely sensitive).
When I have more time, I'll compare what I did to the above--I'm assuming that DTH (from the same author, possibly a newer version) does a better job of interpreting the values than whatever i was working with.
If anyone is interested, the below is what I have. I do not recommend using this since it does not produce the expected events at the moment but it may be a good place to start if you are also interested in developing a driver for this device:
/**
* Copyright 2018 Robert Morris, portions by K. Andrews
*
* 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.
*
* Version Author Note
* 1.0 K Andrews Initial release
* 1.1 K Andrews Added Configure button
* ??? RMoRobert Attempt at Hubitat modification and adaptation to button model
*/
//import physicalgraph.zigbee.zcl.DataType
metadata {
definition (name: "IKEA Dimmer", namespace: "RMoRobert", author: "Robert Morris, Kristian Andrews") {
capability "PushableButton"
capability "ReleasableButton"
capability "Sensor"
capability "Configuration"
fingerprint profileId: "0104", inClusters: "0000, 0001, 0003, 0009, 0B05, 1000", outClusters: "0003, 0004, 0006, 0008, 0019, 1000", manufacturer: "IKEA of Sweden",model: "TRADFRI wireless dimmer",deviceJoinName: "IKEA Tradfri Dimmer"
fingerprint profileId: "C05E", inClusters: "0000, 0001, 0003, 0009, 0B05, 1000", outClusters: "0003, 0004, 0006, 0008, 0019, 1000", manufacturer: "IKEA of Sweden",model: "TRADFRI wireless dimmer",deviceJoinName: "IKEA Tradfri Dimmer"
}
}
// Parse incoming device messages to generate events
def parse(String description) {
log.trace "ZigBee DTH - Executing parse() for device ${device.displayName}"
def descMap = zigbee.parseDescriptionAsMap(description)
def eventType
def buttonNumber
if (descMap && descMap.clusterInt == 0x0008) {
switch (descMap.command) {
case "01":
// Record start time and direction of turn
state.direction = Integer.parseInt(descMap.data[0], 8)
if (state.direction == 00) {
eventType = "pushed"
buttonNumber = 1
}
else if (state.direction == 01) {
eventType = "pushed"
buttonNumber = 2
}
break
case "04":
if (descMap.data[0] == "00") {
eventType = "pushed"
buttonNumber = 1
} else {
eventType = "pushed"
buttonNumber = 2
}
break
case "05":
// Record start time and direction of turn
state.start = now()
state.direction = Integer.parseInt(descMap.data[0], 8)
if (state.direction == 00) {
eventType = "held"
buttonNumber = 1
}
else if (state.direction == 01) {
eventType = "held"
buttonNumber = 2
}
else {
log.warn "Unknown turn direction"
}
break
case "07":
// Stop turning
if (state.direction == 00) {
eventType = "released"
buttonNumber = 1
}
else if (state.direction == 01) {
eventType = "released"
buttonNumber = 2
}
else {
log.warn "Unknown turn direction"
}
break
default:
log.warn "Unhandled command ${descMap.command}; MAP: ${descMap}"
break
}
} else {
log.debug "Did not parse message for for description : $description"
log.debug "MAP ${descMap}"
}
if(eventType) {
createEvent([ name: eventType, value: buttonNumber, isStateChange: true, descriptionText: "Button 1 was $eventType" ])
log.debug "Button ${buttonNumber} ${eventType}"
}
else {
log.debug "Events parsed but no button events fired"
}
}
def refresh() {
log.trace "ZigBee DTH - Executing refresh() for device ${device.displayName}"
}
def installed() {
log.trace "ZigBee DTH - Executing installed() for device ${device.displayName}"
// Set default values
state.direction = 0
}
def uninstalled() {
log.trace "ZigBee DTH - Executing uninstalled() for device ${device.displayName}"
}
def configure() {
log.trace "ZigBee DTH - Executing configure() for device ${device.displayName}"
}