zigbee-shepherd icon indicating copy to clipboard operation
zigbee-shepherd copied to clipboard

Xiaomi Zigbee switches working with zigbee-shepherd

Open AndrewLinden opened this issue 8 years ago • 53 comments

TL;DR Zigbee-shepherd now supports Xiaomi zigbee devices. Here is my zigbee to MQTT bridge based on zigbee-shepherd: https://github.com/AndrewLinden/xiaomi-zb2mqtt

Here is how I got Xiaomi Zigbee switches (WXKG01LM and WXKG02LM) working with zigbee-shepherd:

  1. Flash your CC2531 with CC2531ZNP-Pro-Secure_LinkKeyJoin.hex from here: https://github.com/mtornblad/zstack-1.2.2a.44539/tree/master/CC2531

  2. Xiaomi devices send predetermined attribute reports to coordinator endpoint 1 with profile id 0x0104 (Zigbee Home Automation profile). Zigbee-shepherd at the moment registers the 0x0104 profile to endpoint 2. So to get Xiaomi attribute reports working we need to swap the profile id-s of endpoints 1 and 2 in zigbee-shepherd. That can be done in lib/initializers/init_controller.js on line 64:

        dlgInfos =  [
            { profId: 0x0104, epId: 1 }, { profId: 0x0101, epId: 2 }, { profId: 0x0105, epId: 3 },
            { profId: 0x0107, epId: 4 }, { profId: 0x0108, epId: 5 }, { profId: 0x0109, epId: 6 }
        ];
  1. Pair your switches. The WXKG01LM can be paired when after reseting the switch you keep toggling the reset for some time to prevent the switch to go to sleep mode before pairing process for zigbee-shepherd is complete. When you don't succees at first, simply try again. You can also try this fork https://github.com/HollyAssistTeam/zigbee-shepherd which has some patches to make pairing more forgiving if the new device does not answer.

One must note that when pairing fails it is usually because shepherd fails to interrogate the device about its properties because the switch or sensor goes to sleep. But on the CC2531 ZNP pairing is done instantly when you reset your device https://github.com/zigbeer/zigbee-shepherd/issues/19

Such is the case with WXKG02LM too. This switch has no separate reset button and I could not keep it awake so shepherd would think pairing succeeded. But as the pairing on ZNP succeeds you can simply gather the neccessary info ieeeAddr and nwkAddr from the debug log and carefully craft a entry in lib/database/dev.db yourself. Then shepherd thinks it is paired and happily fires events based on the attribute reports sent by the switch.

AndrewLinden avatar Sep 26 '17 22:09 AndrewLinden

It seems WXKG02LM stays awake by itself after reset. I can see shepherd sending various queries and the switch answering all of them, but still after a while shepherd's join process times out and shepherd exits with an exception (Cannot get the Node Descriptor of the Device). I will try to investigate further.

AndrewLinden avatar Sep 27 '17 08:09 AndrewLinden

It seems joining handling is much better on this fork https://github.com/athombv/zigbee-shepherd. I can't get that fork to run at the moment, but when I copy lib/components/controller.js and lib/components/querie.js from that fork then WXKG02LM joins fine!

I created a fork of zigbee shepherd with the changes https://github.com/AndrewLinden/zigbee-shepherd and a small test script: https://github.com/AndrewLinden/xiaomi-zigbee-test

AndrewLinden avatar Sep 27 '17 09:09 AndrewLinden

Thanks Andrew,

I'm able to pair my Xiaomi door senors with your code.

Any idea how this can be integrated in home assistant?

https://home-assistant.io/components/switch.zigbee/

Any idea how this can work?

/Joerg

jkoenig72 avatar Sep 27 '17 13:09 jkoenig72

Sorry, I don't know anything about Home assistant. I use OpenHab in my house. Currently my plan is to try to make a zb2mqtt bridge for the xiaomi devices. I do not have any previous experience with Node.js, but java is even more alien to me, so I will try to hack something together with zigbee shepherd.

What firmware did you use on cc2531?

AndrewLinden avatar Sep 27 '17 13:09 AndrewLinden

The one you mentioned above. Pairing works. In your nice little test tool I can see the events coming in from the door sensor.

Yes - making a bridge to mqtt seems straight forward.

jkoenig72 avatar Sep 27 '17 14:09 jkoenig72

Sweet 👍 I will try the Aqara Humidity Sensor.

jpbarraca avatar Sep 27 '17 14:09 jpbarraca

@AndrewLinden does this only apply for the Xiaomi Mi devices / onOff reports?

See below example of the Aqara Door sensor:

ZigBee Application Support Layer Data, Dst Endpt: 1, Src Endpt: 1
    Frame Control Field: Data (0x00)
        .... ..00 = Frame Type: Data (0x0)
        .... 00.. = Delivery Mode: Unicast (0x0)
        ..0. .... = Security: False
        .0.. .... = Acknowledgement Request: False
        0... .... = Extended Header: False
    Destination Endpoint: 1
    Cluster: On/Off (0x0006)
    Profile: Home Automation (0x0104)
    Source Endpoint: 1
    Counter: 22

TedTolboom avatar Sep 27 '17 14:09 TedTolboom

Could be, I currently have only the switches WXKG01LM and WXKG02LM. And I only have one cc2531 so I can't sniff data while testing. I need to order more xiaomi things and another cc2351 for sniffing.

AndrewLinden avatar Sep 27 '17 15:09 AndrewLinden

@AndrewLinden made an error filtering the sniffer data; the Aqara door sensor is indeed reporting on end point 1.

With the team of dev's working on the integration of Xiaomi devices in Homey, we might be able to collect the sniffing data to confirm.

