Yoda-x/ha-zha-new

Xiaomi Aqara WXKG02LM

Closed this issue · 10 comments

It is two buttons wirelesses wall switch. Paired successfully. Created 3 entities:

binary_sensor.lumi_lumisensor_86sw2un_0170daa7_1
binary_sensor.lumi_lumisensor_86sw2un_0170daa7_2
binary_sensor.lumi_lumisensor_86sw2un_0170daa7_3

But when pressing buttons I get errors in log:

2019-01-08 21:28:52 DEBUG (MainThread) [zigpy.endpoint] Ignoring unknown cluster ID 0x0006
2019-01-08 21:28:52 WARNING (MainThread) [bellows.zigbee.application] 0x2a0d:2:0x0006 Unexpected response TSN=3 command=266 args=b'\x00\x00\x10\x01\x00\x00\x10\x00'
2019-01-08 21:28:52 WARNING (MainThread) [zigpy.endpoint] [0x2a0d:2] Message on unknown cluster 0x0006

More logs upon pairing:

2019-01-08 21:10:33 INFO (MainThread) [zigpy.endpoint] [0x2a0d:1] Discovered endpoint information: <SimpleDescriptorendpoint=1 profile=260 device_type=24321 device_version=1 input_clusters=[0, 3, 25, 65535, 18] output_clusters=[0, 4, 3, 5, 25, 65535, 18]>
2019-01-08 21:10:33 INFO (MainThread) [zigpy.endpoint] [0x2a0d:2] Discovering endpoint information
2019-01-08 21:10:33 WARNING (MainThread) [bellows.zigbee.application] Unexpected message send notification
2019-01-08 21:10:36 INFO (MainThread) [zigpy.endpoint] [0x2a0d:2] Discovered endpoint information: <SimpleDescriptorendpoint=2 profile=260 device_type=24322 device_version=1 input_clusters=[3, 18] output_clusters=[4, 3, 5, 18]>
2019-01-08 21:10:36 INFO (MainThread) [zigpy.endpoint] [0x2a0d:3] Discovering endpoint information
2019-01-08 21:10:39 INFO (MainThread) [zigpy.endpoint] [0x2a0d:3] Discovered endpoint information: <SimpleDescriptorendpoint=3 profile=260 device_type=24323 device_version=1 input_clusters=[3, 12] output_clusters=[4, 3, 5, 12]>
2019-01-08 21:10:40 DEBUG (MainThread) [custom_components.zha_new] Device initialized: 00:15:8d:00:01:70:da:a7:
2019-01-08 21:10:40 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d] device init for 00:15:8d:00:01:70:da:a7 -> Endpoints: [0, 1, 2, 3]
2019-01-08 21:10:40 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:0] endpoint init
2019-01-08 21:10:40 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:1] endpoint init
2019-01-08 21:10:40 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:1] node config for 00:15:8d:00:01:70:da:a7-1: {}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] discover_endpoint_info:
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] Import DH lumi.sensor_86sw2Un success
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] custom_info for lumi.sensor_86sw2Un: {'module': <module 'custom_components.device.lumi_sensor_86sw2un' from '/config/custom_components/device/lumi_sensor_86sw2un.py'>, '_custom_endpoint_init': <function _custom_endpoint_init at 0x6f45df18>, '_custom_cluster_command': None, '_parse_attribute': <function _parse_attribute at 0x6f45df60>, 'custom_parameters': None}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:1] pre call _custom_endpoint_init: {'module': <module 'custom_components.device.lumi_sensor_86sw2un' from '/config/custom_components/device/lumi_sensor_86sw2un.py'>, '_custom_endpoint_init': <function _custom_endpoint_init at 0x6f45df18>, '_custom_cluster_command': None, '_parse_attribute': <function _parse_attribute at 0x6f45df60>, 'custom_parameters': None}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:1] call _custom_endpoint_init: lumi.sensor_86sw2Un
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:1] node config for 00:15:8d:00:01:70:da:a7-1: {'in_cluster': [0, 6, 18], 'type': 'binary_sensor'}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:1] config reports skipped, already joined00:15:8d:00:01:70:da:a7
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:1] 2:profile 260, component: binary_sensor cluster:[{0, 18, 6}, {768, 1280, 4, 5, 6, 8}]
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:1] Return from component general entity:00:15:8d:00:01:70:da:a7
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:2] endpoint init
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:2] node config for 00:15:8d:00:01:70:da:a7-2: {}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:2] pre call _custom_endpoint_init: {'module': <module 'custom_components.device.lumi_sensor_86sw2un' from '/config/custom_components/device/lumi_sensor_86sw2un.py'>, '_custom_endpoint_init': <function _custom_endpoint_init at 0x6f45df18>, '_custom_cluster_command': None, '_parse_attribute': <function _parse_attribute at 0x6f45df60>, 'custom_parameters': None}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:2] call _custom_endpoint_init: lumi.sensor_86sw2Un
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:2] node config for 00:15:8d:00:01:70:da:a7-2: {'in_cluster': [0, 6, 18], 'type': 'binary_sensor'}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:2] config reports skipped, already joined00:15:8d:00:01:70:da:a7
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:2] 2:profile 260, component: binary_sensor cluster:[{0, 18, 6}, {768, 1280, 4, 5, 6, 8}]
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:2] Return from component general entity:00:15:8d:00:01:70:da:a7
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:3] endpoint init
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:3] node config for 00:15:8d:00:01:70:da:a7-3: {}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:3] pre call _custom_endpoint_init: {'module': <module 'custom_components.device.lumi_sensor_86sw2un' from '/config/custom_components/device/lumi_sensor_86sw2un.py'>, '_custom_endpoint_init': <function _custom_endpoint_init at 0x6f45df18>, '_custom_cluster_command': None, '_parse_attribute': <function _parse_attribute at 0x6f45df60>, 'custom_parameters': None}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:3] call _custom_endpoint_init: lumi.sensor_86sw2Un
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:3] node config for 00:15:8d:00:01:70:da:a7-3: {'in_cluster': [0, 6, 18], 'type': 'binary_sensor'}
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:3] config reports skipped, already joined00:15:8d:00:01:70:da:a7
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:3] 2:profile 260, component: binary_sensor cluster:[{0, 18, 6}, {768, 1280, 4, 5, 6, 8}]
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d:3] Return from component general entity:00:15:8d:00:01:70:da:a7
2019-01-08 21:10:43 DEBUG (MainThread) [custom_components.zha_new] [0x2a0d] Exit device init 00:15:8d:00:01:70:da:a7
2019-01-08 21:10:46 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] write cie:[[<WriteAttributesStatusRecord status=Status.UNSUPPORTED_ATTRIBUTE attrid=16>]]
2019-01-08 21:10:46 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:1] initialize cluster listeners: [4, 5, 0, 18, 1280]
2019-01-08 21:10:50 DEBUG (MainThread) [zigpy.zcl] [0x20be:1:0x0402] ZCL request 0x000a: [[<Attribute attrid=0 value=<zigpy.zcl.foundation.TypeValue object at 0x6cc91690>>]]
2019-01-08 21:10:50 DEBUG (MainThread) [zigpy.zcl] [0x20be:1:0x0402] Attribute report received: 0=2097
2019-01-08 21:10:50 DEBUG (MainThread) [zigpy.zcl] [0x20be:1:0x0405] ZCL request 0x000a: [[<Attribute attrid=0 value=<zigpy.zcl.foundation.TypeValue object at 0x6cc91b30>>]]
2019-01-08 21:10:50 DEBUG (MainThread) [zigpy.zcl] [0x20be:1:0x0405] Attribute report received: 0=2163
2019-01-08 21:10:50 DEBUG (MainThread) [zigpy.zcl] [0x20be:1:0x0403] ZCL request 0x000a: [[<Attribute attrid=0 value=<zigpy.zcl.foundation.TypeValue object at 0x6cc91b30>>, <Attribute attrid=20 value=<zigpy.zcl.foundation.TypeValue object at 0x6cc918f0>>, <Attribute attrid=16 value=<zigpy.zcl.foundation.TypeValue object at 0x6cc91370>>]]
2019-01-08 21:10:50 DEBUG (MainThread) [zigpy.zcl] [0x20be:1:0x0403] Attribute report received: 0=995, 20=-1, 16=9953
2019-01-08 21:10:53 WARNING (MainThread) [homeassistant.components.binary_sensor] Setup of platform zha_new is taking over 10 seconds.
2019-01-08 21:10:53 WARNING (MainThread) [homeassistant.components.binary_sensor] Setup of platform zha_new is taking over 10 seconds.
2019-01-08 21:10:53 WARNING (MainThread) [homeassistant.components.binary_sensor] Setup of platform zha_new is taking over 10 seconds.
2019-01-08 21:11:00 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:1] bind input-cluster 0: [0]
2019-01-08 21:11:04 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:1] bind input-cluster 18: [0]
2019-01-08 21:11:04 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] bind/write cie failed
2019-01-08 21:11:04 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:3] initialize cluster listeners: [4, 5, 1280]
2019-01-08 21:11:07 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:1] bind input-cluster 1280:[0]
2019-01-08 21:11:07 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:1] exit make binary-sensor
2019-01-08 21:11:07 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] set Entity object: <class 'custom_components.binary_sensor.zha_new.BinarySensor'>-00:15:8d:00:01:70:da:a7_1
2019-01-08 21:11:07 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] Return binary_sensor init-cluster {0: <zigpy.zcl.clusters.general.Basic object at 0x70120070>, 3: <zigpy.zcl.clusters.general.Identify object at 0x6cc91c90>, 25: <zigpy.zcl.clusters.general.Ota object at 0x6cc91fd0>, 65535: <zigpy.zcl.clusters.manufacturer_specific.ManufacturerSpecificCluster object at 0x6cc91490>, 18: <zigpy.zcl.clusters.general.MultistateInput object at 0x6cc912d0>, 1280: <zigpy.zcl.clusters.security.IasZone object at 0x70a30870>}
2019-01-08 21:11:11 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] bind/write cie failed
2019-01-08 21:11:11 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:2] initialize cluster listeners: [4, 5, 18, 1280]
2019-01-08 21:11:13 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:2] bind input-cluster 18: [0]
2019-01-08 21:11:16 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:2] bind input-cluster 1280:[0]
2019-01-08 21:11:16 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:2] exit make binary-sensor
2019-01-08 21:11:16 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] set Entity object: <class 'custom_components.binary_sensor.zha_new.BinarySensor'>-00:15:8d:00:01:70:da:a7_2
2019-01-08 21:11:17 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] Return binary_sensor init-cluster {3: <zigpy.zcl.clusters.general.Identify object at 0x700d8530>, 18: <zigpy.zcl.clusters.general.MultistateInput objectat 0x70bf1310>, 1280: <zigpy.zcl.clusters.security.IasZone object at 0x70a30850>}
2019-01-08 21:11:22 ERROR (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:3] bind input-cluster failed TIMEOUT
2019-01-08 21:11:22 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:3] bind input-cluster 1280:[<Status.TIMEOUT: 133>]
2019-01-08 21:11:22 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] [0x2a0d:3] exit make binary-sensor
2019-01-08 21:11:22 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] set Entity object: <class 'custom_components.binary_sensor.zha_new.BinarySensor'>-00:15:8d:00:01:70:da:a7_3
2019-01-08 21:11:22 DEBUG (MainThread) [custom_components.binary_sensor.zha_new] Return binary_sensor init-cluster {3: <zigpy.zcl.clusters.general.Identify object at 0x705c5030>, 12: <zigpy.zcl.clusters.general.AnalogInput object at 0x6cc91590>, 1280: <zigpy.zcl.clusters.security.IasZone object at 0x6cf4f270>}
2019-01-08 21:11:23 DEBUG (MainThread) [zigpy.application] neighbors: []
2019-01-08 21:11:23 DEBUG (MainThread) [zigpy.application] Topology updated

