Giter VIP home page Giter VIP logo

zigbee-shepherd's Introduction

zigbee-shepherd

An open source ZigBee gateway solution with node.js

NPM

Travis branch npm npm


Documentation

Please visit the Wiki.


Overview

zigbee-shepherd is an open source ZigBee gateway solution with node.js. It uses TI's CC253X wireless SoC as a zigbee network processor (ZNP), and takes the ZNP approach with cc-znp to run the CC253X as a coordinator and to run zigbee-shepherd as the host.

ZigBee Network


Installation

  • Install zigbee-shepherd

$ npm install zigbee-shepherd --save

  • Hardware

  • Firmware

    • To use CC2530/31 as the coordinator, please download the pre-built ZNP image to your chip first. The pre-built image has been compiled as a ZNP with ZDO callback, ZCL supports, and functions we need.

Usage

var ZShepherd = require('zigbee-shepherd');
var shepherd = new ZShepherd('/dev/ttyUSB0');  // create a ZigBee server

shepherd.on('ready', function () {
    console.log('Server is ready.');

    // allow devices to join the network within 60 secs
    shepherd.permitJoin(60, function (err) {
        if (err)
            console.log(err);
    }); 
});

shepherd.start(function (err) {                // start the server
    if (err)
        console.log(err);
});

License

Licensed under MIT.

zigbee-shepherd's People

Contributors

baskiers avatar hedywings avatar jackchased avatar jeroenvollenbrock avatar remijn avatar robinbol avatar simenkid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zigbee-shepherd's Issues

WARN Error while starting zigbee-shepherd, attemping to fix... (takes 60 seconds)

Hello,

i get this error when i reboot the pi (zero), i have installed node v8.11.3.
After the install it is working, but when i do a reboot, zigbee2mqtt doesnt start correctly.
I had running zigbee2mqtt for 2 ore 3 days without problems, than it stops working!
I have installed zigbee2mqtt several times, this error comes every time.
Does someone has the same problem?

Dynamic endpoint/profile mapping

Hi all,

I am trying to create a generic fix for #26 which will not require the hardcoded endpoint switch (which will break implementation of other devices). My idea was to map an incoming ZCL: Report Attributes to the correct endpoint at this point in the code: https://github.com/zigbeer/zigbee-shepherd/blob/master/lib/components/af.js#L525. In order to find the correct endpoint on the controller we should be able to read the destination endpoint from the incoming message. I know it is present in the message, see this sniff:

Frame 15990: 48 bytes on wire (384 bits), 48 bytes captured (384 bits) on interface 0
IEEE 802.15.4 Data, Dst: 0x0000, Src: 0xc2c7
ZigBee Network Layer Data, Dst: 0x0000, Src: 0xc2c7
    Frame Control Field: 0x0248, Frame Type: Data, Discover Route: Enable, Security Data
    Destination: 0x0000
    Source: 0xc2c7
    Radius: 30
    Sequence Number: 100
    [Extended Source: SiliconL_ff:fe:23:21:20 (00:0b:57:ff:fe:23:21:20)]
    [Origin: 15422]
    ZigBee Security Header
ZigBee Application Support Layer Data, Dst Endpt: 0, Src Endpt: 1
    Frame Control Field: Data (0x40)
        .... ..00 = Frame Type: Data (0x0)
        .... 00.. = Delivery Mode: Unicast (0x0)
        ..0. .... = Security: False
        .1.. .... = Acknowledgement Request: True
        0... .... = Extended Header: False
    __Destination Endpoint: 0__
    Cluster: Level Control (0x0008)
    Profile: Home Automation (0x0104)
    Source Endpoint: 1
    Counter: 160
ZigBee Cluster Library Frame
    Frame Control Field: Cluster-specific (0x11)
        .... ..01 = Frame Type: Cluster-specific (0x1)
        .... .0.. = Manufacturer Specific: False
        .... 0... = Direction: Server
        ...1 .... = Disable Default Response: True
    Sequence Number: 10
    Command: Stop with OnOff (0x07)