TedTolboom avatar Sep 27 '17 15:09 TedTolboom

And here is the first version of the zigbee to MQTT bridge. Supporting WXKG01LM and WXKG02LM at the moment https://github.com/AndrewLinden/xiaomi-zb2mqtt

AndrewLinden avatar Sep 27 '17 16:09 AndrewLinden

:-) great... will try and provide feedback! 👍

jkoenig72 avatar Sep 27 '17 16:09 jkoenig72

The Aqara Temperature and Humidity sensor (the new one) pairs and data data is reported. Full log here https://gist.github.com/jpbarraca/2d094d8068e73fa22c0651c905c537a8

EDIT: It's WSDCGQ11LM

jpbarraca avatar Sep 27 '17 19:09 jpbarraca

Hmmm... strange:

1.) I detected that I can only see my door senor events when I start in debug ... root@pi:~/xiaomi-zigbee-test# DEBUG=* node index.js

I see the following output

38 cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 30348, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 18, securityuse: 0, timestamp: 2115673, transseqnumber: 0, len: 7, data: <Buffer 18 39 0a 00 00 10 00> } +5s zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +2ms 37 36 35 34 33 cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 30348, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 10, securityuse: 0, timestamp: 2131462, transseqnumber: 0, len: 7, data: <Buffer 18 3a 0a 00 00 10 01> } +5s zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +1ms 32

When I use without debug, I can not see any console output from the sensor.

2.) I can only see any any events by using "xiaomi-zigbee-test", when I use "xiaomi-zb2mqtt" even with debug I can not pair or see any events...

Any idea why?

Regards Joerg

jkoenig72 avatar Sep 27 '17 21:09 jkoenig72

Confirm working with Non-Aquara Temp and Humidity sensor.

A really big THANKS!

LeMyst avatar Sep 27 '17 21:09 LeMyst

Code working and made a pull request to the mqtt bridge @AndrewLinden

jpbarraca avatar Sep 27 '17 22:09 jpbarraca

Hi @AndrewLinden, Thank you so much. I also tested with Human Body Sensor(RTCGQ01LM) and Window Detector (MCCGQ01LM) then joins fine.

Hi @Mystou, The Temp./Humid. sensor is WSDCGQ01LM?

jackchased avatar Sep 28 '17 03:09 jackchased

@jackchased Yes the WSDCGQ01LM. AndrewLinden's version works out of the box.

LeMyst avatar Sep 28 '17 17:09 LeMyst

I try to get the Xiaomi Door switches to work... I have issues with pairing those.