Please try the zha_new/preview branch. It should include the needed changes.
I wanted to merge it with master during the next days.
Thanks

No luck. Here is what I'm getting when I try to re-pair device:

2019-01-08 23:44:57 INFO (MainThread) [custom_components.zha_new] Permitting joins for 60s
2019-01-08 23:44:58 WARNING (MainThread) [bellows.zigbee.application] Unexpected message send notification
2019-01-08 23:44:59 DEBUG (MainThread) [zigpy.endpoint] Ignoring unknown cluster ID 0x0006
2019-01-08 23:44:59 WARNING (MainThread) [bellows.zigbee.application] 0xbc26:1:0x0006 Unexpected response TSN=2 command=266 args=b'\x00\x00\x10\x01\x00\x00\x10\x00'
2019-01-08 23:44:59 WARNING (MainThread) [zigpy.endpoint] [0xbc26:1] Message on unknown cluster 0x0006
2019-01-08 23:45:06 INFO (MainThread) [zigpy.application] Device 0xbc26 (00:15:8d:00:01:70:da:a7) left the network
2019-01-08 23:45:08 INFO (MainThread) [zigpy.application] Device 0xbacf (00:15:8d:00:01:70:da:a7) joined the networkvia 0
2019-01-08 23:45:08 DEBUG (MainThread) [zigpy.application] Device 00:15:8d:00:01:70:da:a7 changed id (0xbc26 => 0xbacf)
2019-01-08 23:45:08 DEBUG (MainThread) [custom_components.zha_new] Device joined: 00:15:8d:00:01:70:da:a7:
2019-01-08 23:45:08 DEBUG (MainThread) [custom_components.zha_new] Device initialized: 00:15:8d:00:01:70:da:a7:
2019-01-08 23:45:08 DEBUG (MainThread) [custom_components.zha_new] [0xbacf] device init for <class 'str'>(lumi.sensor_86sw2Un)(00:15:8d:00:01:70:da:a7) -> Endpoints: [0, 1, 2, 3], new join
2019-01-08 23:45:08 DEBUG (MainThread) [zigpy.zdo] [0xbacf:zdo] ZDO request 0x0013: [47823, 00:15:8d:00:01:70:da:a7,128]
2019-01-08 23:45:08 DEBUG (MainThread) [zigpy.zcl] [0xbacf:1:0x0000] ZCL request 0x000a: [[<Attribute attrid=5 value=<zigpy.zcl.foundation.TypeValue object at 0x6e75f050>>, <Attribute attrid=1 value=<zigpy.zcl.foundation.TypeValue object at 0x6db33230>>]]
2019-01-08 23:45:08 DEBUG (MainThread) [zigpy.zcl] [0xbacf:1:0x0000] Attribute report received: 5=b'lumi.sensor_86sw2', 1=4
2019-01-08 23:45:09 DEBUG (MainThread) [zigpy.zcl] [0xbacf:1:0x0000] ZCL request 0x000a: [[<Attribute attrid=65281 value=<zigpy.zcl.foundation.TypeValue object at 0x6e8d33d0>>]]
2019-01-08 23:45:09 DEBUG (MainThread) [zigpy.zcl] [0xbacf:1:0x0000] Attribute report received: 65281=b'\x01!\xbd\x0b\x03(\x19\x04!\xa8\x01\x05!d\x00\x06$\x01\x00\x00\x00\x00\n!\x00\x00'
2019-01-08 23:45:10 DEBUG (MainThread) [custom_components.zha_new] read attribute: {'model': b'lumi.sensor_86sw2\x00Un'}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] read attribute: {'manufacturer': b'LUMI'}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] manufacturer: type(<class 'bytes'>) b'LUMI'
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] model: type(<class 'bytes'>) b'lumi.sensor_86sw2\x00Un'
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] discover_endpoint_info:
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:0] endpoint init
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:1] endpoint init
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:1] node config for 00:15:8d:00:01:70:da:a7-1: {}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:1] pre call _custom_endpoint_init: {}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:1] no call _custom_endpoint_init: lumi.sensor_86sw2Un
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:1] node config for 00:15:8d:00:01:70:da:a7-1: {}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:1] config reports skipped for 00:15:8d:00:01:70:da:a7, no reports configured
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:1] 2:profile 260, component: None cluster:[set(), set()]
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:2] endpoint init
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:2] node config for 00:15:8d:00:01:70:da:a7-2: {}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:2] pre call _custom_endpoint_init: {}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:2] no call _custom_endpoint_init: lumi.sensor_86sw2Un
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:2] node config for 00:15:8d:00:01:70:da:a7-2: {}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:2] config reports skipped for 00:15:8d:00:01:70:da:a7, no reports configured
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:2] 2:profile 260, component: None cluster:[set(), set()]
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:3] endpoint init
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:3] node config for 00:15:8d:00:01:70:da:a7-3: {}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:3] pre call _custom_endpoint_init: {}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:3] no call _custom_endpoint_init: lumi.sensor_86sw2Un
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:3] node config for 00:15:8d:00:01:70:da:a7-3: {}
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:3] config reports skipped for 00:15:8d:00:01:70:da:a7, no reports configured
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf:3] 2:profile 260, component: None cluster:[set(), set()]
2019-01-08 23:45:13 DEBUG (MainThread) [custom_components.zha_new] [0xbacf] Exit device init 00:15:8d:00:01:70:da:a7