However, it seems that the message does not arrive in zigbee-shepherd land, hence I can not replace the endpoint with the correct one (the mapping). I might miss something here, on what level in the zigbee stack does this incoming message gets assigned to the coordinators endpoint/profile combination?

Is this a viable approach or do you have other ideas?

test if cc2531 is present on uart port

Im using the cc2531 as a coordinator, and would like my application
to find the uart port the cc2531 by scanning all the com ports, and sending out a known
command to determine if its present on a given uart port.

Is this possible, is there a simple command I can send out, to determine if its on a port.
Like a ping... etc.

thanks

Nick,

Crash on message recieved before ready

When a message is received before the coordinator is ready, shepherd crashes with this error

zigbee-shepherd:request RSP <-- SYS:osalNvRead, status: 0 +163ms
zigbee-shepherd:request REQ --> SAPI:readConfiguration +12ms
zigbee-shepherd:request RSP <-- SAPI:readConfiguration, status: 0 +23ms
/Users/nick/Programming/zigbee-shepherd/lib/components/af.js:530
targetEp = af.controller.getCoord().getEndpoint(msg.dstendpoint); // => find local ep
^

TypeError: Cannot read property 'getEndpoint' of null
at dispatchIncomingMsg (/Users/nick/Programming/zigbee-shepherd/lib/components/af.js:530:44)
at Controller.incomingMsgHandler (/Users/nick/Programming/zigbee-shepherd/lib/components/af.js:663:12)
at emitOne (events.js:77:13)
at Controller.emit (events.js:169:7)
at Object.bridge._areqEventBridge (/Users/nick/Programming/zigbee-shepherd/lib/components/event_bridge.js:15:16)
at CcZnp. (/Users/nick/Programming/zigbee-shepherd/lib/components/controller.js:98:16)
at emitOne (events.js:77:13)
at CcZnp.emit (events.js:169:7)
at CcZnp._mtIncomingDataHdlr (/Users/nick/Programming/zigbee-shepherd/node_modules/cc-znp/lib/ccznp.js:367:14)
at /Users/nick/Programming/zigbee-shepherd/node_modules/cc-znp/lib/ccznp.js:333:22
at nextTickCallbackWith0Args (node.js:489:9)
at process._tickCallback (node.js:418:13)

Crash When pairing new device

The Zigbee-Sheperd Library crashes when I attempt to connect a new Smarthings Sensor

Crash log

/opt/user/dev/node_modules/zigbee-shepherd/lib/components/controller.js:550
                self._joinQueue.shift()();
                                       ^

TypeError: self._joinQueue.shift(...) is not a function
    at Immediate._onImmediate (/opt/user/dev/node_modules/zigbee-shepherd/lib/components/controller.js:550:40)
    at processImmediate [as _immediateCallback] (timers.js:396:17)

Failure to connect with some Devices

Hello,

When I try to connect some devices ( it happens with both the SmartThings multisensor and the Xiaomi MI Smart Home wireless switch ) I will recieve this error

  cc-znp:AREQ <-- ZDO:tcDeviceInd, { nwkaddr: 6556, extaddr: '0x00158d0001549d8b', parentaddr: 0 } +13s
  cc-znp:AREQ <-- ZDO:endDeviceAnnceInd, { srcaddr: 6556, nwkaddr: 6556, ieeeaddr: '0x00158d0001549d8b', capabilities: 128 } +364ms
  cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 6556, nwkaddrofinterest: 6556 } +1ms
  cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +10ms
  cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 6556, nwkaddrofinterest: 6556 } +10s
  cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +10ms
Cannot get the Node Descriptor of the Device: 0x00158d0001549d8b
Cannot get the Node Descriptor of the Device: 0x00158d0001549d8b