root@pi:~# DEBUG=* node server.js zigbee-shepherd:init zigbee-shepherd booting... +0ms cc-znp The serialport /dev/ttyACM1 is opened. +59ms zigbee-shepherd:request REQ --> SYS:osalNvRead +11ms cc-znp:SREQ --> SYS:osalNvRead, { id: 3840, offset: 0, len: 1, value: [ 85 ] } +8ms serialport write 8 bytes of data +27ms cc-znp:SRSP <-- SYS:osalNvRead, { status: 0, len: 1, value: <Buffer 55> } +63ms zigbee-shepherd:response RSP <-- SYS:osalNvRead, status: 0 +4ms zigbee-shepherd:request REQ --> SAPI:readConfiguration +16ms cc-znp:SREQ --> SAPI:readConfiguration, { configid: 131, len: 2, value: [ 97, 26 ] } +2ms serialport write 6 bytes of data +3ms cc-znp:SRSP <-- SAPI:readConfiguration, { status: 0, configid: 131, len: 2, value: <Buffer 61 1a> } +17ms zigbee-shepherd:response RSP <-- SAPI:readConfiguration, status: 0 +2ms zigbee-shepherd:request REQ --> SAPI:readConfiguration +12ms cc-znp:SREQ --> SAPI:readConfiguration, { configid: 132, len: 4, value: [ 0, 8, 0, 0 ] } +0ms serialport write 6 bytes of data +3ms cc-znp:SRSP <-- SAPI:readConfiguration, { status: 0, configid: 132, len: 4, value: <Buffer 00 08 00 00> } +18ms zigbee-shepherd:response RSP <-- SAPI:readConfiguration, status: 0 +1ms zigbee-shepherd:request REQ --> SAPI:readConfiguration +12ms cc-znp:SREQ --> SAPI:readConfiguration, { configid: 98, len: 16, value: [ 1, 3, 5, 7, 9, 11, 13, 15, 0, 2, 4, 6, 8, 10, 12, 13 ] } +1ms serialport write 6 bytes of data +3ms cc-znp:SRSP <-- SAPI:readConfiguration, { status: 0, configid: 98, len: 16, value: <Buffer 01 03 05 07 09 0b 0d 0f 00 02 04 06 08 0a 0c 0d> } +29ms zigbee-shepherd:response RSP <-- SAPI:readConfiguration, status: 0 +1ms zigbee-shepherd:request REQ --> SAPI:readConfiguration +12ms cc-znp:SREQ --> SAPI:readConfiguration, { configid: 99, len: 1, value: [ 0 ] } +1ms serialport write 6 bytes of data +1ms cc-znp:SRSP <-- SAPI:readConfiguration, { status: 0, configid: 99, len: 1, value: <Buffer 00> } +20ms zigbee-shepherd:response RSP <-- SAPI:readConfiguration, status: 0 +1ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +13ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 0 } +1ms serialport write 6 bytes of data +1ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 0, value: <Buffer 09 01 00 08 00 00 0d 00> } +9ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +1ms zigbee-shepherd:init Now the ZNP is a coordinator. +4ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +3ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 0 } +1ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 0, value: <Buffer 09 01 00 08 00 00 0d 00> } +18ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +1ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +2ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 1 } +1ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 1, value: <Buffer 7c 03 eb 09 00 4b 12 00> } +9ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +1ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +4ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 2 } +1ms serialport write 6 bytes of data +1ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 2, value: <Buffer 00 00 eb 09 00 4b 12 00> } +9ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +1ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +8ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 5 } +3ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 5, value: <Buffer 0b 00 eb 09 00 4b 12 00> } +9ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +1ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +1ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 6 } +1ms serialport write 6 bytes of data +1ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 6, value: <Buffer 61 1a eb 09 00 4b 12 00> } +7ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +2ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +2ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 7 } +1ms serialport write 6 bytes of data +1ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 7, value: <Buffer dd dd dd dd dd dd dd dd> } +9ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +0ms zigbee-shepherd:request REQ --> ZDO:nodeDescReq +6ms cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 0, nwkaddrofinterest: 0 } +7ms serialport write 9 bytes of data +3ms cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +11ms cc-znp:AREQ <-- ZDO:nodeDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, logicaltype_cmplxdescavai_userdescavai: 0, apsflags_freqband: 64, maccapflags: 143, manufacturercode: 0, maxbuffersize: 80, maxintransfersize: 160, servermask: 1, maxouttransfersize: 160, descriptorcap: 0 } +10ms zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp +4ms zigbee-shepherd:response RSP <-- ZDO:nodeDescReq, status: 0 +6ms zigbee-shepherd:request REQ --> ZDO:activeEpReq +3ms cc-znp:SREQ --> ZDO:activeEpReq, { dstaddr: 0, nwkaddrofinterest: 0 } +2ms serialport write 9 bytes of data +1ms cc-znp:SRSP <-- ZDO:activeEpReq, { status: 0 } +12ms cc-znp:AREQ <-- ZDO:activeEpRsp, { srcaddr: 0, status: 0, nwkaddr: 0, activeepcount: 6, activeeplist: <Buffer 02 01 06 05 04 03> } +6ms zigbee-shepherd:msgHdlr IND <-- ZDO:activeEpRsp +1ms zigbee-shepherd:response RSP <-- ZDO:activeEpReq, status: 0 +1ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +4ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 1 } +3ms serialport write 10 bytes of data +3ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +13ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 1, profileid: 260, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +15ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +2ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +1ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +2ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 2 } +1ms serialport write 10 bytes of data +2ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +20ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 2, profileid: 257, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +10ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +3ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +1ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +2ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 3 } +1ms serialport write 10 bytes of data +2ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +12ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 3, profileid: 261, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +13ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +2ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +0ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +1ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 4 } +2ms serialport write 10 bytes of data +2ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +11ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 4, profileid: 263, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +9ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +1ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +1ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +2ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 5 } +2ms serialport write 10 bytes of data +2ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +11ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 5, profileid: 264, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +6ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +1ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +2ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +2ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 6 } +1ms serialport write 10 bytes of data +2ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +10ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 6, profileid: 265, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +7ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +2ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +2ms zigbee-shepherd:request REQ --> ZDO:nodeDescReq +8ms cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 0, nwkaddrofinterest: 0 } +1ms serialport write 9 bytes of data +1ms cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +11ms cc-znp:AREQ <-- ZDO:nodeDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, logicaltype_cmplxdescavai_userdescavai: 0, apsflags_freqband: 64, maccapflags: 143, manufacturercode: 0, maxbuffersize: 80, maxintransfersize: 160, servermask: 1, maxouttransfersize: 160, descriptorcap: 0 } +8ms zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp +3ms zigbee-shepherd:response RSP <-- ZDO:nodeDescReq, status: 0 +2ms zigbee-shepherd:request REQ --> ZDO:activeEpReq +2ms cc-znp:SREQ --> ZDO:activeEpReq, { dstaddr: 0, nwkaddrofinterest: 0 } +1ms serialport write 9 bytes of data +2ms cc-znp:SRSP <-- ZDO:activeEpReq, { status: 0 } +10ms cc-znp:AREQ <-- ZDO:activeEpRsp, { srcaddr: 0, status: 0, nwkaddr: 0, activeepcount: 6, activeeplist: <Buffer 02 01 06 05 04 03> } +6ms zigbee-shepherd:msgHdlr IND <-- ZDO:activeEpRsp +2ms zigbee-shepherd:response RSP <-- ZDO:activeEpReq, status: 0 +28ms zigbee-shepherd:request REQ --> ZDO:mgmtPermitJoinReq +5ms cc-znp:SREQ --> ZDO:mgmtPermitJoinReq, { addrmode: 2, dstaddr: 0, duration: 0, tcsignificance: 0 } +2ms serialport write 10 bytes of data +2ms cc-znp:SRSP <-- ZDO:mgmtPermitJoinReq, { status: 0 } +10ms cc-znp:AREQ <-- ZDO:permitJoinInd, { duration: 0 } +5ms zigbee-shepherd:msgHdlr IND <-- ZDO:permitJoinInd +1ms cc-znp:AREQ <-- ZDO:mgmtPermitJoinRsp, { srcaddr: 0, status: 0 } +5ms zigbee-shepherd:msgHdlr IND <-- ZDO:mgmtPermitJoinRsp +0ms zigbee-shepherd:response RSP <-- ZDO:mgmtPermitJoinReq, status: 0 +1ms zigbee-shepherd:init Loading devices from database done. +45ms zigbee-shepherd:init zigbee-shepherd is up and ready. +1ms zigbee-shepherd:init Network information: +0ms zigbee-shepherd:init >> State: Coordinator +0ms zigbee-shepherd:init >> Channel: 11 +0ms zigbee-shepherd:init >> PanId: 0x1a61 +1ms zigbee-shepherd:init >> Nwk Addr: 0 +0ms zigbee-shepherd:init >> Ieee Addr: 0x00124b0009eb037c +0ms zigbee-shepherd:init >> Ext. PanId: 0xdddddddddddddddd +0ms Server is ready. zigbee-shepherd:request REQ --> ZDO:mgmtPermitJoinReq +11ms cc-znp:SREQ --> ZDO:mgmtPermitJoinReq, { addrmode: 15, dstaddr: 65532, duration: 60, tcsignificance: 0 } +2ms serialport write 10 bytes of data +4ms cc-znp:SRSP <-- ZDO:mgmtPermitJoinReq, { status: 0 } +16ms zigbee-shepherd:response RSP <-- ZDO:mgmtPermitJoinReq, status: 0 +1ms 60 cc-znp:AREQ <-- ZDO:permitJoinInd, { duration: 60 } +12ms zigbee-shepherd:msgHdlr IND <-- ZDO:permitJoinInd +0ms cc-znp:AREQ <-- ZDO:mgmtPermitJoinRsp, { srcaddr: 0, status: 0 } +5ms zigbee-shepherd:msgHdlr IND <-- ZDO:mgmtPermitJoinRsp +0ms 59 58 57 56 55 54 53 52 51 50 49 cc-znp:AREQ <-- ZDO:leaveInd, { srcaddr: 15380, extaddr: '0x00158d00013e31d8', request: 0, removechildren: 0, rejoin: 0 } +12s zigbee-shepherd:msgHdlr IND <-- ZDO:leaveInd +5ms 48 47 46 cc-znp:AREQ <-- ZDO:tcDeviceInd, { nwkaddr: 48186, extaddr: '0x00158d00013e31d8', parentaddr: 0 } +3s zigbee-shepherd:msgHdlr IND <-- ZDO:tcDeviceInd +2ms 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 cc-znp:AREQ <-- ZDO:tcDeviceInd, { nwkaddr: 48186, extaddr: '0x00158d00013e31d8', parentaddr: 0 } +20s zigbee-shepherd:msgHdlr IND <-- ZDO:tcDeviceInd +2ms cc-znp:AREQ <-- ZDO:endDeviceAnnceInd, { srcaddr: 48186, nwkaddr: 48186, ieeeaddr: '0x00158d00013e31d8', capabilities: 128 } +345ms spinlock: false [] zigbee-shepherd:request REQ --> ZDO:nodeDescReq +13ms cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 48186, nwkaddrofinterest: 48186 } +3ms serialport write 9 bytes of data +2ms zigbee-shepherd:msgHdlr IND <-- ZDO:endDeviceAnnceInd +3ms cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +15ms cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 0, srcaddr: 48186, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 60, securityuse: 0, timestamp: 10615842, transseqnumber: 0, len: 25, data: <Buffer 18 00 0a 05 00 42 12 6c 75 6d 69 2e 73 65 6e 73 6f 72 5f 6d 61 67 6e 65 74> } +29ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +5ms cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 0, srcaddr: 48186, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 60, securityuse: 0, timestamp: 10615854, transseqnumber: 0, len: 7, data: <Buffer 18 01 0a 01 00 20 0a> } +20ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +2ms cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 0, srcaddr: 48186, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 57, securityuse: 0, timestamp: 10615865, transseqnumber: 0, len: 29, data: <Buffer 1c 34 12 02 0a 02 ff 4c 06 00 10 01 21 ef 0b 21 a8 01 24 00 00 00 00 00 21 ad 00 20 50> } +1ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +2ms 25 24 23 22 21 20 19 18 17 16 zigbee-shepherd:response RSP <-- ZDO:nodeDescReq +10s zigbee-shepherd:request REQ --> ZDO:nodeDescReq +3ms cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 48186, nwkaddrofinterest: 48186 } +2ms serialport write 9 bytes of data +3ms cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +14ms 15 14 13 12 11 10 9 8 7 6 zigbee-shepherd:response RSP <-- ZDO:nodeDescReq +10s /root/node_modules/zigbee-shepherd/node_modules/q/q.js:155 throw e; ^

