Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback when adding Xiaomi device #61

Closed
therve opened this issue Jun 8, 2018 · 6 comments
Closed

Traceback when adding Xiaomi device #61

therve opened this issue Jun 8, 2018 · 6 comments

Comments

@therve
Copy link

therve commented Jun 8, 2018

I have a few Xiaomi devices, which works great with the new support. But, on join they fail with a traceback:

2018-06-08 15:33:00 ERROR (MainThread) [bellows.ezsp] Exception running handler
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/bellows/ezsp.py", line 194, in handle_callback
handler(*args)
File "/usr/lib/python3.5/site-packages/bellows/zigbee/application.py", line 139, in ezsp_callback_handler
self._handle_frame(*args)
File "/usr/lib/python3.5/site-packages/bellows/zigbee/application.py", line 160, in _handle_frame
tsn, command_id, is_reply, args = self.deserialize(device, aps_frame.sourceEndpoint, aps_frame.clusterId, message)
File "/usr/lib/python3.5/site-packages/zigpy/application.py", line 73, in deserialize
return sender.deserialize(endpoint_id, cluster_id, data)
File "/usr/lib/python3.5/site-packages/zigpy/device.py", line 97, in deserialize
return self.endpoints[endpoint_id].deserialize(cluster_id, data)
KeyError: 1

I feel that's due to the fact that quirks only operate after device_initialized, not add_device (though I'm have only a shallow understanding of the problem).

I'd be happy to help testing.

Thanks!

@mrfoxbit
Copy link

mrfoxbit commented Jun 19, 2018

Same issues. Did you fix it?

@mrfoxbit
Copy link

mrfoxbit commented Jun 23, 2018

It worked for me. Thank you, @Yoda-x

zigpy/bellows#43 (comment)

@justin8
Copy link

justin8 commented Jul 23, 2018

Yeah, I'm also seeing this same issue. I haven't tried the fix from zigpy/bellows#43 (comment) yet. I'm running hass.io, so running custom versions of home-assistant seems to be quite painful

@Adminiuga
Copy link
Collaborator

Xiaomi are sending attribute updates prior Zigpy finishes device discovery and configure the device to send updates, hence the error.
If you continue getting this error, then:

  1. remove the device
  2. repair it
  3. during the discovery, keep the device awake by pressing the button ever 1.5s
  4. you may have to repeat the above a few times, as sometimes Xiaomis are PITA to pair

@therve
Copy link
Author

therve commented May 21, 2019

The error only happens when adding the device. But pairing does work. Could we just catch the error?

@Adminiuga
Copy link
Collaborator

Hrm, we could take same approach as zigpy-deconz and ignore ZCL traffic until the device is fully initialized or alternatively maybe we should add endpoint/clusters if we receive traffic on those, similar to proposal in #9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants