openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.69k forks source link

XBee/Zigbee Binding #1057

Closed zachariahyoung closed 8 years ago

zachariahyoung commented 10 years ago

Vision: I would like to create a new XBee/Zigbee binding for openhab.

Problem: Currently I have a simple magnetic reed switches for detecting when my garage door is open or closed. A Xbee remote is connected to this reed switch which reports the status of open or closed. Then a xbee coordinator that's connected to my Raspberry Pi processes the serial port communication via a Nodejs script. The script in the nodejs application will report the status via websocket to a webpages that display the status.

Instead of using nodejs to process the serial port I would like openhab to process the feed and be able to apply business rules based on the garage door status.

Proposed Solution: Create binding that will process serial port then convert the feed into something than can be process. Also multiple remotes should have different binding setups.

kaikreuzer commented 10 years ago

I would like this binding to not be specific for XBee, but to support other ZigBee dongles as well. As written in #388: "I suggest any other interested developer to base his work on zb4osgi." -> following this approach, we should end up with a very generic ZigBee binding with a good coverage of the ZigBee specs including the HA profile.

zachariahyoung commented 10 years ago

That's what I had in mind.

zachariahyoung commented 10 years ago

Kai,

Are you confident that zb4o is the right direction for openHab and Zigbee?

The reason I'm asking is because I have done a little research on zb4o and I'm not sure it's mature enough, but maybe you have more insight.

I tried to setup the zigbee.tester that's included in the source and was not able to get it to read my zigbee that I attached to my local PC. The mailing list I reviewed for support doesn't seem to have a lot of activity, which was my first red flag. The other item was they are only supporting two devices at this point. One is CC2531 from TI dongle. My gut tells me that we might have issues with this approach.

If you think we should continue, I can start digging a bit deeper. Maybe I should be looking at it differently. I have done a lot of java development, but not much in osgi space.

kismet commented 10 years ago

Hi zachariahyoung,

I'm one of the Founder ZB4O and among the most contributor of the ZB4O codebase, the project is used at the moent in real scenario in some European and National research projects, moreover there are community user that are using it for their private needs, of course it is not a product but I think that it reached at least a beta maturity level.