Error: Uncaught, unspecified "error" event. (Cannot get the Node Descriptor of the Device: 0x00158d00013e31d8) at ZShepherd.emit (events.js:144:17) at /root/node_modules/zigbee-shepherd/lib/components/controller.js:613:28 at _rejected (/root/node_modules/zigbee-shepherd/node_modules/q/q.js:864:24) at /root/node_modules/zigbee-shepherd/node_modules/q/q.js:890:30 at Promise.when (/root/node_modules/zigbee-shepherd/node_modules/q/q.js:1142:31) at Promise.promise.promiseDispatch (/root/node_modules/zigbee-shepherd/node_modules/q/q.js:808:41) at /root/node_modules/zigbee-shepherd/node_modules/q/q.js:624:44 at runSingle (/root/node_modules/zigbee-shepherd/node_modules/q/q.js:137:13) at flush (/root/node_modules/zigbee-shepherd/node_modules/q/q.js:125:13) at nextTickCallbackWith0Args (node.js:489:9) root@pi:~#

jkoenig72 avatar Sep 29 '17 13:09 jkoenig72

The strange thing - I have one sensor that seems to work..

root@pi:~# DEBUG=* node server.js zigbee-shepherd:init zigbee-shepherd booting... +0ms cc-znp The serialport /dev/ttyACM1 is opened. +57ms zigbee-shepherd:request REQ --> SYS:osalNvRead +12ms cc-znp:SREQ --> SYS:osalNvRead, { id: 3840, offset: 0, len: 1, value: [ 85 ] } +7ms serialport write 8 bytes of data +26ms cc-znp:SRSP <-- SYS:osalNvRead, { status: 0, len: 1, value: <Buffer 55> } +73ms zigbee-shepherd:response RSP <-- SYS:osalNvRead, status: 0 +4ms zigbee-shepherd:request REQ --> SAPI:readConfiguration +17ms cc-znp:SREQ --> SAPI:readConfiguration, { configid: 131, len: 2, value: [ 97, 26 ] } +1ms serialport write 6 bytes of data +3ms cc-znp:SRSP <-- SAPI:readConfiguration, { status: 0, configid: 131, len: 2, value: <Buffer 61 1a> } +19ms zigbee-shepherd:response RSP <-- SAPI:readConfiguration, status: 0 +1ms zigbee-shepherd:request REQ --> SAPI:readConfiguration +12ms cc-znp:SREQ --> SAPI:readConfiguration, { configid: 132, len: 4, value: [ 0, 8, 0, 0 ] } +1ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:readConfiguration, { status: 0, configid: 132, len: 4, value: <Buffer 00 08 00 00> } +18ms zigbee-shepherd:response RSP <-- SAPI:readConfiguration, status: 0 +1ms zigbee-shepherd:request REQ --> SAPI:readConfiguration +12ms cc-znp:SREQ --> SAPI:readConfiguration, { configid: 98, len: 16, value: [ 1, 3, 5, 7, 9, 11, 13, 15, 0, 2, 4, 6, 8, 10, 12, 13 ] } +1ms serialport write 6 bytes of data +3ms cc-znp:SRSP <-- SAPI:readConfiguration, { status: 0, configid: 98, len: 16, value: <Buffer 01 03 05 07 09 0b 0d 0f 00 02 04 06 08 0a 0c 0d> } +30ms zigbee-shepherd:response RSP <-- SAPI:readConfiguration, status: 0 +1ms zigbee-shepherd:request REQ --> SAPI:readConfiguration +11ms cc-znp:SREQ --> SAPI:readConfiguration, { configid: 99, len: 1, value: [ 0 ] } +0ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:readConfiguration, { status: 0, configid: 99, len: 1, value: <Buffer 00> } +22ms zigbee-shepherd:response RSP <-- SAPI:readConfiguration, status: 0 +1ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +13ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 0 } +1ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 0, value: <Buffer 09 01 00 08 00 00 0d 00> } +8ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +1ms zigbee-shepherd:init Now the ZNP is a coordinator. +5ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +2ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 0 } +1ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 0, value: <Buffer 09 01 00 08 00 00 0d 00> } +18ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +2ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +2ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 1 } +0ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 1, value: <Buffer 7c 03 eb 09 00 4b 12 00> } +10ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +1ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +3ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 2 } +1ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 2, value: <Buffer 00 00 eb 09 00 4b 12 00> } +8ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +2ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +8ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 5 } +2ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 5, value: <Buffer 0b 00 eb 09 00 4b 12 00> } +10ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +1ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +1ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 6 } +0ms serialport write 6 bytes of data +2ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 6, value: <Buffer 61 1a eb 09 00 4b 12 00> } +7ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +2ms zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +1ms cc-znp:SREQ --> SAPI:getDeviceInfo, { param: 7 } +1ms serialport write 6 bytes of data +1ms cc-znp:SRSP <-- SAPI:getDeviceInfo, { param: 7, value: <Buffer dd dd dd dd dd dd dd dd> } +9ms zigbee-shepherd:response RSP <-- SAPI:getDeviceInfo, status: NaN +1ms zigbee-shepherd:request REQ --> ZDO:nodeDescReq +5ms cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 0, nwkaddrofinterest: 0 } +7ms serialport write 9 bytes of data +3ms cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +12ms cc-znp:AREQ <-- ZDO:nodeDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, logicaltype_cmplxdescavai_userdescavai: 0, apsflags_freqband: 64, maccapflags: 143, manufacturercode: 0, maxbuffersize: 80, maxintransfersize: 160, servermask: 1, maxouttransfersize: 160, descriptorcap: 0 } +10ms zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp +2ms zigbee-shepherd:response RSP <-- ZDO:nodeDescReq, status: 0 +4ms zigbee-shepherd:request REQ --> ZDO:activeEpReq +3ms cc-znp:SREQ --> ZDO:activeEpReq, { dstaddr: 0, nwkaddrofinterest: 0 } +1ms serialport write 9 bytes of data +2ms cc-znp:SRSP <-- ZDO:activeEpReq, { status: 0 } +12ms cc-znp:AREQ <-- ZDO:activeEpRsp, { srcaddr: 0, status: 0, nwkaddr: 0, activeepcount: 6, activeeplist: <Buffer 02 01 06 05 04 03> } +5ms zigbee-shepherd:msgHdlr IND <-- ZDO:activeEpRsp +2ms zigbee-shepherd:response RSP <-- ZDO:activeEpReq, status: 0 +1ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +4ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 1 } +3ms serialport write 10 bytes of data +3ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +13ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 1, profileid: 260, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +14ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +4ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +1ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +1ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 2 } +2ms serialport write 10 bytes of data +4ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +19ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 2, profileid: 257, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +11ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +4ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +1ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +1ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 3 } +2ms serialport write 10 bytes of data +2ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +11ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 3, profileid: 261, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +13ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +1ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +1ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +1ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 4 } +2ms serialport write 10 bytes of data +2ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +11ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 4, profileid: 263, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +10ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +2ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +2ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +1ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 5 } +1ms serialport write 10 bytes of data +2ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +10ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 5, profileid: 264, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +6ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +1ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +1ms zigbee-shepherd:request REQ --> ZDO:simpleDescReq +1ms cc-znp:SREQ --> ZDO:simpleDescReq, { dstaddr: 0, nwkaddrofinterest: 0, endpoint: 6 } +2ms serialport write 10 bytes of data +3ms cc-znp:SRSP <-- ZDO:simpleDescReq, { status: 0 } +10ms cc-znp:AREQ <-- ZDO:simpleDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, len: 8, endpoint: 6, profileid: 265, deviceid: 5, deviceversion: 0, numinclusters: 0, inclusterlist: <Buffer >, numoutclusters: 0, outclusterlist: <Buffer > } +7ms zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp +2ms zigbee-shepherd:response RSP <-- ZDO:simpleDescReq, status: 0 +2ms zigbee-shepherd:request REQ --> ZDO:nodeDescReq +9ms cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 0, nwkaddrofinterest: 0 } +1ms serialport write 9 bytes of data +2ms cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +11ms cc-znp:AREQ <-- ZDO:nodeDescRsp, { srcaddr: 0, status: 0, nwkaddr: 0, logicaltype_cmplxdescavai_userdescavai: 0, apsflags_freqband: 64, maccapflags: 143, manufacturercode: 0, maxbuffersize: 80, maxintransfersize: 160, servermask: 1, maxouttransfersize: 160, descriptorcap: 0 } +7ms zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp +2ms zigbee-shepherd:response RSP <-- ZDO:nodeDescReq, status: 0 +4ms zigbee-shepherd:request REQ --> ZDO:activeEpReq +2ms cc-znp:SREQ --> ZDO:activeEpReq, { dstaddr: 0, nwkaddrofinterest: 0 } +1ms serialport write 9 bytes of data +2ms cc-znp:SRSP <-- ZDO:activeEpReq, { status: 0 } +12ms cc-znp:AREQ <-- ZDO:activeEpRsp, { srcaddr: 0, status: 0, nwkaddr: 0, activeepcount: 6, activeeplist: <Buffer 02 01 06 05 04 03> } +20ms zigbee-shepherd:msgHdlr IND <-- ZDO:activeEpRsp +1ms zigbee-shepherd:response RSP <-- ZDO:activeEpReq, status: 0 +10ms zigbee-shepherd:request REQ --> ZDO:mgmtPermitJoinReq +5ms cc-znp:SREQ --> ZDO:mgmtPermitJoinReq, { addrmode: 2, dstaddr: 0, duration: 0, tcsignificance: 0 } +2ms serialport write 10 bytes of data +1ms cc-znp:SRSP <-- ZDO:mgmtPermitJoinReq, { status: 0 } +10ms cc-znp:AREQ <-- ZDO:mgmtPermitJoinRsp, { srcaddr: 0, status: 0 } +5ms zigbee-shepherd:msgHdlr IND <-- ZDO:mgmtPermitJoinRsp +1ms zigbee-shepherd:response RSP <-- ZDO:mgmtPermitJoinReq, status: 0 +1ms zigbee-shepherd:init Loading devices from database done. +68ms zigbee-shepherd:init zigbee-shepherd is up and ready. +0ms zigbee-shepherd:init Network information: +1ms zigbee-shepherd:init >> State: Coordinator +0ms zigbee-shepherd:init >> Channel: 11 +0ms zigbee-shepherd:init >> PanId: 0x1a61 +0ms zigbee-shepherd:init >> Nwk Addr: 0 +0ms zigbee-shepherd:init >> Ieee Addr: 0x00124b0009eb037c +0ms zigbee-shepherd:init >> Ext. PanId: 0xdddddddddddddddd +0ms zigbee-shepherd:request REQ --> ZDO:nodeDescReq +3ms cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 40748, nwkaddrofinterest: 40748 } +1ms serialport write 9 bytes of data +1ms Server is ready. zigbee-shepherd:request REQ --> ZDO:mgmtPermitJoinReq +10ms cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +4ms cc-znp:SREQ --> ZDO:mgmtPermitJoinReq, { addrmode: 15, dstaddr: 65532, duration: 60, tcsignificance: 0 } +2ms serialport write 10 bytes of data +1ms cc-znp:SRSP <-- ZDO:mgmtPermitJoinReq, { status: 0 } +16ms zigbee-shepherd:response RSP <-- ZDO:mgmtPermitJoinReq, status: 0 +1ms 60 cc-znp:AREQ <-- ZDO:permitJoinInd, { duration: 60 } +10ms zigbee-shepherd:msgHdlr IND <-- ZDO:permitJoinInd +1ms cc-znp:AREQ <-- ZDO:mgmtPermitJoinRsp, { srcaddr: 0, status: 0 } +5ms zigbee-shepherd:msgHdlr IND <-- ZDO:mgmtPermitJoinRsp +0ms cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 40748, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 52, securityuse: 0, timestamp: 11345475, transseqnumber: 0, len: 7, data: <Buffer 18 83 0a 00 00 10 01> } +171ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +46ms attreport: 0x00158d0001a7f543 260 1 { cid: 'genOnOff', data: { onOff: 1 } } cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 40748, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 47, securityuse: 0, timestamp: 11346013, transseqnumber: 0, len: 7, data: <Buffer 18 84 0a 00 00 10 00> } +123ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +9ms attreport: 0x00158d0001a7f543 260 1 { cid: 'genOnOff', data: { onOff: 0 } } 59 cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 40748, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 42, securityuse: 0, timestamp: 11350251, transseqnumber: 0, len: 7, data: <Buffer 18 85 0a 00 00 10 01> } +1s zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +13ms attreport: 0x00158d0001a7f543 260 1 { cid: 'genOnOff', data: { onOff: 1 } } 58 cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 40748, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 63, securityuse: 0, timestamp: 11351495, transseqnumber: 0, len: 7, data: <Buffer 18 86 0a 00 00 10 00> } +384ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +13ms attreport: 0x00158d0001a7f543 260 1 { cid: 'genOnOff', data: { onOff: 0 } } cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 40748, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 63, securityuse: 0, timestamp: 11352170, transseqnumber: 0, len: 7, data: <Buffer 18 87 0a 00 00 10 01> } +203ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +22ms attreport: 0x00158d0001a7f543 260 1 { cid: 'genOnOff', data: { onOff: 1 } } cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 40748, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 60, securityuse: 0, timestamp: 11352999, transseqnumber: 0, len: 7, data: <Buffer 18 88 0a 00 00 10 00> } +261ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +21ms attreport: 0x00158d0001a7f543 260 1 { cid: 'genOnOff', data: { onOff: 0 } } cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 40748, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 52, securityuse: 0, timestamp: 11353689, transseqnumber: 0, len: 7, data: <Buffer 18 89 0a 00 00 10 01> } +190ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +7ms attreport: 0x00158d0001a7f543 260 1 { cid: 'genOnOff', data: { onOff: 1 } } 57 cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 40748, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 55, securityuse: 0, timestamp: 11355897, transseqnumber: 0, len: 7, data: <Buffer 18 8a 0a 00 00 10 00> } +693ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +30ms attreport: 0x00158d0001a7f543 260 1 { cid: 'genOnOff', data: { onOff: 0 } } cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 6, srcaddr: 40748, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 49, securityuse: 0, timestamp: 11356690, transseqnumber: 0, len: 7, data: <Buffer 18 8b 0a 00 00 10 01> } +230ms zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +12ms attreport: 0x00158d0001a7f543 260 1 { cid: 'genOnOff', data: { onOff: 1 } } 56 zigbee-shepherd:request REQ --> ZDO:nodeDescReq +1s cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 40748, nwkaddrofinterest: 40748 } +2ms serialport write 9 bytes of data +3ms cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +14ms 55

