-
Notifications
You must be signed in to change notification settings - Fork 87
Home
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.
Here is a demo webapp that shows a simple smart home application built with zigbee-shepherd.
zigbee-shepherd has carried many network managing things for you, i.e., storing(/reloading) connected devices and endpoints records to(/from) the built-in database, permission of device joining, endpoints binding, and indications of device incoming and leaving.
This gateway solution also works well with the ZigBee ZCL application framework - zive to help developers build zigbee application with a real endpoint on the coordinator. With zive, third-parties can independently make their zigbee applications as plugins without knowing of the z-stack behavior. The concept of the plugin is really cool. When you want a zigbee IAS (Intruder Alarm System) application on your gateway, just download the plugin and register it to zigbee-shepherd, and now you have an IAS service at your home in seconds. (I'm now working on a CIE (Control and Indicating Equipment) plugin for the zigbee IAS application.)
zigbee-shepherd provides a nice environment for front-end and back-end web developers to use their familiar language - JavaScript, to build ZigBee applications. With node.js, you can have your own RESTful APIs to bring ZigBee machines to web world, push machines to the cloud, have a great machine database, create an account system, and build any fascinating GUI and dashboard with many cool UI frameworks. With zigbee-shepherd, now web developers can do a lot of IoT things with ZigBee! It brings opportunities for app developers as well as opening another way of implementing IoT applications with ZigBee devices.
Let's do something fun with ZigBee! I hope you enjoy it!
- Install zigbee-shepherd
$ npm install zigbee-shepherd --save
-
Hardware
- SmartRF05EB (with CC2530EM)
- CC2531 USB Stick
- CC2538 (Not tested yet. I don't have the kit.)
- CC2630/CC2650 (Not tested yet. I don't have the kit.)
-
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.
Please visit the Supported Device List
- Start the shepherd
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);
});
- Interact with remote endpoints, here is a quick example:
// find the joined endpoint by its address and endpoint id
var ep = shepherd.find('0x00124b0001ce4beb', 6); // returns undefined if not found
// use foundation command to read attributes from a remote endpoint
ep.foundation('genBasic', 'read', [ { attrId: 3 }, { attrId: 4 } ], function (err, rsp) {
if (!err)
console.log(rsp);
// [
// { attrId: 3, status: 0, dataType: 32, attrData: 0 },
// { attrId: 4, status: 0, dataType: 66, attrData: 'TexasInstruments' }
// ]
});
// or use the shorthand read() method to read a single attribute
ep.read('genBasic', 'manufacturerName', function (err, data) {
if (!err)
console.log(data); // 'TexasInstruments'
});
// use functional command to operate a remote endpoint
ep.functional('genOnOff', 'toggle', {}, function (err, rsp) {
if (!err)
console.log(rsp); // { cmdId: 2, statusCode: 0 }
});
This module provides you with ZShepherd and Endpoint classes.
-
ZShepherd class brings you a ZigBee Server with network managing facilities, i.e., start/stop the Server, permit device joining, find a joined endpoint. This document uses
shepherd
to denote the instance of this class. -
Endpoint is the class for creating a software endpoint to represent the remote or local endpoint at server-side. This document uses
ep
to denote the instance of this class. You can invoke methods on anep
to operate the endpoint.
Exposed by require('zigbee-shepherd')
Create a new instance of the ZShepherd
class. The created instance is a ZigBee gateway that runs with node.js.
Arguments:
-
path
(String): A string that refers to system path of the serial port connecting to your ZNP (CC253X), e.g.,'/dev/ttyUSB0'
. -
opts
(Object): This value-object has three propertiessp
,net
anddbPath
to configure the serial port, zigbee network settings and database file path.-
sp
(Object): An optional object to configure the seiralport. Default is{ baudrate: 115200, rtscts: true }
. -
net
(Object): An object to configure the network settings, and all properties in this object are optional. The descriptions are shown in the following table. -
dbPath
(String): Set database file path, default is__dirname + '/database/dev.db'
.
-
Property | Type | Mandatory | Description | Default value |
---|---|---|---|---|
panId | Number | Optional | Identify the ZigBee PAN. This id should be a value between 0 and 0x3FFF. You can also set it to 0xFFFF to let ZNP choose a random PAN-ID on its own. | 0xFFFF |
channelList | Array | Optional | Pick possible channels for your ZNP to start a PAN with. If only a single channel is given, ZNP will start a PAN with the channel you've picked. | [ 11 ] |
precfgkey | Array | Optional | This is for securing and un-securing packets. It must be an array with 16 uint8 integers. | [ 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0D ] |
precfgkeysEnable | Boolean | Optional | To distribute the security key to all devices in the network or not. | true |
startoptClearState | Boolean | Optional | If this option is set, the device will clear its previous network state. This is typically used during application development. | false |
Returns:
- (Object): shepherd
Examples:
var ZShepherd = require('zigbee-shepherd');
var shepherd = new ZShepherd('/dev/ttyUSB0', {
sp: {
baudrate: 115200,
rtscts: true
},
net: {
panId: 0x1234,
channelList: [ 12, 14 ], // pick CH12 and CH14
precfgkey: [ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f ],
precfgkeysEnable: true
}
});
Connect to the ZNP and start shepherd.
Arguments:
-
callback
(Function):function (err) { }
. Get called whenshepherd
starts.
Returns:
- (Promise): promise
Examples:
// callback style
shepherd.start(function (err) {
if (!err)
console.log('shepherd is now running.');
});
// promise style
shepherd.start().then(function() {
console.log('shepherd is now running.');
}).done();
Disconnect from the ZNP and stop shepherd.
Arguments:
-
callback
(Function):function (err) { }
. Get called whenshepherd
stops.
Returns:
- (Promise): promise
Examples:
shepherd.stop(function (err) {
if (!err)
console.log('shepherd is stopped.');
});
Reset the ZNP.
Arguments:
-
mode
(String | Number): Set to'hard'
or0
to trigger the hardware reset (SoC resets), and set to'soft'
or1
to trigger the software reset (zstack resets). -
callback
(Function):function (err) { }
. Get called when reset completes.
Returns:
- (Promise): promise
Examples:
// hard reset
shepherd.reset(0, function (err) {
if (!err)
console.log('reset successfully.');
});
// soft reset
shepherd.reset('soft', function (err) {
if (!err)
console.log('reset successfully.');
});
Allow or disallow devices to join the network. A permitJoining
event will be fired every tick of countdown (per second) when shepherd
is allowing device to join its network.
Arguments:
-
time
(Number): Time in seconds for shepherd to allow devices to join the network. This property accepts a value ranging from0
to255
. Given with0
can immediately close the admission and given with255
will always allow devices to join in. -
type
(String | Number): Set it to'coord'
or0
to let devices join the network through the coordinator, and set it to'all'
or1
to let devices join the network through the coordinator or routers. The default value is'all'
. -
callback
(Function):function (err) { }
. Get called when permitJoining process starts.
Returns:
- (Promise): promise
Examples:
shepherd.on('permitJoining', function (joinTimeLeft) {
console.log(joinTimeLeft);
});
// default is allow devices to join coordinator or routers
shepherd.permitJoin(60, function (err) {
if (!err)
console.log('ZNP is now allowing devices to join the network for 60 seconds.');
});
// allow devices only to join coordinator
shepherd.permitJoin(60, 'coord');
Returns shepherd information.
Arguments:
- none
Returns:
-
(Object): An object that contains information about the server. Properties in this object are given in the following table.
Property Type Description enabled Boolean Server is up( true
) or down(false
)net Object Network information, { state, channel, panId, extPanId, ieeeAddr, nwkAddr }
startTime Number Unix Time (secs from 1970/1/1) joinTimeLeft Number How many seconds left for allowing devices to join the Network
Examples:
shepherd.info();
/*
{
enabled: true,
net: {
state: 'Coordinator',
channel: 11,
panId: '0x7c71',
extPanId: '0xdddddddddddddddd',
ieeeAddr: '0x00124b0001709887',
nwkAddr: 0,
},
startTime: 1473415541,
joinTimeLeft: 49
}
*/
Mounts a zigbee application zApp
that will be registered to the coordinator as a local endpoint, where zApp
is an instance created by the ZCL framework zive. With zive, all you have to do is to plan your clusters well and zive itself will handle all ZCL messages for you.
Arguments:
-
zApp
(Object): instance of Zive class. -
callback
(Function):function (err, epId) { }
. WhenzApp
mounts to coordinator successfully, shepherd will return you a registered endpoint id. ThisepId
is something that helps shepherd route all messages going to thezApp
.
Returns:
- (Promise): promise
Examples:
var myZbApp = require('./lib/myZbApp.js'); // myZbApp is an instance of Zive
shepherd.mount(myZbApp, function (err, epId) {
if (!err)
console.log(epId); // 12
});
Lists the information of devices managed by shepherd. The argument accepts a single ieee address or an array of ieee addresses, and the output will always be an array of the corresponding records. All device records will be listed out if ieeeAddrs
is not given.
Arguments:
-
ieeeAddrs
(String | String[]): The ieee address(es) of device(s) you'd like to list.
Returns:
- (Array): An array of the devices records. Each record is a data object or
undefined
if device is not found.
Examples:
shepherd.list(); // list all
// [
// {
// type: 'Router',
// ieeeAddr: '0x00124b0001ce4beb',
// nwkAddr: 55688,
// status: 'online',
// joinTime: 1469528238,
// manufId: 0,
// epList: [ 8 ],
// },
// {
// type: 'EndDevice',
// ieeeAddr: '0x00124b0001ce3631',
// nwkAddr: 11698,
// status: 'offline',
// joinTime: 1469528238,
// manufId: 0,
// epList: [ 8 ],
// },
// ...
// ]
shepherd.list('0x00124b0001ce4beb'); // equivalent to shepherd.list([ '0x00124b0001ce4beb' ]);
// [
// {
// type: 'Router',
// ieeeAddr: '0x00124b0001ce4beb',
// nwkAddr: 55688,
// ...
// }
// ]
shepherd.list('no_such_device'); // equivalent to shepherd.list([ 'no_such_device' ]);
// [ undefined ]
shepherd.list( [ '0x00124b0001ce4beb', 'no_such_device', '0x00124b0001ce3631'] );
// [
// {
// type: 'Router',
// ieeeAddr: '0x00124b0001ce4beb',
// nwkAddr: 55688,
// ...
// },
// undefined,
// {
// type: 'EndDevice',
// ieeeAddr: '0x00124b0001ce3631',
// nwkAddr: 11698,
// ...
// }
// ]
Find an endpoint instance by address and endpoint id.
Arguments:
-
addr
(String | Number): Find by ieee address ifaddr
is given with a string, or find by network address if it is given with a number. -
epId
(Number): The endpoint id to find with.
Returns:
- (Object): Returns the found endpoint, otherwise
undefined
.
Examples:
shepherd.find('no_such_ieee_addr', 10); // undefined, find no device by this ieee address
shepherd.find('0x00124b0001ce4beb', 7); // undefined, find no device by this endpoint id
shepherd.find(1244, 10); // undefined, find no device by this network address
shepherd.find(1200, 7); // undefined, find no device by this endpoint id
shepherd.find(1200, 10); // object, the endpoint instance
shepherd.find('0x00124b0001ce4beb', 10); // object, the endpoint instance
Query the link quality index from a certain device by its ieee address.
Arguments:
-
ieeeAddr
(String): Ieee address of the device. -
callback
(Function):function (err, data) { }
. This method returns you the link quality index viadata
. An error occurs if device not found.
Returns:
- (Promise): promise
Examples:
shepherd.lqi('0x00124b0001ce4beb', function (err, data) {
if (!err)
console.log(data);
// [
// {
// ieeeAddr: '0x00124b0001ce3631',
// lqi: 62
// },
// {
// ieeeAddr: '0x00124b00019c2ee9',
// lqi: 70
// }
// ]
});
Remove the device from the network.
Arguments:
-
ieeeAddr
(String): Ieee address of the device. -
cfg
(Object):-
reJoin
(Boolean): Set totrue
if device is allowed for re-joining, otherwisefalse
. Default istrue
. -
rmChildren
(Boolean): Set totrue
will remove all children of this device as well. Default isfalse
.
-
-
callback
(Function):function (err) { }
.
Returns:
- (Promise): promise
Examples:
shepherd.remove('0x00124b0001ce4beb', function (err) {
if (!err)
console.log('Successfully removed!');
});
// remove and ban [TODO: how to unban????]
shepherd.remove('0x00124b0001ce4beb', { reJoin: false },function (err) {
if (!err)
console.log('Successfully removed!');
});
Accept or reject the device join the network. Overridable.
Arguments:
-
devInfo
(Object): An object that contains the ieee address and endpoints of the device.
Property | Type | Description |
---|---|---|
ieeeAddr | String | Ieee address of the device. |
endpoints | Object[] | An array of the endpoint instance. |
-
callback
(Function):function (err, accepted) {}
, the callback you should call and pass theaccepted
(Boolean) to it.
Returns:
- none
Examples:
shepherd.acceptDevIncoming = function (devInfo, callback) {
if (devInfo.ieeeAddr === '0x00124b0001ce4beb')
callback(null, false);
else
callback(null, true);
};
Listener: function () { }
Fired when Server is ready.
Listener: function (err) { }
Fired when there is an error occurs.
Listener: function (joinTimeLeft) {}
Fired when the Server is allowing for devices to join the network, where joinTimeLeft
is number of seconds left to allow devices to join the network. This event will be triggered at each tick of countdown (per second).
Listener: function (msg) { }
Fired when there is an incoming indication message. The msg
is an object with the properties given in the table:
Property | Type | Description |
---|---|---|
type | String | Indication type, can be 'devIncoming' , 'devLeaving' , 'devChange' , 'devStatus' , and 'attReport' . |
endpoints | Object[] | Number[] | An array of the endpoint instance, except that when type === 'devLeaving' , endpoints will be an array of the endpoint id (since endpoints have been removed) |
data | Depends | Data along with the indication, which depends on the type of indication |
-
Fired when there is a ZigBee Device incoming to the network.
- msg.type:
'devIncoming'
- msg.endpoints:
[ ep, ... ]
- msg.data:
'0x00124b0001ce4beb'
, the ieee address of which device is incoming.
{ type: 'devIncoming', endpoints: [ ep_instance, ep_instance ], data: '0x00124b0001ce4beb' }
- msg.type:
-
Fired when there is a ZigBee Device leaving the network.
- msg.type:
'devLeaving'
- msg.endpoints:
[ epId, ... ]
, the endpoint id of which endpoint is leaving - msg.data:
'0x00124b0001ce4beb'
, the ieee address of which device is leaving.
{ type: 'devLeaving', endpoints: [ epId, epId ], data: '0x00124b0001ce4beb' }
- msg.type:
-
Fired when the Server perceives any changes of Attributes from ZCL foundation/functional responses.
- msg.type:
'devChange'
- msg.endpoints:
[ep]
- msg.data: Content of the changes. This object has fields of
cid
anddata
.
{ type: 'devChange', endpoints: [ ep_instance ], data: { cid: 'genOnOff', data: { onOff: 1 } } }
- msg.type:
-
Fired when there is a ZigBee Device going online or going offline.
- msg.type:
'devStatus'
- msg.endpoints:
[ ep, ... ]
- msg.data:
'online'
or'offline'
{ type: 'devStatus', endpoints: [ ep_instance, ep_instance ], data: 'online' }
- msg.type:
-
Fired when the ZigBee Device report attributes.
- msg.type:
'attReport'
- msg.endpoints:
[ep]
- msg.data: Content of the report. This object has fields of
cid
anddata
.
{ type: 'attReport', endpoints: [ ep_instance ], data: { cid: 'msTemperatureMeasurement', data: { measuredValue: 2515 } } }
- msg.type:
This class provides you with methods to operate the remote endpoints or local endpoints. An instance of this class is denoted as ep
in this document.
Returns the simple descriptor of the endpoint.
Arguments:
- none
Returns:
- (Object): An object that contains information about the endpoint. Fields in this object are given in the following table.
Property | Type | Description |
---|---|---|
profId | Number | Profile id for this endpoint |
epId | Number | Endpoint id |
devId | Number | Device description id for this endpoint |
inClusterList | Array | List of input cluster Ids |
outClusterList | Array | List of output cluster Ids |
Examples:
var ep = shepherd.find('0x00124b0001ce4beb', 8);
ep.getSimpleDesc();
// {
// profId: 260,
// epId: 8,
// devId: 0,
// inClusterList: [ 0, 3 ],
// outClusterList: [ 3, 6 ]
// }
Returns ieee address of the device holding this endpoint.
Arguments:
- none
Returns:
- (String): Ieee address of the device.
Examples:
ep1.getIeeeAddr(); // '0x00124b0001ce4beb'
ep2.getIeeeAddr(); // '0x00124b0001ce3631'
Returns network address of the device holding this endpoint.
Arguments:
- none
Returns:
- (Number): Network address of the device.
Examples:
ep1.getNwkAddr(); // 55688
ep2.getNwkAddr(); // 11698
Send ZCL foundation command to this endpoint. Response will be passed through second argument of the callback.
Arguments:
-
cId
(String | Number): Cluster id, i.e.'genBasic'
,0
,'genOnOff'
,6
. -
cmd
(String | Number): ZCL foundation command id, i.e.'read'
,0
,'discover'
,12
. -
zclData
(Object | Array): zclData, which depends on the specified command. -
cfg
(Object):-
manufSpec
(Number): Tells if this is a manufacturer-specific command. Default is0
. -
disDefaultRsp
(Number): Disable default response. Default is0
to enable the default response.
-
-
callback
(Function):function (err, rsp) { }
. Please refer to Payload in foundation command table to learn more about thersp
object.
Returns:
- (Promise): promise
Examples:
ep.foundation('genBasic', 'read', [ { attrId: 3 }, { attrId: 4 } ], function (err, rsp) {
if (!err)
console.log(rsp);
// [
// {
// attrId: 3, // hwVersion
// status: 0, // success
// dataType: 32, // uint8
// attrData: 0
// },
// {
// attrId: 4, // manufacturerName
// status: 0, // success
// dataType: 66, // charStr
// attrData: 'TexasInstruments'
// }
// ]
});
Send ZCL functional command to this endpoint. The response will be passed to the second argument of the callback.
Arguments:
-
cId
(String | Number): Cluster id. -
cmd
(String | Number): Functional command id. -
zclData
(Object | Array): zclData depending on the given command. -
cfg
(Object):-
manufSpec
(Number): Tells if this is a manufacturer-specific command. Default is0
. -
disDefaultRsp
(Number): Disable default response. Default is0
to enable the default response.
-
-
callback
(Function):function (err, rsp) { }
. Please refer to Arguments in functional command table to learn more about the functional commandrsp
object.
Returns:
- (Promise): promise
Examples:
ep.functional('genOnOff', 'toggle', {}, function (err, rsp) {
if (!err)
console.log(rsp);
// This example receives a 'defaultRsp'
// {
// cmdId: 2,
// statusCode: 0
// }
});
The shorthand to read a single attribute.
Arguments:
-
cId
(String | Number): Cluster id. -
attrId
(String | Number): Attribute id of which attribute you like to read. -
callback
(Function):function (err, data) { }
. Thisdata
is the attribute value.
Returns:
- (Promise): promise
Examples:
ep.read('genBasic', 'manufacturerName', function (err, data) {
if (!err)
console.log(data); // 'TexasInstruments'
});
The shorthand to write a single attribute.
Arguments:
-
cId
(String | Number): Cluster id. -
attrId
(String | Number): Attribute id of which attribute you like to write. -
data
(String | Number): Depends on the type of attribute. -
callback
(Function):function (err, data) { }
. Thisdata
is the attribute value.
Returns:
- (Promise): promise
Examples:
ep.write('genBasic', 'locationDesc', 'office', function (err, data) {
if (!err)
console.log(data); // 'office'
});
Bind this endpoint to the other endpoint or to a group with the specified cluster.
Arguments:
-
cId
(String | Number): Cluster id. -
dstEpOrGrpId
(Object | Number): Bind this endpoint to the other endpoint ifdstEpOrGrpId
is given with an instance of the Endpoint class, or bind this endpoint to a group if it is given with a numeric id. -
callback
(Function):function (err) { }
. An error will occur if binding fails.
Returns:
- (Promise): promise
Examples:
var ep1 = shepherd.find('0x00124b0001ce4beb', 8);
var ep2 = shepherd.find('0x00124b00014a7dd2', 12);
// bind ep1 to ep2
ep1.bind('genOnOff', ep2, function (err) {
if (!err)
console.log('Successfully bind ep1 to ep2!');
});
ep1.bind('genOnOff', 3, function (err) {
if (!err)
console.log('Successfully bind ep1 to group of id 3.');
});
Unbind this endpoint from the other endpoint or from a group with the specified cluster.
Arguments:
-
cId
(String | Number): Cluster id. -
dstEpOrGrpId
(Object | Number): Unbind with endpoint ifdstEpOrGrpId
is given with an instance of the Endpoint class , or unbind this endpoint from a group if it is given with a numeric id. -
callback
(Function):function (err) { }
. An error will occur if unbinding fails.
Returns:
- (Promise): promise
Examples:
ep1.unbind('genOnOff', ep2, function (err) {
if (!err)
console.log('Successfully unbind ep1 from ep2!');
});
ep1.unbind('genOnOff', 3, function (err) {
if (!err)
console.log('Successfully unbind ep1 from group of id 3.');
});
Set the report configuration of the attribute to endpoint.
Arguments:
-
cId
(String | Number): Cluster id. -
attrId
(String | Number): Attribute id of which attribute you like to report. -
minInt
(Number): The minimum reporting interval, in seconds. -
maxInt
(Number): The maximum reporting interval, in seconds. -
repChange
(Number): Reportable change. The attribute should report its value when the value is changed more than this setting. If attributes with analog data type this argument is mandatory. -
callback
(Function):function (err) { }
. An error will occur if configure reporting fails.
Returns:
- (Promise): promise
Examples:
ep1.report('msTemperatureMeasurement', 'measuredValue', 3, 5, 100, function (err) {
if (!err)
console.log('Successfully configure ep1 report temperature attribute!');
});
Dump the endpoint record.
Arguments:
- none
Returns:
- (Object): A data object, which is the endpoint record.
Property | Type | Description |
---|---|---|
profId | Number | Profile id for this endpoint |
epId | Number | Endpoint id |
devId | Number | Device description id for this endpoint |
inClusterList | Array | List of input cluster Ids |
outClusterList | Array | List of output cluster Ids |
clusters | Object | Clusters information |
Examples:
ep.dump();
// {
// profId: 260,
// epId: 8,
// devId: 0,
// inClusterList: [ 0, 3 ],
// outClusterList: [ 3, 6 ],
// clusters: {
// genBasic: {
// dir: { value: 1 }, // in Cluster
// attrs: {
// hwVersion: 0,
// manufacturerName: 'TexasInstruments',
// modelId: 'TI0001 ',
// dateCode: '20060831 ',
// powerSource: 1,
// locationDesc: ' ',
// physicalEnv: 0,
// deviceEnabled: 1
// }
// },
// genIdentify: {
// dir: { value: 3 }, // in and out Cluster
// attrs: {
// identifyTime: 0
// }
// },
// genOnOff:{
// dir: { value: 2 }, // out Cluster
// attrs: {
// onOff: 0
// }
// }
// }
// }
Like many node.js modules do, zigbee-shepherd utilizes debug module to print out messages that may help in debugging. The namespaces include zigbee-shepherd
, zigbee-shepherd:init
, zigbee-shepherd:request
, and zigbee-shepherd:msgHdlr
. The zigbee-shepherd:request
logs requests that shepherd sends to ZNP, and zigbee-shepherd:msgHdlr
logs the indications that comes from endpoints.
If you like to print the debug messages, run your app.js with the DEBUG environment variable:
$ DEBUG=zigbee-shepherd* app.js # use wildcard to print all zigbee-shepherd messages
$ DEBUG=zigbee-shepherd:msgHdlr app.js # if you are only interested in zigbee-shepherd:msgHdlr messages
Example:
jack@ubuntu:~/zigbeer/zigbee-shepherd$ DEBUG=zigbee-shepherd* node server.js
zigbee-shepherd:init zigbee-shepherd booting... +0ms
...
zigbee-shepherd:init Start the ZNP as a coordinator... +1ms
zigbee-shepherd:request REQ --> ZDO:startupFromApp +0ms
zigbee-shepherd:msgHdlr IND <-- ZDO:stateChangeInd +839ms
zigbee-shepherd:init Now the ZNP is a coordinator. +1ms
zigbee-shepherd:request REQ --> SAPI:getDeviceInfo +2ms
zigbee-shepherd:request RSP <-- SAPI:getDeviceInfo +25ms
...
zigbee-shepherd:request REQ --> ZDO:nodeDescReq +0ms
zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp +28ms
zigbee-shepherd:request REQ --> ZDO:activeEpReq +1ms
zigbee-shepherd:msgHdlr IND <-- ZDO:activeEpRsp +19ms
zigbee-shepherd:request REQ --> ZDO:mgmtPermitJoinReq +1ms
zigbee-shepherd:msgHdlr IND <-- ZDO:permitJoinInd +23ms
zigbee-shepherd:msgHdlr IND <-- ZDO:mgmtPermitJoinRsp +0ms
zigbee-shepherd:init Loading devices from database done. +59ms
zigbee-shepherd:init zigbee-shepherd is up and ready. +1ms
...
zigbee-shepherd:request REQ --> AF:dataRequest, transId: 1 +12ms
zigbee-shepherd:request RSP <-- AF:dataRequest, status: 0 +20ms
zigbee-shepherd:msgHdlr IND <-- AF:dataConfirm, transId: 1 +24ms
zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +40ms
- APIs
- Events
- APIs
Appendix