Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were you having problems if you didn't include this new condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://smartthings.atlassian.net/browse/CHAD-5501
eZEX sensor send undefined packet(refer to below), so need to add exception for filtering of undefined attributeId.
(ZCL Rx: ep:01 prof:0104 clus:0006 lqi:C4 rssi:-51 fc:08 mc:0000 seq:34 cmd:0A body:11 00 18 07)

@greens, I don't have eZEX switch sensor, so I can't check it doesn't have problem without this condition.
But logically, As I said in decription, eZEX sensor send packet to hub with undefined attributeId(like 0x0011)
and we don't check the validity of attributeId in appengine-zigbee(only check the clusterId),
so it is recoginized as and 'off' value (even its real value is '07')
https://github.com/PhysicalGraph/appengine-zigbee/blob/master/src/main/groovy/physicalgraph/zigbee/Zigbee.groovy#L832
So I added this condition to activate with only 0x0000(OnOff) attribute.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but that event was being created by the code I've asked you to remove. zigbee.parse() most likely will not create that event, so just removing that extra code should solve that problem.

Copy link

@iquix iquix Sep 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@greens @inasail
Hi I'm a Smartthings customer in South Korea, and I would like to add comment about it.

Similar error also seems to occur in not only in Ezex, but also in Dawon multi switches.
Below is a thread in Korean Smartthings Community.
https://cafe.naver.com/stsmarthome/18408 (Sorry, It's in Korean, but @inasail, you could read it.)

If you decide to modify source code in either way, you may need to make sure that the change does not cause problem with zigbee-multi-switches from other manufacturers.

There must be some reason that "if (eventDescMap?.clusterId == zigbee.ONOFF_CLUSTER)" part of the code is there. Maybe, some products from other manufacturer (maybe, one of the products from Orvibo, GDKES, HONTAR, HEIMAN, Dawon and eWeLink) send faulty ZHA packets with only clusterId OnOff without attrId or wrong attrId, and that might be the reason of that part of the quirky code.

You may need to check out the history of the zigbee-multi-switch DTH, and look for previous pull request of that part of the code.

Thank you guys for all your efforts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but that event was being created by the code I've asked you to remove. zigbee.parse() most likely will not create that event, so just removing that extra code should solve that problem.

So I don't believe this is correct @greens . The getEvent call will generate an incorrect event for this message because we don't verify the attribute ID there. So we should also make a change https://github.com/PhysicalGraph/appengine-zigbee/blob/master/src/main/groovy/physicalgraph/zigbee/Zigbee.groovy#L832 to check the attribute ID there.

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