How I can get rid of this Error: Uncaught, unspecified "error" event. (Cannot get the Node Descriptor of the Device: 0x00158d00013e31d8)?

jkoenig72 avatar Sep 29 '17 13:09 jkoenig72

Maybe I can add an entry on the dev.db file. Someone can provide insight into the structure of this?

{"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0009eb037c","nwkAddr":0,"manufId":0,"epList":[1,2,3,4,5,6],"status":"online","joinTime":1506687349,"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}}},"_id":"P6tikl7jjEGWTYtu"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001a7f543","nwkAddr":40748,"manufId":4151,"epList":[1],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":260,"epId":1,"devId":260,"inClusterList":[0,3,25,65535],"outClusterList":[0,3,4,5,6,8,25],"clusters":{}}},"_id":"xNllcOoESAzUL8vZ"} {"$$indexCreated":{"fieldName":"id","unique":true,"sparse":false}} {"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0009eb037c","nwkAddr":0,"manufId":0,"epList":[1,2,3,4,5,6],"status":"online","joinTime":1506691298,"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}}},"_id":"P6tikl7jjEGWTYtu"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001a7f543","nwkAddr":40748,"manufId":4151,"epList":[1],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":260,"epId":1,"devId":260,"inClusterList":[0,3,25,65535],"outClusterList":[0,3,4,5,6,8,25],"clusters":{}}},"_id":"xNllcOoESAzUL8vZ"}

