Skip to content

Commit

Permalink
[CHAD-5501][zigbee multi switch] Need Exception handling for eZEX mul…
Browse files Browse the repository at this point in the history
…ti switch (SmartThingsCommunity#44306)

* Exception handling for eZEX

* Change the logic
  • Loading branch information
inasail authored and shinasys committed Apr 29, 2021
1 parent ba08d49 commit 81837dd
Showing 1 changed file with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,19 @@ def parse(String description) {
Map eventMap = zigbee.getEvent(description)
Map eventDescMap = zigbee.parseDescriptionAsMap(description)

if (!eventMap && eventDescMap) {
eventMap = [:]
if (eventDescMap?.clusterId == zigbee.ONOFF_CLUSTER) {
eventMap[name] = "switch"
eventMap[value] = eventDescMap?.value
}
}

if (eventMap) {
if (eventDescMap?.sourceEndpoint == "01" || eventDescMap?.endpoint == "01") {
sendEvent(eventMap)
} else {
def childDevice = childDevices.find {
it.deviceNetworkId == "$device.deviceNetworkId:${eventDescMap.sourceEndpoint}" || it.deviceNetworkId == "$device.deviceNetworkId:${eventDescMap.endpoint}"
}
if (childDevice) {
childDevice.sendEvent(eventMap)
if (eventDescMap && eventDescMap?.attrId == "0000") {//0x0000 : OnOff attributeId
if (eventDescMap?.sourceEndpoint == "01" || eventDescMap?.endpoint == "01") {
sendEvent(eventMap)
} else {
log.debug "Child device: $device.deviceNetworkId:${eventDescMap.sourceEndpoint} was not found"
def childDevice = childDevices.find {
it.deviceNetworkId == "$device.deviceNetworkId:${eventDescMap.sourceEndpoint}" || it.deviceNetworkId == "$device.deviceNetworkId:${eventDescMap.endpoint}"
}
if (childDevice) {
childDevice.sendEvent(eventMap)
} else {
log.debug "Child device: $device.deviceNetworkId:${eventDescMap.sourceEndpoint} was not found"
}
}
}
}
Expand Down

0 comments on commit 81837dd

Please sign in to comment.