openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

ZigBee Binding #142

Closed cdjackson closed 8 years ago

cdjackson commented 9 years ago

I have an initial ZigBee binding running. Currently controlling Hue lights, but will also shortly add other devices.

kirantpatil commented 8 years ago

Hi @cdjackson,

I would like to test my simple zigbee modules but I don't see the zigbee binding in OH2.

Please provide the necessary steps to test the zigbee module.

There is a discussion at community forum regarding how to enable it on OH2, please throw some light on it. https://community.openhab.org/t/getting-zigbee-to-work-on-openhab-2/3788

Thanks.

kirantpatil commented 8 years ago

I try to build binary of OH2 with zigbee as below but facing the "requires 'package javax.jmdns 0.0.0' but it could not be found" error.

$ git clone https://github.com/cdjackson/openhab2 $ git checkout zigbee $ mvn clean package

kirantpatil commented 8 years ago

I placed code in " targetplatform/openhab.target" to overcome the error as shown in

https://github.com/MERAprojects/openhab2/commit/f0de7e8bb15c3ab6b8fc2d41951746d69c459118

But now am getting below error.

[ERROR] Cannot resolve project dependencies: [ERROR] Software being installed: org.openhab.binding.freebox 2.0.0.qualifier [ERROR] Missing requirement: org.openhab.core.compat1x 2.0.0.qualifier requires 'package org.eclipse.smarthome.core.scriptengine 0.0.0' but it could not be found [ERROR] Cannot satisfy dependency: org.openhab.binding.freebox 2.0.0.qualifier depends on: package org.openhab.library.tel.items 0.0.0 [ERROR] [ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help. [ERROR] Cannot resolve dependencies of MavenProject: org.openhab.binding:org.openhab.binding.freebox:2.0.0-SNAPSHOT @ /home/kpatil/Documents/homeautomation/openhab2/addons/binding/org.openhab.binding.freebox/pom.xml: See log for details -> [Help 1] [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/MavenExecutionException

cdjackson commented 8 years ago

I don't know what these errors are - they are for sure nothing to do with the ZigBee binging.

ZigBee binding is still in early stages and I would wait a little before using it. I need to get some major modifications into the binding to make it useful for more devices.

Sent from my iPhone

On 17 Nov 2015, at 11:36, kirantpatil notifications@github.com wrote:

I placed code in " targetplatform/openhab.target" to overcome the error as shown in

MERAprojects@f0de7e8

But now am getting below error.

[ERROR] Cannot resolve project dependencies: [ERROR] Software being installed: org.openhab.binding.freebox 2.0.0.qualifier [ERROR] Missing requirement: org.openhab.core.compat1x 2.0.0.qualifier requires 'package org.eclipse.smarthome.core.scriptengine 0.0.0' but it could not be found [ERROR] Cannot satisfy dependency: org.openhab.binding.freebox 2.0.0.qualifier depends on: package org.openhab.library.tel.items 0.0.0 [ERROR] [ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help. [ERROR] Cannot resolve dependencies of MavenProject: org.openhab.binding:org.openhab.binding.freebox:2.0.0-SNAPSHOT @ /home/kpatil/Documents/homeautomation/openhab2/addons/binding/org.openhab.binding.freebox/pom.xml: See log for details -> [Help 1] [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/MavenExecutionException

— Reply to this email directly or view it on GitHub.

kirantpatil commented 8 years ago

Sir, can you please give us the details of that major modification, so that we can add one more person to help the project.

For a new contributor what shall he needs to know about zigbee, so that he can understand the code and contribute as per your suggestion.

kirantpatil commented 8 years ago

The compilation is happening on master(https://github.com/openhab/openhab2) OH2 repo as below.

Is zigbee branch compilation working for you using below steps ? $ git clone https://github.com/cdjackson/openhab2 $ git checkout zigbee $ mvn clean package

[INFO] [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ distribution --- [INFO] [INFO] --- maven-assembly-plugin:2.5.3:single (distro-assembly) @ distribution --- [INFO] Reading assembly descriptor: src/assemble/runtime.xml [INFO] Reading assembly descriptor: src/assemble/addons.xml [INFO] Reading assembly descriptor: src/assemble/demo.xml [WARNING] The assembly descriptor contains a filesystem-root relative reference,which is not cross platform compatible / [INFO] Building zip: /home/kpatil/Documents/homeautomation/test_openhab/openhab2/distribution/target/distribution-2.0.0-SNAPSHOT-runtime.zip [WARNING] The assembly descriptor contains a filesystem-root relative reference,which is not cross platform compatible / [INFO] Building zip: /home/kpatil/Documents/homeautomation/test_openhab/openhab2/distribution/target/distribution-2.0.0-SNAPSHOT-addons.zip [WARNING] The assembly descriptor contains a filesystem-root relative reference,which is not cross platform compatible / [INFO] Building zip: /home/kpatil/Documents/homeautomation/test_openhab/openhab2/distribution/target/distribution-2.0.0-SNAPSHOT-demo.zip [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] openHAB ........................................... SUCCESS [0.406s] [INFO] openHAB Add-ons ................................... SUCCESS [0.002s] [INFO] openHAB Bindings .................................. SUCCESS [0.001s] [INFO] Astro Binding ..................................... SUCCESS [3.487s] [INFO] Autelis Binding ................................... SUCCESS [0.558s] [INFO] AVM FRITZ! Binding ................................ SUCCESS [0.936s] [INFO] openHAB Bundles ................................... SUCCESS [0.003s] [INFO] openHAB I/O Components ............................ SUCCESS [0.002s] [INFO] openHAB Serial Transport .......................... SUCCESS [0.091s] [INFO] DSCAlarm Binding .................................. SUCCESS [0.709s] [INFO] openHAB Core Components ........................... SUCCESS [0.004s] [INFO] openHAB Core 1.x Compatibility Layer .............. SUCCESS [1.383s] [INFO] Freebox Binding ................................... SUCCESS [0.469s] [INFO] HDanywhere Binding ................................ SUCCESS [0.140s] [INFO] IPP Binding ....................................... SUCCESS [0.276s] [INFO] Keba Binding ...................................... SUCCESS [0.222s] [INFO] Lutron Binding .................................... SUCCESS [0.478s] [INFO] MAX! Binding ...................................... SUCCESS [0.472s] [INFO] MAX! Binding Tests ................................ SUCCESS [0.306s] [INFO] Network Binding ................................... SUCCESS [0.243s] [INFO] PioneerAvr Binding ................................ SUCCESS [0.368s] [INFO] Pulseaudio Binding ................................ SUCCESS [0.260s] [INFO] SMA EnergyMeter Binding ........................... SUCCESS [0.142s] [INFO] Sonos Binding ..................................... SUCCESS [0.254s] [INFO] SqueezeBox Binding ................................ SUCCESS [0.372s] [INFO] Tesla Binding ..................................... SUCCESS [0.548s] [INFO] Vitotronic Binding ................................ SUCCESS [0.166s] [INFO] openHAB Core ...................................... SUCCESS [0.276s] [INFO] openHAB I/O Add-Ons ............................... SUCCESS [0.001s] [INFO] my.openHAB Connection Service ..................... SUCCESS [0.279s] [INFO] openHAB UI Components ............................. SUCCESS [0.021s] [INFO] openHAB Dashboard UI .............................. SUCCESS [0.133s] [INFO] openHAB UI Components ............................. SUCCESS [0.001s] [INFO] openHAB Classic UI Dashboard Integration .......... SUCCESS [0.096s] [INFO] openHAB Paper UI Theme Fragment ................... SUCCESS [0.082s] [INFO] openHAB CometVisu Backend ......................... SUCCESS [1.707s] [INFO] openHAB Initializer ............................... SUCCESS [0.101s] [INFO] openHAB Core 1.x Compatibility Layer Tests ........ SUCCESS [0.309s] [INFO] openHAB Jetty ..................................... SUCCESS [0.027s] [INFO] openHAB SSL Certificate Generator ................. SUCCESS [4.864s] [INFO] openHAB REST API Documentation .................... SUCCESS [0.404s] [INFO] openHAB Classic Iconset ........................... SUCCESS [0.348s] [INFO] openHAB Features .................................. SUCCESS [0.002s] [INFO] openHAB Dependencies .............................. SUCCESS [0.321s] [INFO] openHAB Runtime ................................... SUCCESS [0.131s] [INFO] openHAB Products .................................. SUCCESS [0.001s] [INFO] openHAB Runtime Application ....................... SUCCESS [14.105s] [INFO] openHAB P2 Repository ............................. SUCCESS [4.229s] [INFO] openHAB Target Platform ........................... SUCCESS [0.503s] [INFO] openHAB Distribution .............................. SUCCESS [7:28.285s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 10:02.418s [INFO] Finished at: Wed Nov 18 14:36:24 IST 2015 [INFO] Final Memory: 93M/423M [INFO] ------------------------------------------------------------------------ Cleaning up unclosed ZipFile for archive /home/kpatil/Documents/homeautomation/test_openhab/openhab2/products/org.openhab.product.runtime/target/products/org.openhab.product.runtime-win32.win32.x86.zip Cleaning up unclosed ZipFile for archive /home/kpatil/Documents/homeautomation/test_openhab/openhab2/products/org.openhab.product.runtime/target/products/org.openhab.product.runtime-win32.win32.x86.zip Cleaning up unclosed ZipFile for archive /home/kpatil/Documents/homeautomation/test_openhab/openhab2/products/org.openhab.product.runtime/target/products/org.openhab.product.runtime-win32.win32.x86.zip

kirantpatil commented 8 years ago

Hi @cdjackson,

I changed in openHAB2.setup file as below to build using eclipse installer but could not succeed.

remoteURI="https://github.com/cdjackson/openhab2.git"

<stream

name="zigbee"/>

Please find the attached screenshot where eclipse shows zigbee binding and shows errors.

screenshot from 2015-11-20 12-35-10

cdjackson commented 8 years ago

I’m not sure what’s up, but if you can’t get openhab to compile in the first place, then you need to resolve this first.

kirantpatil commented 8 years ago

Sir, any help on where am I making mistake while compiling with zigbee branch.

kirantpatil commented 8 years ago

Hi @cdjackson,

My need is which is expressed in https://github.com/juri8/openhab/wiki/DIY-on-XBee-Binding.

I would like to know whether zigbee binding supports plain XBee binding for one to one communication.

Thanks.

cdjackson commented 8 years ago

I guess it depends on how you’ve written your XBee software. Generally, I would say no, it doesn’t support plain XBee - unless you support the Zigbee protocols, including the cluster library etc? I’ve not worked with XBee, but I think most people don’t use this?

kirantpatil commented 8 years ago

Hi @cdjackson,

There are two XBee binding codes available and an article on it as below.

1) http://code.google.com/r/paoloquinci-xb/source/list 2) http://code.google.com/r/diaoulael-xbee/source/list 3) http://technomindshare.blogspot.in/2014/04/interfacing-xbee-with-openhab.html

google group discussion https://groups.google.com/forum/#!topic/openhab/lNa0z27EQIU

Can I use one of them or that scenario is supported in zigbee-binding ?

Thanks.

cdjackson commented 8 years ago

As I think I said, if you use code that supports the standard ZigBee standards, including the cluster library, then it will be compatible - however, probably not just yet as this needs some changes to support ‘ad-hoc’ devices…

On 24 Nov 2015, at 04:59, kirantpatil notifications@github.com wrote:

Hi @cdjackson https://github.com/cdjackson,

There are two XBee binding codes available and an article on it as below.

1) http://code.google.com/r/paoloquinci-xb/source/list http://code.google.com/r/paoloquinci-xb/source/list 2) http://code.google.com/r/diaoulael-xbee/source/list http://code.google.com/r/diaoulael-xbee/source/list 3) http://technomindshare.blogspot.in/2014/04/interfacing-xbee-with-openhab.html http://technomindshare.blogspot.in/2014/04/interfacing-xbee-with-openhab.html Can I use one of them or that scenario is supported in zigbee-binding ?

Thanks.

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

derabbink commented 8 years ago

I'd like to contribute to this effort, but I don't know which hardware to start with. I'm hoping to run my openhab machine as a ZigBee coordinator, and I'd like the ZigBee radio I need for that to be a USB device that works well with Linux (preferably without any drivers - i.e. as a USB serial device - on x86, x86_64, ARM6 and ARM7 machines). I haven't been able to establish which available hardware I can use for this. Any help would be greatly appreciated.

cdjackson commented 8 years ago

At the moment, this requires the TI2531 USB stick - as per the zigbee4java library.

icanhazpython commented 8 years ago

@cdjackson how can we use the binding with oh2? Is there a prebuilt jar available or instructions on how to install? I'm just getting started messing with oh2, I have it and habmin installed on an rpi2. I've found your projects https://github.com/cdjackson/zigbee4java and https://github.com/cdjackson/openhab2-addons/tree/zigbee/addons/binding/org.openhab.binding.zigbee. Just wondering if there is a quick/easy way to get it installed so I can begin kicking the tires. Thanks

chennakeshavaSoC commented 8 years ago

Hi cdjackson, We are able to compile Zigbee4Java and run zigbee-console-java.jar. It is discovering my zigbee lights and we are able to control them (of/off/etc). Which jar file we need to place in the addon folder of OH1?

We are not sure to use whether OH1 or OH2, and wanted to create zigbee binding accordingly.

The last conversation shows link to your work on zigbee binding for openhab2. Can you list the steps how to use your zb binding with OH2 or OH1.

Regards, Chenna

cdjackson commented 8 years ago

This binding is only available for OH2 - it can't be used on OH1.

Currently I'm in the process of updating this binding although looking in here it doesn't look like I've pushed my latest changes. It needs a significant update to use the latest ESH features to support dynamic instantiation. I will hopefully have time to finish this over the next couple of weeks.

chennakeshavaSoC commented 8 years ago

How complex is it to develop/create a binding for OH1? and What are all the jar files need to be transferred from Zigbee4Java setup to OH1 addons folder?

cdjackson commented 8 years ago

It's not complicated to develop an OH1 binding - it's just very different than OH2. No files are transferred from the Zigbee4java to the addons folder except the binding itself.

cdjackson commented 8 years ago

@kaikreuzer this PR has been updated to work with dynamic channels that are auto-generated from the cluster list. Currently I've just added the on/off, dimmer and color clusters, but I'll continue to add more shortly (I want to get the temperature/humidity clusters added soon to support my devices). I've also given it a bit of a tidy...

It might be good to look at reviewing/merging this as I think the new concept is much better and should work with a wider range of devices.

We're still stuck with the 2531 dongle though...

cdjackson commented 8 years ago

Hmmm - just realised this isn't a PR, but an issue :) I'll close this and create a PR.

DuncanvR commented 8 years ago

For the lazy: the pull request is #779

IgorTrindadePT commented 8 years ago

Hello to all, I'm trying to connect one custom zigbee device to openhab. I already created the network with TI Dongle cc2531 and I can make my custom device appear in the openhab when I start searching.

But the issue appears when I try to assign my device to an openhab object. Basically it stays always in the initializing state. I dig into the code and found that it never goes throught this condition in ZigBeeThingHandler.java, in the initialize() function:

    if (coordinatorHandler == null) {
         return;
    }

After some debug, I tried to force it to initialize, so I changed the condition to this:

if (coordinatorHandler == null) { updateStatus(ThingStatus.ONLINE); }

With this, it sets the coordinatorHandler with the bridge handler. After this I get this log...

2016-05-09 22:30:38.772 [INFO ] [ome.event.ThingStatusInfoEvent:43 ] - 'zigbee:generic_levelcontrol:3b886205:00124b00022edc37' updated: ONLINE 2016-05-09 22:30:38.775 [INFO ] [nt.ThingStatusInfoChangedEvent:43 ] - 'zigbee:generic_levelcontrol:3b886205:00124b00022edc37' changed from INITIALIZING to ONLINE 2016-05-09 22:30:38.787 [DEBUG] [b.z.handler.ZigBeeThingHandler:63 ] - Initializing ZigBee thing handler null. 2016-05-09 22:30:38.787 [DEBUG] [o.o.b.z.i.ZigBeeNodeSerializer:108 ] - null: Serializing from file userdata/zigbee/null.xml 2016-05-09 22:30:38.787 [DEBUG] [o.o.b.z.i.ZigBeeNodeSerializer:111 ] - null: Error serializing from file: file does not exist. 2016-05-09 22:30:38.788 [DEBUG] [b.z.h.ZigBeeCoordinatorHandler:304 ] - Error finding ZigBee device with address null/1 2016-05-09 22:30:38.788 [DEBUG] [b.z.h.ZigBeeCoordinatorHandler:304 ] - Error finding ZigBee device with address null/1 2016-05-09 22:30:38.788 [ERROR] [.b.z.converter.ZigBeeConverter:35 ] - Error opening device on/off controls null/1 2016-05-09 22:30:38.789 [DEBUG] [b.z.h.ZigBeeCoordinatorHandler:304 ] - Error finding ZigBee device with address null/1 2016-05-09 22:30:38.789 [DEBUG] [b.z.h.ZigBeeCoordinatorHandler:304 ] - Error finding ZigBee device with address null/1 2016-05-09 22:30:38.789 [ERROR] [.b.z.converter.ZigBeeConverter:34 ] - Error opening device level controls null/1 2016-05-09 22:30:38.789 [DEBUG] [b.z.handler.ZigBeeThingHandler:159 ] - null: Initializing ZigBee thing handler

It looks like that is missing some .xml file... Can someone help with this, please?

Thanks in advance.

kirantpatil commented 7 years ago

@IgorTrindadePT, can you please post how did you compile and add zigbee binding to OH2 ?

Thanks.

cdjackson commented 7 years ago

As discussed on the forum, this will not work with the REX hardware. Do you have the CC2531 hardware or are you using something else? I just want to save you the pain of installing the IDE and getting everything working just to find that it doesn’t work with your hardware.

To compile the binding, follow the instructions here (http://docs.openhab.org/developers/development/ide.html http://docs.openhab.org/developers/development/ide.html) to install the IDE. Then download the branch from this PR and compile using Eclipse.

kirantpatil commented 7 years ago

I did install openhab2-development and then downloaded and build the zigbee branch. Now how to find out that Zigbee binding is loaded and running ?

Thanks.

cdjackson commented 7 years ago

It’s the same as any other binding - use Karaf to see what is running.

You still haven’t answered my question - are you trying to get this working with the REX hardware? it will not work and I don’t want to waste either of our time if this is what you are trying to do..

kirantpatil commented 7 years ago

Finally I would like to check what does it show in Karaf bundle:list.

How to Karaf when I am running app from Eclipse ?

cdjackson commented 7 years ago

If you are running in Eclipse, then Karaf is not running. You should use the debugger to debug.

Please can you respond to the question - what hardware are you trying to get this working with. It will only work with the CC2531.

kirantpatil commented 7 years ago

Yes Sir, I understood that it is working with CC2531. I will not post any more questions regarding the support for REX3S device.

Thanks and appreciate for your quality time and guidance.

cdjackson commented 7 years ago

This was not my point. If you want to look at adding support for the REX, then we can discuss, but it will be quite a lot of work (I am currently adding other dongles). I was simply trying to understand what you are trying to do to avoid wasting both of our time!

kirantpatil commented 7 years ago

Sir, Please don't mind, my intention is to stop momentarily until I could get REX usb dongle to try, I understood your point. I would like to see support for REX. Since I am not a HW guy, so trying my best to understand about it.

Once again sorry, I could not convey my intention in proper way.

mickelluiten commented 7 years ago

HI, Trying to build the JAR file with maven for importing it in the addons folder but getting a error. "Missing requirement: org.openhab.binding.zigbee 2.0.0.qualifier requires 'package gnu.io 0.0.0' but it could not be found"

Don't know wat i'm doing wrong? Has anybody a out of the box binding (jar) for zigbee?

Also when i doing a git clone https://github.com/cdjackson/openhab2 there is no zigbee binding anymore. When i download it manualy there is.

Please assist me, i was trying to get zigbee binding to work. my usb CC2531 hardware is currently on the way, the ccdebugger/flasher i already have.

What is the latest status for this development?

cdjackson commented 7 years ago

This error is because you don't have the serial bundle included.

I will try and get a compiled binding into the OH2 marketplace over the weekend if possible.

mickelluiten commented 7 years ago

@cdjackson,. Did you manage tot add a compiled version for the zigbee binding in the OH2 marketplace?

Or is it another repro? How to add this repro tot OH2?

What do you.mean that i did't include the serial binding? Can you give me i bit of explemenation for my understanding and learningprocess.

Thanks in advance Mickel

cdjackson commented 7 years ago

I didn't finish the binding over the weekend - I was trying to finish up the issues with the TI driver last night but had to do some work with the EM358 driver.

It will be in another repo - openhab/org.openhab.binding.zigbee.

The serial bundle - not the serial binding - is required. It's a dependency of any bundle that uses serial ports (zwave, zigbee, serial, and probably a bunch of others). The easiest way to install this might be to install the zwave binding using PaperUI - ZWave wont do anything but it will resolve the dependency.

mickelluiten commented 7 years ago

Hi Chris, thanks for the explenation. i'am a newbie with compiling. I dont understand what you mean to install the zwave binding, Yes i can install the zwave binding that not the problem. But i have a a RPI3 with openhab2 in my live system and also maven install(where i can install the zwave binding), also on my windows laptop i have running eclipse and also maven. Don't see the link between OH2-Zwave and maven. Can you do i little more explenation? Or is there a good tutorial beside the info on the openhab website? Thanks again. Mickel

cdjackson commented 7 years ago

Sorry - I thought you were running in the runtime, not the IDE.

To run in the IDE, you need to start the serial bundle. To do this, edit the run configuration plugins and tick the serial bundle (I forget exactly what it's called - I think if you just type serial into the filter box at the top of the plugins page, it might find it - or it might now be called nrserialjava - again, putting this into the filter box should resolve this.

The link with ZWave is that in the runtime environment, it will automatically resolve the dependencies when you install a binding. Given that ZWave has the same dependencies as ZigBee, if you install the ZWave binding, it will automatically resolve the dependencies for you. Otherwise you will need to manually find the dependencies to resolve this issue.

tavalin commented 7 years ago

@cdjackson an alternative is typing feature:install openhab-transport-serial into the (OSGi) console.

Rachi87 commented 7 years ago

Can anyone provide a compiled zigbee binding? I would love to test it:)

mickelluiten commented 7 years ago

Hi Chris, DId you already managed to add a compiled version of your Zigbee binding. Next week my USB CC2531 device is arriving, really want to test the binding. Mickel

cdjackson commented 7 years ago

No, but hopefully next week. I’m just trying to get some initialisation stuff sorted out with the TI dongle, and add network persistence.

mickelluiten commented 7 years ago

Hi Chris,. I am ready to test the binding with the TI dongle. Did you manage to get the zigbee binding ready? If so can you send it to me or set it online? Only need tot flash the TI dongle with the zstack firmware but that i give it try tonight. Let me know. BR Mickel

giannello commented 7 years ago

@mickelluiten the plugin is available in the marketplace.