Open mrose17 opened 10 years ago
short answer: no. i've got the same stick here, but there isn't any node module that talks to it.
in contrast, the solution that anthony suggests has a node module, so i'm inclined to co-develop in that direction and then go bak to the folks at rasp bee and ask them to provide similar functionality...
Makes sense.
The XStick ZB is the one we need. I need to order one and play around with it - it should basically act in a similar fashion to an XBee plugged in directly to the USB port using an XBee Explorer board. Using the Zigbee frames in the library, we should be able to query all the routers and end nodes attached. I guess we'd have to use some local config file that maps node identifiers to capabilities and then our wrapper would know whether this was a read-only or an interactive device. I haven't delved into the steward enough to see if there is already a mechanism to do that.
Not sure I understand your 2nd point. I was thinking that the XStick would just plug in to the RPi, in the same way as the Aeon ZWave stick does. Why would a new HTTP protocol be needed? My initial thought was to implement the XStick in the same way as the Aeon stick is supported. I was envisaging a ThingSystem wrapper around the openzwave library, but when I looked a the code I couldn't see anything that resembled that. Some sort of general framework that speaks to the Steward and then just has you map to device-specific protocols would seem to be ideal.
Are you envisaging that the XStick would have to run on a separate RPi to the steward?
Let me know how I can help with this. My learning curve is pretty steep since I don't know node.js, haven't yet figured out how the ThingSystem fits together and really don't know any Javascript! But I do know C/C++ ...
Also, if you need some good, practical info on the XBees, take a look at http://www.desert-home.com/. I would think that the owner of that site might be interested in getting involved with The ThingSystem, He's pulled together some interesting stuff to monitor his house in the Arizona desert.
Anthony
with respect to the second point, if my steward is on a BBB or mac or something other than an RPi, i will still want to be able to manage the zigbee stuff in my home, so i'd like to have the RPi "export" the API via REST/JSON to the steward. does that make sense?
i will contact the guru at desert-home to see if there is any interest in advising us … thanks!
Got it. Doesn't the steward already have a REST/JSON API for these types of scenarios? Or is it that the approach is to build something specific for each type of remote gateway or sensor?
in my second scenario, the RPi would not have a steward on it at all. it would just have a REST/JSON server that lets the steward on the BBB (or whatever do things)...
I'm a bit confused about the architecture. Reading the documentation, it seems that there are two ways to do this. 1) implement a TSRP or STP wrapper that sits around the Digi Stick or 2) create a device-specific driver, inheriting from an existing prototype (I assume Gateway would be the most appropriate). I was assuming that (1) is preferred.
What you are suggesting makes sense. If I understand the current ZWave implementation, that is different and requires that the ZWave stick be plugged in to a USB socket on the system on which the steward is running. Is that the case?
i think we will write a piece of code similar to gateway-openzwave-usb.js that will require the xbee-api module. we will then proceed to write a small number of device drivers for whatever zigbee devices that both of us have.
only after all this works, will we worry about doing a rest/json mode…
how does that sound?
Sounds ok. When you say zigbee devices, are you referring to devices like the Z-Stick, or referring to end devices? If the latter, I think we need to think through, unless it has already been done, the approach to enabling commercial devices to plug in and also for "maker" devices to plug in. Some kind of framework that makes that simple would be needed.
I'm going to buy one of the Iris outlets from Lowes that is a Zigbee device and that others have already got working with XBees. We could use that as a commercial device test case. I can also put together an XBee device that reports temperature, for example. And one that you can use to open/close a garage door and report status.
I'll be away for the next week, but can pitch in after that.
by "zigbee devices" i'm referring to end devices…
i like your plan… let me know when you're back. thanks!
@antamy - are we ready to get started?
Yes, I'm back. I'll get a Zigbee stick ordered today from Mouser and will get one of the outlets at the weekend. I am waiting on an XBee-enabled set of relays from China, but with the stick and outlet, should have enough to get moving by the weekend / early next week.
great, let's circle back early next week. thanks!
brief update. xstick2 zb working fine on my pro using https://github.com/stormboy/node-zbee/tree/master/doc -- i'm now checking with the author regarding licensing...
I'm still waiting on my Digi XStick - thought it would be here today. My XBee relay board just arrived and I also got the Iris switch working. I'll see if I can figure out how to get your code installed.
good luck!
Can you give me a clue as to what and how to install this? I'll see if I can get it working on my RPi
here is what i would do for now: first, power down your RPi and then plug the Xstick into the USB slot, then boot it, and ssh to it
pi% wget https://github.com/TheThingSystem/node-zbee/archive/master.zip
pi% unzip master.zip
pi% cd node-zbee
pi% vi config.js # to point to your xstick -- its probably /dev/ttyUSB0
pi% node app.js
this will start a server on port 3000 -- connect to it and click on the "admin" tab -- you can then enable joining, etc. this is as far as i've gotten. i send some questions to the package's author -- https://github.com/stormboy/node-zbee/issues/3 -- and i hope to hear from them soon!
good luck!
ps: if the stick is not at /dev/ttyUSB0, then do this
pi% cd steward/steward
pi% node ../scripts/list-usb.js
and it will tell you where it is!
That worked, except node app.js fails with an error about express. I tried downloading and installing express (npm install -g express) from the steward/steward directory, which seemed to work, but the error still occurs. Is there a particular place from which I should run app.js?
module.js:340 throw err; ^ Error: Cannot find module 'express' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25)
My bad. Go to the directory with app.js and do
npm -l install
Then run app.js
/mtr via iPhone
On Apr 7, 2014, at 13:36, antamy notifications@github.com wrote:
That worked, except node app.js fails with an error about express. I tried downloading and installing express (npm install -g express) from the steward/steward directory, which seemed to work, but the error still occurs. Is there a particular place from which I should run app.js?
module.js:340 throw err; ^ Error: Cannot find module 'express' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25)
— Reply to this email directly or view it on GitHub.
That works. I'll spin up an Xbee and see if I can get that to register.
I was able to discover an XBee, but that's about it. The code is geared for HA profile devices (I don't have any), so I think I will play around with it to get it working with what I have. I spent most of the evening trying to get node.js working on Windows - the serialport component has all sorts of build problems with it, but I finally managed to get it working.
question: how did windows enter the picture? are you running windows on an RPi?
Easier to use Visual Studio for development vs. ssh and vi on the Pi. And xctu runs on Windows so it's easy to check configs and interact with the usb stick without unplugging and replugging it.
-------- Original message -------- From: mrose17 notifications@github.com Date: 2014/04/07 23:52 (GMT-06:00) To: TheThingSystem/steward steward@noreply.github.com Cc: Anthony Roby aroby@antamy.com Subject: Re: [steward] Add Zigbee gateway using RPi and XStick (#186)
question: how did windows enter the picture? are you running windows on an RPi?
— Reply to this email directly or view it on GitHubhttps://github.com/TheThingSystem/steward/issues/186#issuecomment-39811624.
@antamy - just fyi, i'm side-tracked on a couple of things, but hope to be back on this by monday!
ok. I've been playing around some more with it but can't figure out how all the code is working. Since I don't have any Zigbee HA devices, I'm not going to get very far. I started building something from scratch to control my XBee relay board - it should be a lot easier to do since I don't need all the discovery and endpoint code, which is what makes up the bulk of the stormboy code. Once I get that working, I'll have a better understanding of how node.js works, which is completely new to me.
in truth, i think understanding the workings of node.js is the easy part. the hard part is understanding the model or design pattern that the xbee api provides. i pinged the author of that package. if i get a shout back in a day or so, that's great; if not, it's time for me to start digging very deeply...
everything being asynchronous in node.js makes getting to grips with the xbee package difficult. Some kind of visualization tool would be useful to understand that code.
The Xbee part is not that hard. There's just a bunch of terminology to get to grips with (endpoints, clusters etc.) and then building the commands that get sent in API mode. The latest XCTU software has a decent command builder that does that for you.
Do you have a Zigbee HA device that you can connect to? I was toying with the idea of creating an emulator from an XBee and an Arduino
hi. on the node side, i think it's probably useful to be a bit more precise in the terminology: although the internals of node are multi-threaded, from the programmer perspective, node is event-driven not asynchronous. the difference may be subtle but is important: there is a single thread running all the javascript. a well-designed javascript function will not block waiting on i/o (or similar), rather it will start the operation and register a callback to be invoked when the callback completes.
the key thing here is your javascript code doesn't have to worry about state changes while it is running. if there were multiple javascript threads running, then we would have to deal with managing critical sections in javascript to avoid state changes that we care about.
with respect to the zigbee: for me that's much more daunting because i like to read the specs, but they are, err, voluminous… i do have some devices, as soon as i crawl out from two other things, i'll let you know what i'm testing with...
brief status report: https://github.com/stormboy/node-zbee/issues/4
@mrose17 sorry to kick off an old topic. But I was thinking to do the same with the raspbee and you stated this couldnt be done because of node issues. I do not have the normal but the premium version: . The website states : ZigBee firmware integrated, without any restrictions by nodes.
By reading the manual of the premium board. It states:
The included software creates a LAN-ZigBee Gateway using the combination of Raspberry and RaspBee, opening up a further possibility to access dresden elektronik’s comfortable wireless light control system.
Is a gateway the same as an coordinator in Zigbee terminology? Do you still think it can't be done for the raspbee?
hi. i think that the raspbee might be the right platform for this. your first step is to get a coordinator running on it. the next step is to figure out a way of making the coordinator available to another program that would do the device management (e.g., discover devices, get values, set values). good luck!
anthony ruby suggests that we put an XStick on an RPi and then put a server on top of that to provide a simple, relatively inexpensive Zigbee gateway.
let's see if we can make this happen.
anthony - please help me out with a couple of things, so we can jointly work on this!