Tried one more time with restart after removing device. Highlighted possible reason:

2019-01-08 23:58:20 INFO (MainThread) [custom_components.zha_new] Permitting joins for 60s
/config/custom_components/zha_new/__init__.py:281: RuntimeWarning: coroutine 'EZSP._command' was never awaited
  await APPLICATION_CONTROLLER.permit(duration)
2019-01-08 23:58:21 WARNING (MainThread) [bellows.zigbee.application] Unexpected message send notification
2019-01-08 23:58:30 INFO (MainThread) [zigpy.application] Device 0xf690 (00:15:8d:00:01:70:da:a7) joined the networkvia 0
2019-01-08 23:58:30 DEBUG (MainThread) [custom_components.zha_new] Device joined: 00:15:8d:00:01:70:da:a7:
2019-01-08 23:58:30 INFO (MainThread) [zigpy.device] [0xf690] [0xf690] Discovering endpoints
2019-01-08 23:58:30 DEBUG (MainThread) [zigpy.zdo] [0xf690:zdo] ZDO request 0x0013: [63120, 00:15:8d:00:01:70:da:a7,128]
2019-01-08 23:58:31 INFO (MainThread) [zigpy.device] [0xf690] [0xf690] Discovered endpoints: [1, 2, 3]
2019-01-08 23:58:31 INFO (MainThread) [zigpy.endpoint] [0xf690:1] Discovering endpoint information
2019-01-08 23:58:34 INFO (MainThread) [zigpy.endpoint] [0xf690:1] Discovered endpoint information: <SimpleDescriptorendpoint=1 profile=260 device_type=24321 device_version=1 input_clusters=[0, 3, 25, 65535, 18] output_clusters=[0, 4, 3, 5, 25, 65535, 18]>
2019-01-08 23:58:34 INFO (MainThread) [zigpy.endpoint] [0xf690:2] Discovering endpoint information
2019-01-08 23:58:38 INFO (MainThread) [zigpy.endpoint] [0xf690:2] Discovered endpoint information: <SimpleDescriptorendpoint=2 profile=260 device_type=24322 device_version=1 input_clusters=[3, 18] output_clusters=[4, 3, 5, 18]>
2019-01-08 23:58:38 INFO (MainThread) [zigpy.endpoint] [0xf690:3] Discovering endpoint information
2019-01-08 23:58:41 INFO (MainThread) [zigpy.endpoint] [0xf690:3] Discovered endpoint information: <SimpleDescriptorendpoint=3 profile=260 device_type=24323 device_version=1 input_clusters=[3, 12] output_clusters=[4, 3, 5, 12]>
2019-01-08 23:58:41 DEBUG (MainThread) [custom_components.zha_new] Device initialized: 00:15:8d:00:01:70:da:a7:
2019-01-08 23:58:41 DEBUG (MainThread) [custom_components.zha_new] [0xf690] device init for <class 'NoneType'>(None)(00:15:8d:00:01:70:da:a7) -> Endpoints: [0, 1, 2, 3], new join
2019-01-08 23:58:44 DEBUG (MainThread) [custom_components.zha_new] read attribute: {'model': b'lumi.sensor_86sw2\x00Un'}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] read attribute: {'manufacturer': b'LUMI'}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] manufacturer: type(<class 'bytes'>) b'LUMI'
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] model: type(<class 'bytes'>) b'lumi.sensor_86sw2\x00Un'
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] discover_endpoint_info:
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:0] endpoint init
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:1] endpoint init
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:1] node config for 00:15:8d:00:01:70:da:a7-1: {}

