Aqara Smart Switch - Model ‎WS-USC02

I have a double rocker that I wanted to replace with a smart switch. Someone recommended this product (https://www.amazon.com/dp/B081ZQZJ8J?ref=ppx_yo2ov_dt_b_product_details&th=1). Turns out integration is not as simple as I'm used to. Some people on Facebook have suggested I need a custom driver. I have ZERO experience adding devices outside of the basic method. Can anyone help me get this set up?

PS I did try setting up with the regular add device function. However, turning on/off in Hubitat did not do anything and device status was not correct. Further, it was only giving me single switch options. Someone on Facebook had me change the device type to Generic Zigbee Multi Endpoint Switch. That didn't work so he had me change device to Device, click all the delete buttons, then change back to the Multi Endpoint again. That also did not work.

PPS I was bored tonight and kept hearing about how ChatGPT can write code. I thought, what the hell, let me ask it to write me code for a driver for this product. It actually have me code. Like I said, I have no experience with adding code this way and this code is poetically trash anyways, but I figured I'd include this as well.

metadata {
definition(name: "Aqara Smart Switch WS-USC02", namespace: "myhubitatusername", author: "myname") {
capability "Switch"
capability "Button"
capability "Battery"
capability "Configuration"
capability "Refresh"
capability "Health Check"

    fingerprint mfr: "LUMI", prod: "lumi.ctrl_neutral2", model: "lumi.ctrl_neutral2", deviceJoinName: "Aqara Smart Switch"
}

}

def parse(String description) {
log.debug "Parsing '${description}'"
def event = zigbee.getEvent(description)
if (event) {
createEvent(event)
} else if (description?.startsWith("catchall:")) {
def msg = zigbee.parse(description)
if (msg.clusterId == 0x0006 && msg.command == 0x01 && msg.data[0] == 0x02 && msg.data[1] == 0x02) {
createEvent(name: "button", value: "pushed", isStateChange: true)
} else if (msg.clusterId == 0x0000 && msg.command == 0x07 && msg.data[0] == 0x01) {
createEvent(name: "battery", value: msg.data[1])
} else if (msg.clusterId == 0x0000 && msg.command == 0x07 && msg.data[0] == 0x00) {
createEvent(name: "battery", value: msg.data[1])
}
} else {
log.debug "Unable to parse '${description}'"
}
}

def on() {
zigbee.smartShield(text: "01|00|00|01").format()
}

def off() {
zigbee.smartShield(text: "01|00|00|00").format()
}

def push() {
on()
off()
}

def refresh() {
zigbee.readAttribute(0x0000, 0x0020)
}

def configure() {
log.debug "Configuring Reporting and Bindings"
zigbee.configureReporting(0x0000, 0x0020, 0x20, 1, 3600, null)
zigbee.bind(DESTINATION_DEVICE_NETWORK_ID, [0x0000, 0x0006])
}

def ping() {
refresh()
}

def updated() {
log.debug "Updating Configuration"
configure()
}

def healthCheck() {
refresh()
}

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.