jkoenig72 avatar Sep 29 '17 13:09 jkoenig72

So - get it working by editing the dev.db file with the info showing in debug. Seems pairing works with the Xiaomi door sensor, simply the writing to db have some issue.

{"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0009eb037c","nwkAddr":0,"manufId":0,"epList":[1,2,3,4,5,6],"status":"online","joinTime":1506692863,"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}}},"_id":"P6tikl7jjEGWTYtu"} {"id":4,"type":"EndDevice","ieeeAddr":"0x00158d0001123a89","nwkAddr":56373,"manufId":4151,"epList":[1],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":262,"epId":1,"devId":262,"inClusterList":[0,3,25,65535],"outClusterList":[0,3,4,5,6,8,25],"clusters":{}}},"_id":"xNllcOoESAzUL7vZ"} {"id":3,"type":"EndDevice","ieeeAddr":"0x00158d00013e31d8","nwkAddr":39025,"manufId":4151,"epList":[1],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":260,"epId":1,"devId":260,"inClusterList":[0,3,25,65535],"outClusterList":[0,3,4,5,6,8,25],"clusters":{}}},"_id":"xNllcOoESAzUL8vZ"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001a7f543","nwkAddr":40748,"manufId":4151,"epList":[1],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":261,"epId":1,"devId":261,"inClusterList":[0,3,25,65535],"outClusterList":[0,3,4,5,6,8,25],"clusters":{}}},"_id":"xNllcOoESAzUL9vZ"} {"id":5,"type":"EndDevice","ieeeAddr":"0x00158d00016c786b","nwkAddr":15106,"manufId":4151,"epList":[1],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":263,"epId":1,"devId":263,"inClusterList":[0,3,25,65535],"outClusterList":[0,3,4,5,6,8,25],"clusters":{}}},"_id":"xNllcOoESAzUL6vZ"} {"$$indexCreated":{"fieldName":"id","unique":true,"sparse":false}}