I agree that we have limited support of the hardware device side, at the moment we support only dongle compatible with TI Z-Stack (http://www.ti.com/tool/z-stack); in particular we tested in our laboratory the CC2531EMK ( http://www.ti.com/tool/cc2531emk ), Open2530 (http://www.wvshare.com/product/Open2530.htm), EZ430-RF2480 ( http://www.ti.com/tool/ez430-rf2480 ) , SmartRF05+CC2530EM (http://www.ti.com/tool/cc2530zdk). ZB4O has found no people intersted in creating a driver for the XBee hardware but it should be easy considering that ZB4O defines a plugin system for drivers so that people can develop their own. At the moment there is student that is working on the creation of a driver for the ZigBee Gateway specification (https://docs.zigbee.org/zigbee-docs/dcn/09-5465.pdf), which will enable the support of many chips thanks to the contribution of Telecom Italia to the ZB4O. In fact, Telecom Italia provided the implementation of the ZigBee Gateway for many chip vendor (Ember, Texas Instruments, and others).

Finally I can tell you that we are still actively working both on maintenance and improving ZB4O, and the low traffic on the mailing-list is only related to community size, because if you look at the mailing-list archive (http://zb4osgi.aaloa.org/pipermail/dev/) , you can notice that everyone received an answer to his/her email the same day or the day after at most.

Please let me know if you have more doubts on ZB4O, I will be glad to help you out!

Ciao, Stefano

zachariahyoung commented 10 years ago

@kismet Why is it that nobody is interested in XBee? The reason I'm asking is because maybe I should be focus on a different path. I see a lot of Z Wave but not much on ZigBee. It appears that this project has a European influence and that might be one reason. I'm really indifferent.

At this point all I have is two XBee devices and would like to understand the work required to get that working on openHAB. If I have enough support I'm open to using ZB4O. I will have alot of questions but I'm happy to learn.

kaikreuzer commented 10 years ago

It appears that this project has a European influence and that might be one reason.

This is actually no reason at all for the Z-Wave focus - actually Z-Wave was driven by our users in New Zealand and the US.

I think the biggest problem of Zigbee is that there is not that much interesting hardware available on the market than it is the case for other protocols.

kismet commented 10 years ago

@zachariahyoung let me clarify some points ZB4O works with any ZigBee network, the only issue is that it requires device for sending / receiving ZigBee packet (let's call it ZIC : ZigBee Interface Controller ). At the current stage ZB4O doesn't support XBee as ZIC. So, in your case you have two option:

Option A The simplest solution would be to create ZigBee network with any number of XBee device, then connect a CC2531EMK to your PC and connect to the same network ZigBee network with ZB4O, at this point you will be able to control both the XBee devices.

Option B You develop a ZIC for the XBee device, that you connect the XBee device to your PC and the you can use ZB4O for controlling the XBee device. This solution is more complex but it will add support to XBee to the ZB4O suite and it will be a benefit for the ZB4O comunity

If I have enough support I'm open to using ZB4O. I will have alot of questions but I'm happy to learn.

@zachariahyoung You can find some information on ZB4O mailing-list, and I think that it is the best place for asking for help

@kaikreuzer

I think the biggest problem of Zigbee is that there is not that much interesting hardware available on the market than it is the case for other protocols.

Unfortunately ZigBee device are not common like Bluetooth, but it is interesting that Philips Hue is using ZigBee

zachariahyoung commented 10 years ago

@kismet The only issue I have with using the CC2531EMK is the range and maybe cost. I'm needing to support temperature sensors in multiple green houses. Unless I'm missing something, I don't see how I can add an antenna to this device. Some of the XBees I have been reviewing have a range up to a mile or more.

@kaikreuzer Is adding XBee to openHab the right place? Just asking because it might be better in a M2M osgi container instead like Kura. I'm asking to understand, and see if there are other options available. Also in the end I might have hundreds of sensors and would like to be able to scale this osgi container if needed.

The other interesting thing is the Nest devices has a Zigbee device included also. I also found these devices could be used for more than just home automation. libelium.com

I think Option B is the direction we should take. So which should happen first?

Also thank you both for answering my questions.

This is just one of my sensors I created. Mostly based on this book http://www.amazon.com/Building-Wireless-Sensor-Networks-Processing/dp/0596807732 1398295602252

img_20130514_214151

Eric77777 commented 10 years ago

I am also interested in an XBee binding as it would likely be compatible with the Ciseco SRF modules that I am implementing in my own system.

abisval commented 10 years ago

XBee WiFi can help in this case?

sniporbob commented 10 years ago

I just want to add that I am also very interested in someone creating an XBee/zigbee binding. I am planning to wiring up everything in the house to run off of microcontrollers and xbees, and I already have a benchtop test setup working to simulate toggling lights on and off. The only part missing is a way to communicate between openhab and the XBees. The serial binding is insufficient because I cannot for the life of me figure out how to parse a string in the openhab rules engine, and I can't get the old xbee binding for openhab 1.3 to compile.

sniporbob commented 10 years ago

So for those interested, and because nobody has yet finished the ZB4O XBee/Zigbee binding, in my fork I managed to get the XBee binding mentioned in #388 to work with openhab 1.6.0. Since I don't know how to program Java, I ended up having to replace the nrjavaserial included in openhab with a fork located at NeuronRobotics/nrjavaserial. This had to be done because openhab's version finalizes RXTXPort, but the XBee binding extends the RXTXPort class. NeuronRobotics' fork doesn't finalize RXTXPort.

kaikreuzer commented 10 years ago

Can you elaborate on the "finalize" part at bit? Note that openHAB is actually using NeuronRobotics/nrjavaserial as well. If I check their code, I see that the Android version still has the finalized class, see https://github.com/NeuronRobotics/nrjavaserial/blob/master/NRAndroidSerial/src/gnu/io/RXTXPort.java. Did we maybe package the wrong version or are still on an outdated one?

sniporbob commented 10 years ago

On https://code.google.com/p/openhab/issues/detail?id=388 the last comment mentions how XBeeSerialConnector extends RXTXPort, and that RXTXPort became a final class sometime after the binding was written. I was not aware which nrjavaserial openhab was using, but assumed it was still using a version which finalized RXTXPort. Thanks for verifying what nrjavaserial openhab is using! Browsing NeuronRobotics/nrjavaserial I noticed that the non-android version does not finalize RXTXPort. I therefore followed the instructions in that repository's README about building the jar file (the instructions in the README are for building this one: https://github.com/NeuronRobotics/nrjavaserial/tree/master/nrjavaserial). I replaced openhab's nrjavaserial with the resulting nrjavaserial.

Note that I was lazy and renamed the resulting nrjavaserial to nrjavaserial-3.8.8.jar so that I didn't have to go track down where in openhab it specified 3.8.8. The nrjavaserial I built is a more recent version number. I should probably go fix that and name things the right way in my fork....

I have no idea if this breaks other features of openhab. I haven't had a chance to do much testing yet. I assume making this change breaks openhab on Android, but I don't really have a way to check.

kaikreuzer commented 10 years ago

So do you mean that what is available as a released jar at https://github.com/NeuronRobotics/nrjavaserial/releases is not what you have now built manually? In any case, I think we could soon upgrade to a newer version (3.9.3?) for the openHAB runtime. Would you want to test if the "official" 3.9.3 works for your situation?

sniporbob commented 10 years ago

It looks like the one I built is named version 3.9.2. I'd be happy to give the official 3.9.3 a test and report back whether or not it works with the partially complete xbee binding.

sniporbob commented 10 years ago

I believe the release version of nrjavaserial-3.9.3 does indeed work with the xbee binding. I still cannot for the life of me figure out how to actually implement the xbee binding as an item, but I can see data sent by another xbee being received by openhab in the terminal when running start_debug.bat so at least openhab is getting the data.

EDIT: Figured it out. It's working great. I can successfully transmit to openhab the fact that a switch has been toggled on/off.

egeste commented 10 years ago

Has there been any movement on this issue?

edit My interest in this thread is to support the new GE Link lightbulbs, which use Zigbee

byndhorizon commented 10 years ago

eager to see zigbee binding enabled in openhab. Any update here or schedule?

yasharrashedi commented 10 years ago

I'm looking for zigbee binding too.

abisval commented 10 years ago

I got this working with xbee

http://technomindshare.blogspot.in/2014/04/interfacing-xbee-with-openhab.html

Warm Regards Abhilash S Valath

On Sun, Oct 12, 2014 at 11:53 AM, yasharrashedi notifications@github.com wrote:

I'm looking for zigbee binding too.

— Reply to this email directly or view it on GitHub https://github.com/openhab/openhab/issues/1057#issuecomment-58775077.

cdjackson commented 9 years ago

Is anyone currently working on this? If not I might try and take a look as ive got a bunch of zigbee stuff coming, but if someone is already working on this please let me know so we can join forces.

kaikreuzer commented 9 years ago

If nobody is working on this yet, it might make sense to go for openHAB 2 directly... @cdjackson Are you sure that you want to start with zigbee after having all the work with zwave already...?

cdjackson commented 9 years ago

:)

If someone is working on this then id be very happy not to do anything myself. But on the other hand I have some zigbee stuff coming that id like to get running at some stage, so if there isnt any movement then I will probably have a look at it. 

The zb4o looks good so id be hopeful that something could be put together reasonably quickly (but I might be wrong of course!). 

Sent from Samsung Mobile

pravinw commented 9 years ago

Hi Kai, I am working on a zigbee for legrand dongle. I can take up a zigbee standard as well. If no one is working on it. Kind regards Pravin Wadekar

Sent from my Windows Phone


From: Kai Kreuzermailto:notifications@github.com Sent: ‎2/‎2/‎2015 9:07 PM To: openhab/openhabmailto:openhab@noreply.github.com Subject: Re: [openhab] XBee/Zigbee Binding (#1057)

If nobody is working on this yet, it might make sense to go for openHAB 2 directly... @cdjackson Are you sure that you want to start with zigbee after having all the work with zwave already...?


Reply to this email directly or view it on GitHub: https://github.com/openhab/openhab/issues/1057#issuecomment-72477384

kaikreuzer commented 9 years ago

Thanks for the offer Pravin! Do you have any deeper background on ZigBee? Are you e.g. already familiar with the zb4o library?

cdjackson commented 9 years ago

Hi Pravin, Do you have a repo that I can take a look at? It would be great to get something going that we could easily add support for multiple ‘dongles’ (or whatever interface - I personally will likely use an Ethernet adaptor). The ZB4O looked like it was possible to add different interfaces…

Do you have an idea of timescale?

Cheers Chris=

pravinw commented 9 years ago

Hi Kai I do have understanding of zigbee but not of zb4o library. I can take a look at it to see if I can get a hang of it. Should I ? Kind regards Pravin

Sent from my Windows Phone


From: Kai Kreuzermailto:notifications@github.com Sent: ‎2/‎3/‎2015 3:56 AM To: openhab/openhabmailto:openhab@noreply.github.com Cc: pravinwmailto:pravinw@hotmail.com Subject: Re: [openhab] XBee/Zigbee Binding (#1057)

Thanks for the offer Pravin! Do you have any deeper background on ZigBee? Are you e.g. already familiar with the zb4o library?


Reply to this email directly or view it on GitHub: https://github.com/openhab/openhab/issues/1057#issuecomment-72551861

pravinw commented 9 years ago

Hi Chris, I am done coding for all the functionality part of it. Tested it in a live scenario as well need to implement scenario controller interface and a management interface. Let me access and a let you know the time or days to reach done done. Kind regards Pravin

Sent from my Windows Phone


From: Chris Jacksonmailto:notifications@github.com Sent: ‎2/‎3/‎2015 4:25 AM To: openhab/openhabmailto:openhab@noreply.github.com Cc: pravinwmailto:pravinw@hotmail.com Subject: Re: [openhab] XBee/Zigbee Binding (#1057)

Hi Pravin, Do you have a repo that I can take a look at? It would be great to get something going that we could easily add support for multiple ‘dongles’ (or whatever interface - I personally will likely use an Ethernet adaptor). The ZB4O looked like it was possible to add different interfaces…

Do you have an idea of timescale?

Cheers Chris=


Reply to this email directly or view it on GitHub: https://github.com/openhab/openhab/issues/1057#issuecomment-72556574

kaikreuzer commented 9 years ago

Should I ?

Well, if you are already done with the coding, there is probably no sense in doing so. I was rather expecting that reusing some existing library might make the life much easier as ZigBee is a very complex protocol. What features did you implement? Do you cover ZCLs, different profiles, commissioning etc.?

cdjackson commented 9 years ago

I am done coding for all the functionality part of it. Tested it in a live scenario as well need to implement scenario controller interface and a management interface. Let me access and a let you know the time or days to reach done done.

Hi Pravine, I’m not sure that I understand what you mean by this, but my questions are similar to Kai - what profiles are you supporting, and how is the interface to the hardware done? It seems that unlike zwave where there is a common interface to all dongles, this isn’t the case for zigbee, so this needs to be separated out to allow it to be extended…

If you’ve already coded a lot of the Zigbee standards and profiles though, that sounds great and I’d be happy to help with testing. I’ve got a bunch of zigbee devices coming in a few days, so it would be great to be able to play with them :)

Cheers Chris=

pravinw commented 9 years ago

Hi , I have implemented legrands ZigBee they have masked zigBee cluster implementation details. But while implementing legrand dongle support I did go through zigbee spec. I had thought of starting with plain zigbee implementation anyway. But let me know if someone else is already on it. I have started exploring SIA DC-09 for implementation need. Kind regards Pravin

Sent from my Windows Phone


From: Kai Kreuzermailto:notifications@github.com Sent: ‎2/‎3/‎2015 4:52 AM To: openhab/openhabmailto:openhab@noreply.github.com Cc: pravinwmailto:pravinw@hotmail.com Subject: Re: [openhab] XBee/Zigbee Binding (#1057)

Should I ?

Well, if you are already done with the coding, there is probably no sense in doing so. I was rather expecting that reusing some existing library might make the life much easier as ZigBee is a very complex protocol. What features did you implement? Do you cover ZCLs, different profiles, commissioning etc.?


Reply to this email directly or view it on GitHub: https://github.com/openhab/openhab/issues/1057#issuecomment-72560467

cdjackson commented 9 years ago

Hi Pravin, Do you have a link to your binding source? I’m interested in trying to get my devices working when they arrive (hopefully in a few days now) so would be interested to take a look at your code so see if I can use it to get the HA profile up and running with my devices, and possibly help with implementation if you’re already supporting HA…

It’s a little unclear to me quite what you’ve implemented - I’m not familiar with the Legrand stuff - I found their website, but it didn’t have much information as to how it is working. What profiles are implemented at the moment? Is this a full zigbee stack, or does the Legrand system provide an abstract interface?

Cheers Chris

pravinw commented 9 years ago

Hi Chris, I will share a zipped code to you. It's not a complete stack but is a legrands abstraction. But I feel we should have complete zigbee stack implementation in the platform.

Kind regards Pravin

Sent from my Windows Phone


From: Chris Jacksonmailto:notifications@github.com Sent: ‎2/‎4/‎2015 2:31 AM To: openhab/openhabmailto:openhab@noreply.github.com Cc: pravinwmailto:pravinw@hotmail.com Subject: Re: [openhab] XBee/Zigbee Binding (#1057)

Hi Pravin, Do you have a link to your binding source? I’m interested in trying to get my devices working when they arrive (hopefully in a few days now) so would be interested to take a look at your code so see if I can use it to get the HA profile up and running with my devices, and possibly help with implementation if you’re already supporting HA…

It’s a little unclear to me quite what you’ve implemented - I’m not familiar with the Legrand stuff - I found their website, but it didn’t have much information as to how it is working. What profiles are implemented at the moment? Is this a full zigbee stack, or does the Legrand system provide an abstract interface?

Cheers Chris


Reply to this email directly or view it on GitHub: https://github.com/openhab/openhab/issues/1057#issuecomment-72733761

kristofdk commented 9 years ago

Like! Good to see updates on this one!

Any code already available of a zb4osgi-based binding?

davebalaishis commented 9 years ago

+1 for the full stack zigbee support. The cheap zigbee LED bulbs are a compelling draw. Has there been any formal progress on this since the last comment?

cdjackson commented 9 years ago

I’ve implemented a ZigBee binding for OH2, but won’t look to port it to OH1 at this stage. OH2 is coming along quite well so hopefully in the near future it will be ready for prime time (??).

Chris

kirantpatil commented 8 years ago

@abisval,

I am trying to build as said in http://technomindshare.blogspot.in/2014/04/interfacing-xbee-with-openhab.html but could not succeed.

Please help me to resolve this issue.

System configuration:

  1. openhab v1.7.1 using https://github.com/openhab/openhab/wiki/IDE-Setup (Yoxos method)
  2. java versions (1.8 and 1.6)
  3. Maven 3.0.5
  4. Fedora 22

Getting below error on cmd line while executing, mvn clean install.  mvn clean install [INFO] Scanning for projects... [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project org.openhab.binding:org.openhab.binding.xbee:1.3.0-SNAPSHOT (/home/kpatil/Documents/homeautomation/openhab/bundles/binding/org.openhab.binding.xbee/pom.xml) has 1 error [ERROR] Non-resolvable parent POM: Could not find artifact org.openhab.bundles:binding:pom:1.3.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 10 -> [Help 2] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Thanks.

kirantpatil commented 8 years ago

Hi @zachariahyoung,

Which XBee binding are you using for your setup ?

Can you please share the details ?

Thanks.

kirantpatil commented 8 years ago

Hi all,

We managed to get it work as mentioned in http://technomindshare.blogspot.in/2014/04/interfacing-xbee-with-openhab.html.

Thanks.

kirantpatil commented 8 years ago

@Diaoul,

Right now we are following above blog post and here is how demo.items looks. Contact Window_FF_Bed2 "Bedroom2 [MAP(en.map):%s]" (FF_Bed, Windows) { xbee="<znetrxiosampleresponse@0013A20040A2206C#D0:" }

As per the blog when Digital Input is high and low it changes to OPEN and CLOSE at OH UI, which is driven from END DEVICE.

But we would like to emulate the behavior of OPEN and CLOSE from OpenHab UI ie COORDINATOR by providing a button.

Please let us know, what needs to be done at configuration or any other place in XBee binding.

Thanks.

Diaoul commented 8 years ago

I'm not sure how you can do that. What's the frame you send?

kirantpatil commented 8 years ago

Sir, sorry I don't know about the frame. I am trying to see if I can do communication from both END DEVICE to COORDINATOR and vice versa.

kirantpatil commented 8 years ago

@Diaoul, for our usecase we found the below binding works fine.

https://github.com/juri8/openhab/tree/diyxbee