2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] Import DH lumi.sensor_86sw2Un failed: ("No modulenamed 'custom_components.device.lumi_sensor_86sw2\\x00un'",)

2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:1] pre call _custom_endpoint_init: {}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:1] no call _custom_endpoint_init: lumi.sensor_86sw2Un
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:1] node config for 00:15:8d:00:01:70:da:a7-1: {}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:1] config reports skipped for 00:15:8d:00:01:70:da:a7, no reports configured
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:1] 2:profile 260, component: None cluster:[set(), set()]
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:2] endpoint init
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:2] node config for 00:15:8d:00:01:70:da:a7-2: {}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:2] pre call _custom_endpoint_init: {}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:2] no call _custom_endpoint_init: lumi.sensor_86sw2Un
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:2] node config for 00:15:8d:00:01:70:da:a7-2: {}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:2] config reports skipped for 00:15:8d:00:01:70:da:a7, no reports configured
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:2] 2:profile 260, component: None cluster:[set(), set()]
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:3] endpoint init
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:3] node config for 00:15:8d:00:01:70:da:a7-3: {}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:3] pre call _custom_endpoint_init: {}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:3] no call _custom_endpoint_init: lumi.sensor_86sw2Un
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:3] node config for 00:15:8d:00:01:70:da:a7-3: {}
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:3] config reports skipped for 00:15:8d:00:01:70:da:a7, no reports configured
2019-01-08 23:58:47 DEBUG (MainThread) [custom_components.zha_new] [0xf690:3] 2:profile 260, component: None cluster:[set(), set()]
2019-01-08 23:58:48 DEBUG (MainThread) [custom_components.zha_new] [0xf690] Exit device init 00:15:8d:00:01:70:da:a7

it seems the removal of non-printable characters don't work. Thus the DH file is not found. I thought I fixed this long ago. but I may have missed something. I have the same switch and will test it on my dev system.

Note that you don't need to continuously click a button on it upon device init, like on sensors. It will slow down init process and result in timeout errors.

Hey @Yoda-x, I really want to help, but could you please point me in a right direction? Where to find an implementation of read_attributes function from this line:

result, _ = await endpoint.in_clusters[0].read_attributes(

please update the preview again. it works now for me with the switch.
please remove the device via the services menu and then pair again.
please keep in mind that this device creates events.

                event_data = {
                    'entity_id': entity.entity_id,
                    'channel': "OnOff",
                    'type': 'toggle',
                    'data': int(1),
                }
                entity.hass.bus.fire('click', event_data)

so you need to check for 'click' events

Works now. Perfect! Thanks a lot!