jkoenig72 avatar Sep 29 '17 13:09 jkoenig72

Work with Aqara Temp/Humidity/Pressure sensor WSDCGQ11LM

LeMyst avatar Oct 15 '17 12:10 LeMyst

With current master of zigbee-shepherd my Xiaomi Zigbee switches (WXKG01LM and WXKG02LM) seem to pair and work fine.

Only issue is that some devices like WXKG01LM need to be kept awake during the pairing process (until you see message that device has joined the network) by repeatedly short pressing the reset switch. That is probably the issue @jkoenig72 is having.

I switched my zigbee to MQTT bridge (https://github.com/AndrewLinden/xiaomi-zb2mqtt) to use upstream zigbee-shepherd now. I have some more Xiaomi zigbee devices on the way, so soon I can test and add support for more devices.

AndrewLinden avatar Nov 28 '17 11:11 AndrewLinden

Great work guys. No yet tested, but parts are ordered. Looking forward for the support of other devices.

dabont avatar Dec 06 '17 09:12 dabont

First i want to thank a lot for this great project. I am using it with aqara sensors only since a few weeks and I am fully satisfied. Temperature sensors, human body sensors, wireless switches and door sensors, all working fine. 2 weeks back I made an update of node and all modules, after that I saw that permitjoinreq some times, quite often I would say is failing with status 16. It is only not permitting new devices to connect, the allready connected devices are working normally. Does someone know a possible solution? Because now joining new devices is being a horrible step for me. Another off topic question: is there a possibility to get the battery state from aqara sensors? I understood that Xiaomi does not implemented the correct way for this, but I hope that there is a workaround.

radu022003 avatar Dec 07 '17 02:12 radu022003

Possible decoded Xiaomi string with attrId= 65281 (0xFF01): {(uint8)index, (uint8)type, (type)data}, {...},{...},... type from zcl-id-master\definitions\common.json (common.dataType) 0x21 = "uint16": 33, 0x24 = "uint40": 36, 0x29 = "int16": 41, 0x2B = "int32": 43,

luni.weather


	01 21 C7 0B - 3015 BATTERY
	04 21 A8 01 - 424
	05 21 2E 00 - 46
	06 24 01 00 00 00 00   - 1
	64 29 E9 08  - 2281  TEMP
	65 21 32 20 - 8242 HUMIDITY
	66 2B 7C 8A 01 00   100988  PRESSURE
	0A 21 00 00    - 0

   '{"index":1,"data":3015}',
   '{"index":4,"data":424}',
   '{"index":5,"data":46}',
   '{"index":6,"data":[0,1]}',
   '{"index":100,"data":2281}',
   '{"index":101,"data":8242}',
   '{"index":102,"data":100988}',
   '{"index":10,"data":0}' ] }

