Hi Mike,
I control the switch from my phone usually. In fact its largely automatic.
To add a new device with its own device handler first you need to log in to your smart things account.
From there you need to add a device handler. I can past mine below. Its a bit embarrassing. I haven’t tidied it up. Its the old thing… its working so why fix it?
Once you have the handler added you can install a device using that handler.
I’m not sure just how much experience you have with all this so I didn’t want to add verbiage.
This is my handler… crude though it is.
metadata {
definition (name: “Zigbee Load Control Switch”, namespace: “GR_Load_Control”, author: “George Richards”, oauth: true) {
capability "Switch"
command "on"
command "off"
fingerprint profileId: “0104”, inClusters: “0000,0003,0006”, outClusters: “0A00”
}
simulator {
status “on”:"on/off: 1"
status “off”:"on/off: 0"
reply “zcl on-off on”:"on/off: 1"
reply “zcl on-off off”:“on/off: 0”
}
tiles {
standardTile(“switch”, “device.switch”, width: 2, height: 2, canChangeIcon: true) {
state “off”, label: ‘Off’, action: “switch.on”, icon: “st.Outdoor.outdoor16”, backgroundColor: "#ffffff"
state “on”, label: ‘On’, action: “switch.off”, icon: “st.Outdoor.outdoor16”, backgroundColor: “#53a7c0”
}
main "switch"
details([“switch”])
}
}
def parse(String description) {
log.info description
if (description?.startsWith(“catchall:”)) {
def value = name == “switch” ? (description?.endsWith(" 1") ? “on” : “off”) : null
def result = createEvent(name: name, value: value)
def msg = zigbee.parse(description)
log.debug "Parse returned ${result?.descriptionText}"
return result
log.trace msg
log.trace “data: $msg.data”
}
else {
def name = description?.startsWith(“on/off: “) ? “switch” : null
def value = name == “switch” ? (description?.endsWith(” 1”) ? “on” : “off”) : null
def result = createEvent(name: name, value: value)
log.debug "Parse returned ${result?.descriptionText}"
return result
}
}
def on() {
log.debug "Executing ‘on()’"
sendEvent(name: “switch”, value: “on”)
“st cmd 0x${device.deviceNetworkId} ${endpointId} 6 1 {}”
‘zcl on-off on’
}
def off() {
log.debug "Executing ‘off’"
sendEvent(name: “switch”, value: “off”)
“st cmd 0x${device.deviceNetworkId} ${endpointId} 6 0 {}”
‘zcl on-off off’
}