The Error appears to be caused by a timeout when sending
controller.request('ZDO', 'nodeDescReq', { dstaddr: nwkAddr, nwkaddrofinterest: nwkAddr })

Looking at the code, it appears the device is not responding, however both of these devices have been confirmed as working, and worked flawlessly with their respective hubs

Thank You,

  • Nick Remijn

Examples?

This is really fantastic, was just looking for some kind of library like this.

Do you have any examples of how to add/remove zigbee devices from the network and read values from them?

Removing an offline device

Hello,

I am currently having trouble with removing devices
I need to be able to remove a device from the network, however, if the device is offline, this currently seems impossible

  • Nick Remijn

assert CC2650 launchpad with zigbee-shepherd

hi all,
1.on the CC2538
need build with TC_LINKKEY_JOIN
2.
when i try znp CC2650 launchpad ,(build Coordinator_pro_secure_linkkeyjoin)

that have assert at ccznp.(that have been test by Z-tool)

have any one give me a advice about this? what type to select or other?

at the doc with cc2630 znp, it have multi-type(coord/router and enddevice) and type(secure/linkeyjoin)

ZNP hex files for CC2630/50 are named as follows:

znp_(Coordinator|Router|EndDev)_pro[_secure][_linkkeyjoin].hex

===============================================================================

(Coordinator|Router|EndDev) : This component of the name identifies what type
of ZigBee device functionality this hex file supports.

_pro : Indicates support for Zigbee PRO

[_secure] : If present, this hex file is to be used with ZNP applications that 
use standard ZigBee security where the NWK key is sent in the clear or is 
pre-configured. When using this image, the host processor must register for 
specific ZDO callbacks using the ZDO_MSG_CB_REGISTER API, and will be notified 
of the response via the ZDO_MSG_CB_INCOMING command.

[_linkkeyjoin] : If present, this hex file is to be used with ZNP applications 
that use the Pre-configured Trust Center Link Key method of joining where the 
pre-configured trust center link key is used to encrypt the APS tunnel 
command which contains the NWK key. When using this image, the host processor 
must register for specific ZDO callbacks using the ZDO_MSG_CB_REGISTER API,
and will be notified of the response via the ZDO_MSG_CB_INCOMING command. 