lumi.plug


{"index":100,"data":1}', [1-On 0-Off] '{"index":3,"data":34}', soc_temperature C ? '{"index":152,"data":166}', POWER '{"index":149,"data":0,11500}', kW/h ???? '{"index":150,"data":2281}', VOLTAGE '{"index":5,"data":30}', '{"index":154,"data":16}', '{"index":8,"data":4886}', '{"index":7,"data":0x000000000000000}', '{"index":9,"data":513}'


simple fix, works for me: zcl-packet-master\lib\foundation.js change 'strPreLenUint8' and add 'xiaoMiStruct'

ru.clause('strPreLenUint8', function (name) {
    parsedBufLen += 1;
    this.uint8('len').tap(function () {		
		var attrId = this.vars['attrId'];
		if (attrId===65281){
			ru['xiaoMiStruct'](name)(this);
			delete this.vars.len;
		}else{
			parsedBufLen += this.vars.len;
			this.string(name, this.vars.len);
			delete this.vars.len;
		}
    });
});

ru.clause('xiaoMiStruct', function (name) {
var stopLen = parsedBufLen+this.vars.len-2;	
	this.tap(function(){
		this.loop('attrData', function (end) {
			parsedBufLen += 2;
			this.uint8('index').uint8('dT').tap(function () {
				ru.variable('data', 'dT')(this);	
			});				
			if (stopLen <= parsedBufLen ) end();                
            }).tap(function () {                
			this.vars.attrData.forEach(function (element) {
				delete element.__proto__;
				delete element.dT;
                });
            });
	});
	
});

tomsktpi avatar Dec 08 '17 08:12 tomsktpi

Im new on this zigbee world, so please, forgive me if my question is already answered but i searched on the web and i found no answer....

You say: "Flash your CC2531 with CC2531ZNP-Pro-Secure_LinkKeyJoin.hex from here: https://github.com/mtornblad/zstack-1.2.2a.44539/tree/master/CC2531"

Anyone know if i buy a cheap usb dongle on aliexpress like this: Link to alliexpress dongle

It would be possible to flash without any other hardware? Or i should buy something else... I plan to use it with a raspberry and domoticz

Thank you!

AlbrtoSam avatar Dec 08 '17 08:12 AlbrtoSam

Hi AlbrtoSam, I use cc-debugger for that

Don forget this cable

Connected picture

tomsktpi avatar Dec 08 '17 08:12 tomsktpi

Tomsktpi thank you so much. Already bought :) Where can i find info about how to flash and how to start?

AlbrtoSam avatar Dec 08 '17 08:12 AlbrtoSam

@tomsktpi nice addition! Looking forward to add this as one of the missing features.

Thanks to the work of @AndrewLinden the majority of Xiaomi Zigbee modules are now supported on the Homey automation platform; using the https://github.com/athombv/zigbee-shepherd branch of the Zigbee shepherd.

Remaining modules are work in progress....

I'm currently working to add support for the Cube; but do notice that this device is reporting 2 attributes within 1 report / communication... only one of the attributes appears to be parsed... See details in: https://github.com/athombv/homey/issues/2019

Do you also experience this issue?

TedTolboom avatar Dec 08 '17 08:12 TedTolboom