EDIT: Looks like the device doesn't actually take the dimmer value from the driver -- despite appearing that way in the details page for the dimmer. When you turn the knob, it jumps right back to the value the dimmer has internally. Best to look at Ed's driver a few posts down!
Yep here you go. Keep in mind, it was a quick hack, but it works great for me. I take no credit for the original code. One thing to note is I DID modify the behavior of when the switch turns on/off, based on the dimmer twisting. I didn't want it to force an off, because it caused issues. I just tap the button to cycle through lights in my room, then twist to adjust.
Then I use RM to track the dimmer, based on various scenarios to actually control different lights from the same dimmer. Probably silly for most, but maybe it will give people ideas. Gotta get creative with such a simple controller.
/**
* Partly based on source originally copyright 2018-2019 SmartThings
*
* 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.
*
*/
import com.hubitat.zigbee.DataType
metadata {
definition (name: "Lutron Aurora Dimmer-custom", namespace: "RMoRobert", author: "Robert Morris") {
capability "Actuator"
capability "Switch"
capability "Pushable Button"
capability "Switch Level"
capability "Configuration"
fingerprint profileId: "0104", inClusters: "0000,0001,0003,1000,FC00", outClusters: "0003,0004,0006,0008,0019,1000", manufacturer: "Lutron", model: "Z3-1BRL" }
}
// Parse incoming device messages to generate events
def parse(String description) {
logDebug "description = $description"
def event = zigbee.getEvent(description)
if (event) {
if (event.name=="level" && event.value==0) {
log.debug "level = 0"
}
else {
log.debug "sending ${event}"
sendEvent(event)
}
} else {
def descMap = zigbee.parseDescriptionAsMap(description)
if (descMap && descMap.clusterInt == 0x008) {
log.debug "8 data = ${descMap.data}"
logDebug("Button turned, setting level from device data")
def dataList = descMap.data
if (dataList.size() < 3) {
logDebug "Ignoring data ${dataList}"
} else {
int deviceLevel = Integer.parseInt(descMap.data[0], 16) * (100/254)
logDebug "Device level = ${deviceLevel}"
setLevel(deviceLevel)
}
} else if (descMap && descMap.clusterInt == 0x0006) {
logDebug("Button pressed, attempting to show pushed button")
// sendEvent(name: "switch", value: device.currentValue("switch") == "on" ? "off" : "on")
sendEvent(name: "pushed", value: 1, isStateChange: true, descriptionText: "Aurora button was pushed")
} else {
log.warn "DID NOT PARSE MESSAGE for description : $description"
log.debug "${descMap}"
}
}
}
def off() {
sendEvent(name: "switch", value: "off", isStateChange: true)
}
def on() {
sendEvent(name: "switch", value: "on", isStateChange: true)
}
def setLevel(value, rate = null) {
// if (value == 0) {
// sendEvent(name: "switch", value: "off")
// } else {
// sendEvent(name: "switch", value: "on")
sendEvent(name: "level", value: value)
// }
}
def installed() {
sendEvent(name: "switch", value: "on", displayed: false)
sendEvent(name: "level", value: 100, displayed: false)
sendEvent(name: "pushed", value: "1", displayed: false)
sendEvent(name: "numberOfButtons", value: 1, displayed: false)
}
def configure() {
zigbee.onOffConfig() +
zigbee.levelConfig() +
zigbee.enrollResponse() +
zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x20)
}
def logDebug(str) {
log.debug(str)
}