```===============================================================================

sdk:
zstack_home_1_02_02a_4453

  zigbee-shepherd:init Coordinator initialize had an error: Error: rsp error: 2
    at rspHdlr (/home/user/zigbee-shepherd/lib/components/controller.js:273:29)
    at CcZnp.<anonymous> (/home/user/zigbee-shepherd/node_modules/cc-znp/lib/ccznp.js:257:13)
    at CcZnp.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at CcZnp.emit (events.js:188:7)
    at CcZnp._mtIncomingDataHdlr (/home/user/zigbee-shepherd/node_modules/cc-znp/lib/ccznp.js:357:14)
    at /home/user/zigbee-shepherd/node_modules/cc-znp/lib/ccznp.js:333:22
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9) +2ms
shepherd start
Error: Coordinator has not been initialized yet.
    at /home/user/zigbee-shepherd/lib/shepherd.js:248:19
    at _fulfilled (/home/user/zigbee-shepherd/node_modules/q/q.js:854:54)
    at self.promiseDispatch.done (/home/user/zigbee-shepherd/node_modules/q/q.js:883:30)
    at Promise.promise.promiseDispatch (/home/user/zigbee-shepherd/node_modules/q/q.js:816:13)
    at /home/user/zigbee-shepherd/node_modules/q/q.js:570:49
    at runSingle (/home/user/zigbee-shepherd/node_modules/q/q.js:137:13)
    at flush (/home/user/zigbee-shepherd/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
  zigbee-shepherd:msgHdlr IND <-- SYS:resetInd +2m
exit

zigbee-shepherd might be outdated. Please help!

Thank you very much for your dedication into this invaluable library. But as the image below goes, whether your library might not be updated yet or it's my mistake for some reasons, please give me a guide. We are working on a research project about Zigbee and this library really help us if it works.
CaptureError

Determining status after power outage

Whats the best way to determine a powered devices status after a power outage and then power resumes.

Specifically for hue light bulbs.

It would seem that if I do a checkOnline of any devices that I think should be online and let that fire the event if they don't respond then handle the event that is emitted?

The other issue is that when they come back online I don't always see a devIncoming request, it would seem it only is emitted the first time the device comes online after zigbee-shepherd has started.

Any ideas?

devbox allows a device to be added twice

Devbox seems to be using a generated (sequence) ID, this allows for multiple entries with the same ieee address. Wouldn't it be better to use the ieee address as an ID?

This isn't really an issue at the moment, I encountered it in an edge case where some event listeners were bound twice which resulted in duplicate entries for a single device in the devbox when pairing.

how to flash the CC2531

hello zigbee shepherds!

i purchased as CC2531 and tested it using the packet-sniifer tool on windows10 running in a VM on my mac. no issues.

the next step is to flash the CC2531 with the hex file... however, neither of the TI flash programs seem to be able to find the CC2531! (i doubt that the flash programmer 2 even knows about the CC2531).

so, what now? how do i get the "right" firmware onto the CC2531 so i can start doing work with node?

thanks,

/mtr

Crash on incoming message

A message received from a device causes a crash:


  cc-znp:AREQ <-- AF:incomingMsg, { groupid: 0, clusterid: 0, srcaddr: 61485, srcendpoint: 1, dstendpoint: 1, wasbroadcast: 0, linkquality: 73, securityuse: 0, timestamp: 6995389, transseqnumber: 0, len: 29, data: <Buffer 1c 34 12 07 0a 02 ff 4c 06 00 10 01 21 d8 0b 21 a8 13 24 16 00 00 00 00 21 27 02 20 5b> } +3m
/opt/xiaomi-zb2mqtt/node_modules/zcl-packet/lib/foundation.js:645
        ru[dataType](name)(this);
                    ^

TypeError: ru[dataType] is not a function
    at Dissolve.<anonymous> (/opt/xiaomi-zb2mqtt/node_modules/zcl-packet/lib/foundation.js:645:21)
    at Dissolve._transform (/opt/xiaomi-zb2mqtt/node_modules/dissolve/index.js:80:16)
    at Dissolve.Transform._read (/opt/xiaomi-zb2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at Dissolve.Transform._write (/opt/xiaomi-zb2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/opt/xiaomi-zb2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_writable.js:279:12)
    at writeOrBuffer (/opt/xiaomi-zb2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_writable.js:266:5)
    at Dissolve.Writable.write (/opt/xiaomi-zb2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_writable.js:211:11)
    at Dissolve.Writable.end (/opt/xiaomi-zb2mqtt/node_modules/dissolve/node_modules/readable-stream/lib/_stream_writable.js:426:10)
    at FoundPayload._getObj (/opt/xiaomi-zb2mqtt/node_modules/zcl-packet/lib/foundation.js:242:12)
    at FoundPayload.parse (/opt/xiaomi-zb2mqtt/node_modules/zcl-packet/lib/foundation.js:79:18)

how to enable offline installation

Hi,
It seems that npm install zigbee-shepherd using the on-line way. Is there anyway to install off-line installation with the source code

how can i write attributes with IAS Zone device

hi all,
now ,i need write the with ATTRID_SS_IAS_CIE_ADDRESS at SampleFireDetector.
but it don't success and get ,
ep.foundation('ssIasZone', 'write', [ { attrId:16,dataType:'ieeeAddr',attrData:'0x00124b000aff6d05' }], function (err, rsp) {
if (!err)
console.log(rsp);
}

return value, it write 4 time
[ { status: 141, attrId: 16 },
{ status: 134, attrId: 27909 },
{ status: 134, attrId: 10 },
{ status: 134, attrId: 18 } ]

http://i.imgur.com/x3nwkpg.png

as follow ,

2.have any example for CIE(Control and Indicating) on my gateway.
how to use it?
https://github.com/zigbeer/zapp-cie

Using a repeater (router) with the coordinator

I am using a CC2531 with the ZNP firmware and zigbee-shepherd.
I would like to extend the range. What would be the easiest way to do that?

I understand that zigbee is a mesh network and that some devices will forward events/messages across the network.
Can I get another CC2531 and flash with an "repeater" firmware? Should I get some off the market ZHA socket that would do the trick? Once I get this device, is there a special process to link it with the coordinator?

How to receive alarms from a end device?

We are working on a gateway for HA and we'd like to receive alarms message from end device, but I'm missing how to do that on Shepherd.

Is there some way to do that?

Number of devices, adding new, and best ZNP

I'm trying to find some answers about this but there is so much information spread across so many projects so its hard to get good information.

  1. What is the best ZNP to use for this that will enable zigbee 3.0?

  2. How many devices can be directly attached to the coordinator with each chip?
    I can't seem to find any good information on how many devices can be attached to each znp? Is it different depending on the znp? Can the cc2538 support more than the cc2530?

  3. What is the most stable hardware for an industrial network that needs to have very reliable communications?

  4. What is the current state of adding devices through routers on zigbee 3.0?

  5. What is the largest network anyone has been able to create with this software which was still stable?

How to find system path of the serial port

Hi,
I am trying to use a RaspberryPi4 with a CC2531 dongle.
I'm running the example code written in the README file but the serial port path /dev/ttyUSB0 does not exists on my Raspberry.

How can I find the serial port path of the dongle?

Thank you

checkOnline in controller ZMemError

There is a function in controller.js _checkOnline which attempts by way of iteration of the database to determine what devices are online and joined to the network. The node descriptor request in this function always returns 0x10 - 0x11 corresponding to ZMemError & ZBufferFull which ensures the devices are never detected and hence marked as online.

This is using the ZNP build from Zigbeer.

unmount api

It's not currently possible to unmount Zive apps as no API is exposed.

Can be used to replicate the Hue Bridge?

Hi,

I have a project that emulate the hue bridge and can work with different types of lights and sensors. Currently i'm using deconz for zigbee communication but there are some issues with deconz and i want to try also other alternatives. I want to know if this can work with Philips, IKEA and Xiaomi zigbee lighs/sensors.

Thanks,
Marius.

update short adress of a device in database.db if not status 205

Hi,
Regularly end device changes its short network address.

example:
in database.db end device 0x000d6ffffe105635 have short adress 21279
{"type":"Router","ieeeAddr":"0x000d6ffffe105635","nwkAddr":21279

the ZDO_NWK_ADDR_REQ command finds the new short address from the long address but how to update the database.db
cc-znp:AREQ <-- SAPI:findDeviceConfirm, { searchtype: 1, searchkey: 38391, result: '0x000d6ffff
e7c09ed' }
38391 is the new short adress

as long as the database is not updated we have a network error status 205 from zigbee shepherd command
cc-znp:AREQ <-- AF:dataConfirm, { status: 205, endpoint: 1, transid: 1 } +836ms

Thanks for your ideas

how many devices i can mount

hi all,
now , i have been mount my self app*1(custom device id,and cluster,att and cmds) on zigbee-shepherd.
how many devices i can mount ?

*1:
zApp is an instance created by the ZCL framework zive

Compatibility with nRF52840 chip

Hi there,
I would really like to make zigbee-shepherd compatible with nrf52840 802.15.4 chip from Nordic Semiconductor.

I was thinking about starting with something like cc-znp. Would you have any tip to start with?
For instance, do you know if ZBOSS 3.0 used as ZigBee stack is capable of doing something similar to TI-CC253 Z-Stack?

Thank you very much.

Don't get CC2530 working

My CC2531 and CC2530 with baseboard are now delivered. The CC2531 works perfectly, but I do not get the CC2530 to work. If I connect this via the baseboard to the USB of my RPI, I get the following message in the log.

2018-06-29T17:37:07.052Z - info: Starting zigbee2mqtt version 0.0.0 (commit #2b$ 2018-06-29T17:37:07.137Z - info: Starting zigbee-shepherd 2018-06-29T17:37:10.364Z - warn: Error while starting zigbee-shepherd, attempin$ 2018-06-29T17:38:10.408Z - info: Starting zigbee-shepherd 2018-06-29T17:38:13.439Z - error: Error while starting zigbee-shepherd! 2018-06-29T17:38:13.444Z - error: Failed to start Error: request timeout at CcZnp.<anonymous> (/app/node_modules/cc-znp/lib/ccznp.js:254:22) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:116:13) at CcZnp.emit (events.js:211:7) at Timeout.<anonymous> (/app/node_modules/cc-znp/lib/ccznp.js:233:18) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5)

how can i do on device to support link quality request

hi all,
now ,i need the Link Quality Indicator (ZigBee),RSSI or LQI value,
how can i do on device to support link quality request or get rssi from raw data

i try to send .lqi(ieeeAddr, callback) , my device always return not support.
my develop : CC2630,zstack_home_1_02_02a_44539

.lqi(ieeeAddr, callback)
Query the link quality index from a certain device by its ieee address.

Xiaomi Zigbee switches working with zigbee-shepherd

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 #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.

Match Descriptor Request not responded

Hello,
I am working with some devices that sends a Match Descriptor Request to the zigbee-shepherd gateway, however, the gateway does not respond.
Is there any configuration to be in place or the request has to be handled by the developer?
Thank you!

throw new Error('Unrecognized cluster')

Has anyone seen the below issue before? It throws and then restarts the system

Wed, 16 Jan 2019 10:31:32 GMT zigbee-shepherd Device: 0x001e5e09020d60d6 leave the network.
  zigbee2mqtt:debug 2019-1-16 10:31:32 Received zigbee message of type 'devLeaving' with data '"0x001e5e09020d60d6"'
  zigbee2mqtt:warn 2019-1-16 10:31:32 Message without device!
Wed, 16 Jan 2019 10:31:32 GMT zigbee-shepherd:msgHdlr IND <-- ZDO:leaveInd
Wed, 16 Jan 2019 10:32:37 GMT zigbee-shepherd:msgHdlr IND <-- ZDO:tcDeviceInd
Wed, 16 Jan 2019 10:32:38 GMT zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object]
Wed, 16 Jan 2019 10:32:38 GMT zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0
Wed, 16 Jan 2019 10:32:38 GMT zigbee-shepherd spinlock: false []
Wed, 16 Jan 2019 10:32:38 GMT zigbee-shepherd:request REQ --> ZDO:nodeDescReq
Wed, 16 Jan 2019 10:32:38 GMT zigbee-shepherd:msgHdlr IND <-- ZDO:endDeviceAnnceInd
Wed, 16 Jan 2019 10:32:38 GMT zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp
Wed, 16 Jan 2019 10:32:38 GMT zigbee-shepherd:request REQ --> ZDO:activeEpReq
Wed, 16 Jan 2019 10:32:38 GMT zigbee-shepherd:msgHdlr IND <-- ZDO:activeEpRsp
Wed, 16 Jan 2019 10:32:38 GMT zigbee-shepherd:request REQ --> ZDO:simpleDescReq
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:msgHdlr IND <-- ZDO:simpleDescRsp
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:request REQ --> AF:dataRequest, transId: 1
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:request RSP <-- AF:dataRequest, status: 0
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:af dispatchIncomingMsg(): type: dataConfirm, msg: [object Object]
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:msgHdlr IND <-- AF:dataConfirm, transId: 1
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object]
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object]
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd Identified Device: { manufacturer: Computime, product: SAL6EM1 }
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:request REQ --> AF:dataRequest, transId: 2
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:request RSP <-- AF:dataRequest, status: 0
Wed, 16 Jan 2019 10:32:39 GMT zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object]
/zigbee2mqtt-1.0.1/node_modules/zcl-packet/lib/functional.js:27
        throw new Error('Unrecognized cluster');
        ^
Error: Unrecognized cluster
    at new FuncPayload (/zigbee2mqtt-1.0.1/node_modules/zcl-packet/lib/functional.js:27:15)
    at /zigbee2mqtt-1.0.1/node_modules/zcl-packet/lib/zcl.js:33:22
    at Dissolve.<anonymous> (/zigbee2mqtt-1.0.1/node_modules/zcl-packet/lib/zcl.js:121:9)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Dissolve.emit (events.js:211:7)
    at Dissolve.<anonymous> (/zigbee2mqtt-1.0.1/node_modules/dissolve-chunks/index.js:73:29)
    at emitNone (events.js:106:13)
    at Dissolve.emit (events.js:208:7)
    at emitReadable_ (/zigbee2mqtt-1.0.1/node_modules/dissolve/node_modules/readable-stream/lib/_stream_readable.js:456:10)
npm
 
ERR!
 
code
 ELIFECYCLE
npm
 ERR! errno 1
npm
 
ERR!
 [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm
 
ERR!
 A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-01-16T10_32_39_531Z-debug.log
2019-01-16T10:32:40: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
2019-01-16T10:32:40: PM2 log: App [npm:0] starting in -fork mode-
2019-01-16T10:32:40: PM2 log: App [npm:0] online
> [email protected] start /zigbee2mqtt-1.0.1
> node index.js

Error: Unhandled "error" event. (Cannot get the Node Descriptor of the Device

Sometimes Shepherd crashes when I'm trying to add Xiaomi devices: WXKG03LM, WXKG02LM

19
18
17
16
/home/pi/node_modules/q/q.js:155
                throw e;
                ^

Error: Unhandled "error" event. (Cannot get the Node Descriptor of the Device: 0x00158d00015efcef)
    at ZShepherd.emit (events.js:186:19)
    at /home/pi/node_modules/zigbee-shepherd/lib/components/controller.js:609:28
    at _rejected (/home/pi/node_modules/q/q.js:864:24)
    at /home/pi/node_modules/q/q.js:890:30
    at Promise.when (/home/pi/node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (/home/pi/node_modules/q/q.js:808:41)
    at /home/pi/node_modules/q/q.js:624:44
    at runSingle (/home/pi/node_modules/q/q.js:137:13)
    at flush (/home/pi/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)

Are all AREQ's transaction safe?

I think I have found what appears to be a bug. If the simple description is requested multiple times in parallel the request only one request is returned twice (two responses for the same device).

  cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 43688, nwkaddrofinterest: 43688 } +2ms
  serialport write 9 bytes of data +2ms
  zigbee-shepherd:request REQ --> ZDO:nodeDescReq +4ms
  zigbee-shepherd:request REQ --> ZDO:mgmtLqiReq +7ms
  cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +12ms
  cc-znp:SREQ --> ZDO:nodeDescReq, { dstaddr: 39797, nwkaddrofinterest: 39797 } +2ms
  serialport write 9 bytes of data +4ms
  cc-znp:SRSP <-- ZDO:nodeDescReq, { status: 0 } +19ms
  cc-znp:SREQ --> ZDO:mgmtLqiReq, { dstaddr: 39797, scanchannels: undefined, scanduration: undefined, startindex: 0 } +3ms
  serialport write 8 bytes of data +4ms
  cc-znp:SRSP <-- ZDO:mgmtLqiReq, { status: 0 } +26ms
  cc-znp:AREQ <-- ZDO:nodeDescRsp, { srcaddr: 39797, status: 0, nwkaddr: 39797, logicaltype_cmplxdescavai_userdescavai: 2, apsflags_freqband: 64, maccapflags: 132, manufacturercode: 48042, maxbuffersize: 64, maxintransfersize: 0, servermask: 0, maxouttransfersize: 0, descriptorcap: 3 } +2s
  zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp +5ms
  cc-znp:AREQ <-- ZDO:nodeDescRsp, { srcaddr: 39797, status: 0, nwkaddr: 39797, logicaltype_cmplxdescavai_userdescavai: 2, apsflags_freqband: 64, maccapflags: 132, manufacturercode: 48042, maxbuffersize: 64, maxintransfersize: 0, servermask: 0, maxouttransfersize: 0, descriptorcap: 3 } +13ms
  zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp +2ms

Note the ZDO:nodeDescReq, and their ZDO:nodeDescRsp pairs

Device join doesn't always trigger

When trying to connect a new device, endDeviceAnnceInd fires, however it does not always start associating

Steps to reproduce:

  • Turn off a device when it is connecting
  • Try to pair another device

don't trigger 'ind' event

hi all,
when i start permitJoin device, i can see my device have been add PAN network.
but it don't trigger 'ind' event and shepherd.list() return only Coordinator.
could you give me some suggestion with this?

I'm a beginner at full-stack iot development.
how to use the utilizes debug module on windows(win 7 64bit)

hw. cc2531 usb dongle.
fw. cc-znp

Dynamic Secure

To quote TI setting secure dynamically leads to unpredictable results.

There is no way to change at run-time whether or not NWK layer security is on or off - this is a compile-time choice that ends up in zgSecurityMode. Unpredicatible results will ensue from attempting to manually change it. Thus, you either have a SECURE network, or not.

Alternatively, you can have an un-SECURE network and optionally add APS-layer encryption on a packet-by-packet basis by using the AF_EN_SECURITY option when invoking AF_DataRequest().

https://e2e.ti.com/support/wireless_connectivity/zigbee_6lowpan_802-15-4_mac/f/158/t/63803

We found this to be an issue in our quest to upgrade to Z-Stack 3.0 (in progress). It appears that TI are checking for this now and explicitly erroring.

Using CC2531 Hex image as router

Are the Hex images somehow hardcoded to be coordinators? I am trying to use it as a router with ccznp alone. It does work, but at pairing time, there are two problems: 1) the commission command always returns timeout, and 2) the ZNP resets itself right after finding the network and moving ZDO state to 7 (connected), losing the pairing. The workaround is to disconnect the dongle right after ZDO goes to 7, avoiding this reset, so it retains the binding and works well from that point on.

LightLink support

Hello,

I was wondering if it was on the roadmap to implement LightLink, mainly the TouchLink part of the spec

This would allow zigbee-shepherd to control Hue Bulb and various other smart-lights

Thank you,

  • Nick Remijn

CC2531 as a Zigbee Sensor

Say I wanted the CC2531 to function as a (high power) Zigbee Sensor.

Do you know if this be possible?

xiaomi+fhem+zigbee-shepherd dev.db everytime create new after reboot.....

Hey, realy its work great on my brix with ubuntu-16.04.3-server-amd64(LTS) , fhem paired great the "sensors" and they working fine and fast ...till...the moment when i restart my brix, all the sensors are still staying in fhem, but not active anymore,i need to paired again every one(but no option wit 43 devices...),i search the problem, so i see the dev.db is everytime after reboot empty,only first orginal line is there writing. So it seems 2 me that "someone" create the dev.db everytime brand new...for sure withouth paring informations :( . What can be the Problem? I try actualy many now, with user right etc. But the problem dont want go away.Please forgive me all my questins ,iam not so long in touch with linux&zigbee. Also forgive my engl. please.
Best regards,and a nice sunny day!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.