stormboy / node-zbee Goto Github PK
View Code? Open in Web Editor NEWA NodeJS module for communicating with Zigbee devices using an XBee.
License: GNU Lesser General Public License v3.0
A NodeJS module for communicating with Zigbee devices using an XBee.
License: GNU Lesser General Public License v3.0
reference: http://meshconnect.cel.com/products/usb-sticks/em357-usb-lr
I see that this project is currently in the process of working on integration into thethingsystem (TTS). I have a specific desire to use the referenced hardware as a ZigBee gateway and I wanted to get an informed opinion of whether this is the right project to fork and modify for support. Or perhaps support can be extended to other devices as they come up without a fork? Perhaps this is a better question for TTS? Thank you in advance for your patience as I wrap my head around these projects. Let me know your expert opinion! Thanks!
i'd like to use this excellent package in a project!
and i have a few pull requests…
thanks!
hi. i just pushed an update to the repo for the steward that has the scaffolding you should need. i believe you can focus on the file gateway-zigbee-xstick.js
i think we need to work this in two steps:
step 1: add more scaffolding to that module so that it's ready to make calls to the internal steward APIs saying "i discovered this device" or "this device has updated its parameters"
step 2: i'll write a driver for one of these devices and hook it into the scaffolding. at that point, we can go through the list of devices that you have and i can show you how to do a driver. it's not that complicated.
ok, here's how the gateway-zigbee-xstick.js file works:
the start() function is invoked after the module is loaded. this defines the prototype function for /device/gateway/zigbee/xstick2-zb and then starts a function called scan that runs every 30 seconds.
the scan() function looks for USB devices matching a set of "fingerprints" that correspond to the digi stick. when a new one is found, it call invokes a callback within scan() that calls the internal API to discover a new device (in this case, the stick).
this results in the Gateway() function being new()'d to create an instance of the device driver. first, we have a bunch of instance assignments, then the driver subscribes to the 'actors' channel which is used to convey information about perform requests (among other things). if a perform request comes in for this particular device, then the perform() method is called.
both the validate_perform function and the perform() method are driven by Gateway.operations, an associative array. if the thing to be performed is a 'set', then this is handled internally, with devices.validate_perform, and the super method devices.perform(). otherwise, operations{} indicates how to proceed.
so, that's the scaffolding, now the part i'm clueless on. in the bottom half of the Gateway() function, there is a chained list of self.xstick.on() and self.xstick.zbee.on() handlers. this is where you need to add code that will figure out that zigbee devices are available, what kind of devices they are, and then get ready to invoke the internal API in the steward to create the corresponding instance.
does that make sense?
thanks!
thanks for assembling this package! sorry if some of these questions lack clue.
i am one of the curators of #thethingsystem - http://thethingsystem.com/ - an open source home autonomy server. the primary repo is there: https://github.com/TheThingSystem/steward
our goal is to support as many things as possible. i am now in the process of exploring adding zigbee support. i've got your package with a digi xstick2 zb running on my Mac, RPi, and BBB.
what i now need to do is internalize the design pattern to use for:
when i run app.js on a network with a zigbee smart plug and thermo/hydrometer, this is what i see after i do a reset, configure, allow join from the app.'s window:
% node app.js
info - socket.io started
datastore initialising
Zigbee manager server listening on port 3000
ZBee initialised. Parameters: { panid: '0000000000000000',
id: ' ',
sourceHigh: '0013a200',
sourceLow: '40b663de',
nodeDiscoveryTime: 6000 }
self node: { dec: [ 0, 19, 162, 0, 64, 182, 99, 222 ],
hex: '0013a20040b663de' }
Firmware Version: 21a7
info - handshake authorized rzqTNV4qZGKYYss_35aP
A client socket connected!
received command: reset , data: undefined
--- got zbee watchdogReset
--- got zbee coordinatorStarted
received command: configure , data: undefined
configuring
--- got zbee disassociated
--- got zbee coordinatorStarted
received command: join , data: undefined
joing allowed
Node 00137a0000009a70 discovered
Node 00137a0000009a70 got End Device Announce: { address16: [ 30, 17 ],
address64: [ 0, 19, 122, 0, 0, 0, 154, 112 ],
capability: 128 }
Node 00137a0000009a70 got End Device Announce: { address16: [ 30, 17 ],
address64: [ 0, 19, 122, 0, 0, 0, 154, 112 ],
capability: 128 }
Node 00137a0000009a70: could not locate app for endpoint: 10
Node 00137a0000009a70: could not locate cluster for endpoint: 10, clusterID: 1026 attribute report: {"address64":"00137a0000009a70","endpoint":10,"profileId":260,"clusterId":1026,"attributes":[{"id":0,"type":41,"data":[227,9]}]}
Node 00137a0000009a70: could not locate cluster for endpoint: 10, clusterID: 1029 attribute report: {"address64":"00137a0000009a70","endpoint":10,"profileId":260,"clusterId":1029,"attributes":[{"id":0,"type":33,"data":[162,17]}]}
error getting active endpoints: { msg: 'Never got Transmit status from XBee' }
Node 00137a0000009a70 got End Device Announce: { address16: [ 30, 17 ],
address64: [ 0, 19, 122, 0, 0, 0, 154, 112 ],
capability: 128 }
Node 00137a0000009a70: could not locate cluster for endpoint: 10, clusterID: 1026 attribute report: {"address64":"00137a0000009a70","endpoint":10,"profileId":260,"clusterId":1026,"attributes":[{"id":0,"type":41,"data":[1,10]}]}
Node 00137a0000009a70: could not locate cluster for endpoint: 10, clusterID: 1029 attribute report: {"address64":"00137a0000009a70","endpoint":10,"profileId":260,"clusterId":1029,"attributes":[{"id":0,"type":33,"data":[101,17]}]}
can you give me a hint as to how to interpret this? (i did the reset and the configure just to get a clean slate with the stick, as i've been testing it on multiple devices)
many thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.