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

Add support for Xiaomi sensors #14

Closed
ruippeixotog opened this issue Feb 7, 2018 · 7 comments
Closed

Add support for Xiaomi sensors #14

ruippeixotog opened this issue Feb 7, 2018 · 7 comments

Comments

@ruippeixotog
Copy link

(previously zigpy/bellows#43)

The protocol used by Xiaomi to connect to their sensors seems to deviate slightly from the ZigBee standard, preventing zigpy from communicating properly with them. It would be great if we could use a generic ZigBee radio to connect Xiaomi sensors to Home Assistant.

@jonatanolofsson
Copy link

Related: #8

@rcloran
Copy link
Collaborator

rcloran commented Feb 18, 2018

"slightly"...

@iantrich
Copy link

@ruippeixotog does this include the smart wireless switch? https://xiaomi-mi.com/sockets-and-sensors/xiaomi-mi-wireless-switch/

@therve
Copy link

therve commented Jun 8, 2018

Can we close this issue? It seems to work well enough now.

@AndreasBomholtz
Copy link
Contributor

This seams to be fixed in PR #45.

@justin8
Copy link

justin8 commented Jul 19, 2018

I'm not sure if this is fixed yet. From the commit history it looks like this fix is in 0.1.0, which is what's running on my hass.io instance, but I still get the following error when adding a v2 Xiaomi motion sensor:

2018-07-20 09:17:59 INFO (MainThread) [zigpy.application] Device 0x5dc4 (00:15:8d:00:02:25:3c:19) joined the network
2018-07-20 09:17:59 INFO (MainThread) [zigpy.device] [0x5dc4] Discovering endpoints
Tries remaining: 3
2018-07-20 09:17:59 ERROR (MainThread) [bellows.ezsp] Exception running handler
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/bellows/ezsp.py", line 194, in handle_callback
    handler(*args)
  File "/usr/local/lib/python3.6/site-packages/bellows/zigbee/application.py", line 139, in ezsp_callback_handler
    self._handle_frame(*args)
  File "/usr/local/lib/python3.6/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/local/lib/python3.6/site-packages/zigpy/application.py", line 73, in deserialize
    return sender.deserialize(endpoint_id, cluster_id, data)
  File "/usr/local/lib/python3.6/site-packages/zigpy/device.py", line 97, in deserialize
    return self.endpoints[endpoint_id].deserialize(cluster_id, data)
KeyError: 1
2018-07-20 09:17:59 ERROR (MainThread) [bellows.ezsp] Exception running handler
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/bellows/ezsp.py", line 194, in handle_callback
    handler(*args)
  File "/usr/local/lib/python3.6/site-packages/bellows/zigbee/application.py", line 139, in ezsp_callback_handler
    self._handle_frame(*args)
  File "/usr/local/lib/python3.6/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/local/lib/python3.6/site-packages/zigpy/application.py", line 73, in deserialize
    return sender.deserialize(endpoint_id, cluster_id, data)
  File "/usr/local/lib/python3.6/site-packages/zigpy/device.py", line 97, in deserialize
    return self.endpoints[endpoint_id].deserialize(cluster_id, data)
KeyError: 1

Attempting to re-pair the device does show the Device xxx left the network message, followed by a rejoin, then either the above error or sometimes:

2018-07-20 09:26:07 INFO (MainThread) [zigpy.application] Device 0xa96e (00:15:8d:00:02:25:3c:19) joined the network
2018-07-20 09:26:20 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/zha/__init__.py", line 182, in async_device_initialized
    discovered_info = await _discover_endpoint_info(endpoint)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/zha/__init__.py", line 389, in _discover_endpoint_info
    await read(['manufacturer', 'model'])
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/zha/__init__.py", line 385, in read
    allow_cache=True,
  File "/usr/local/lib/python3.6/site-packages/zigpy/zcl/__init__.py", line 209, in read_attributes
    result = await self.read_attributes_raw(to_read, manufacturer=manufacturer)
  File "/usr/local/lib/python3.6/site-packages/zigpy/zcl/__init__.py", line 177, in read_attributes_raw
    v = await self.request(True, 0x00, schema, attributes, manufacturer=manufacturer)
  File "/usr/local/lib/python3.6/site-packages/zigpy/device.py", line 89, in request
    expect_reply=expect_reply,
  File "/usr/local/lib/python3.6/site-packages/bellows/zigbee/application.py", line 244, in request
    v = await asyncio.wait_for(reply_fut, timeout)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 362, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

@therve
Copy link

therve commented Jul 23, 2018

I have the same issue, I opened #61 to track it.

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

7 participants