Zigbee binding

@reinhold,

Just a WAG on my part, but have you reviewed the guidance found in this post by @ThomDietrich? Obviously the device path is different in your case, but some (all?) of the info may be applicable.

Good luck!

1 Like

Dear All,
thanks for your ideas. It was indeed a simple issue (also suggested by some here): I “forgot” to add the /dev/ttyACM1 serial device to the gnu.io.rxtx.SerialPorts in the EXTRA_JAVA_OPTS in /etc/default/openhab2 (for my Z-Wave stick the /dev/ttyACM0 was already added a while back, but I completely forgot about this requirement). The serial port now works. It’s just a bit strange that in times of plug-and-play you still have to explicitly tell Java which devices it can use as serial ports… Shouldn’t the RXTX library be able to simply try to open any device it is given as a serial device and see if it works?

In particular, can’t the binding explicitly add the configured device to the SerialPorts variable if it is not included there? See e.g. http://angryelectron.com/rxtx-on-raspbian/ and http://rxtx.qbang.org/wiki/index.php/FAQ#RXTX_does_not_find_my_device.2C_what.27s_wrong.3F or https://www.raspberrypi.org/forums/viewtopic.php?f=5&t=6011

The particular problem seems to be that the RXTX library on linux only identifies /dev/ttyS* and /dev/ttyUSB* as serial ports, while many serial devices are made available as /dev/ttyACM* by the kernel. Unfortunately, RXTX does NOT by default identify these as serial devices, even though by definition they are (https://rfc1149.net/blog/2013/03/05/what-is-the-difference-between-devttyusbx-and-devttyacmx/). In my eyes this is main reason for many of the permissions problems on linux / RPi.

1 Like

That’s interesting - it might pay to see if you can find somewhere in the OH docs to add this point. Problems with serial ports, especially with the RPi, is one of the most common problems I see…

1 Like

Hi @Chris,
I’m curious to hear, if you made further progress on the zigbee binding - especially regarding the mentioned color temperature mods.

Do you have something new to test? :wink:

Hi,
Sorry - no I didn’t finish off the refactoring yet. It’s a little larger than I had originally hoped but I’ll try and get it completed this week.

Cheers
Chris

Hi Chris,

First of all, thank you so much for this great work. I’m really looking forward to using your binding as i have many Smartthings sensors and want to control them directly from the OH2. I installed your binding successfully and activated the serial driver through karaf.

Can i use the Raspbee module from Dresden Elektronik with your binding?

When i go the inbox and search things using your binding it give 2 options:
CC2531EMK Coordinator and the Ember EM35x Coordinator.
Can i use one of them for the Raspbee module?

Secondly, which serial port should i use? I mean the Raspbee module is plugged directly into the Raspi (and not thru USB port). So i have no clue what the port is. And I cannot use /dev/ttyACM0 as i have the Aeon Z-Stick using that port.

Any help would be very appreciated.
Thanks in advance.
Emre

No - this is not supported (at least not yet).

No.[quote=“asemev, post:106, topic:15763”]
Secondly, which serial port should i use? I mean the Raspbee module is plugged directly into the Raspi
[/quote]

I guess you should use the ls /dev/tty* command - but as above - this device is not currently supported.

Thanks Chris.

Hi @chris,
Sorry to bother you again about this :wink:
Have you find some time to look into the color temperature stuff?

Yes, I spent a little more time on it on Monday, but I had to do some other stuff last night. It’s pretty much at the top of my list now ;).

I seem to be having trouble with getting my zigbee stick up and running - I’ve flashed with CC2531ZNP-Pro-Secure_LinkKeyJoin.hex.

openhab.log is showing:
2017-06-14 18:00:01.934 [INFO ] [ndler.ZigBeeCoordinatorCC2531Handler] - Serial port [/dev/ttyACM0] is initialized.
2017-06-14 18:00:06.938 [WARN ] [etwork.impl.ZigBeeNetworkManagerImpl] - Dongle reset failed. Assuming bootloader is running and sending magic byte 0xef.
2017-06-14 18:00:11.939 [WARN ] [etwork.impl.ZigBeeNetworkManagerImpl] - Attempt to get out from bootloader failed.
2017-06-14 18:00:11.994 [INFO ] [ndler.ZigBeeCoordinatorCC2531Handler] - Serial port [/dev/ttyACM0] is closed.

Any ideas what might be going on? This is on a VMWare ESXi 6.5 hosted Ubuntu 17.04 install with Openhab 2.0 release.

I am not using this binding yet, but I am curious: Would it be possible to emulate some virtual Lightlink Lights or expose switch items? (Not asking whether it is already implemented, more if it would be possible at all).

I am asking because I use some really nice busch jaeger Zigbee switches and they work all fine but I would love to fire a rule (e.g. turn tv on with harmony binding) when I use one of the buttons on those switches.
Using the harmony hub this isn’t possible as:

  • busch jager switches can only save light states on the buttons
  • No way to see the buttons state in the hue bridge
  • hue bridge is polling only, which would lead to lags

Yes - this should work ok.

I hope to get an update out in the next day or so. Color temperature is now supported and the refactoring is looking ok. There’s a couple of things I want to look at first though…

One point to note, and the main point of this message is that the next version of the binding will require the latest snapshot runtime since there was a breaking change made to ESH/OH2 last Friday. The current version will only work with an older binding, and the next version will only work with the latest binding (16th July or newer).

Update to this - I have flashed the CC2531 again and I’m getting further along. I’ve also added debug level logging to the binding. My logs now look like the attached file and no zigbee devices are discovered, stick is still in “Initializing” state.

2017-06-19 18:59:40.332 [DEBUG] [bee.discovery.ZigBeeDiscoveryService] - Starting ZigBee scan for zigbee:coordinator_cc2531:69a3d5c1
2017-06-19 18:59:52.556 [DEBUG] [zigbee.internal.ZigBeeHandlerFactory] - Creating coordinator handler for org.eclipse.smarthome.core.thing.internal.BridgeImpl@fe7dd353
2017-06-19 18:59:52.558 [DEBUG] [ndler.ZigBeeCoordinatorCC2531Handler] - Initializing ZigBee CC2531EMK serial bridge handler.
2017-06-19 18:59:52.558 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Initializing ZigBee network [zigbee:coordinator_cc2531:595f5da9].
2017-06-19 18:59:52.558 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Channel -1
2017-06-19 18:59:52.558 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - PANID 0
2017-06-19 18:59:52.558 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - EPANID 0000000000000000
2017-06-19 18:59:52.558 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2017-06-19 18:59:52.558 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Initialising network
2017-06-19 18:59:52.558 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Created random ZigBee PAN ID [9991].
2017-06-19 18:59:52.559 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Created random ZigBee extended PAN ID [52B234DA39CA3000].
2017-06-19 18:59:52.560 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key String 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2017-06-19 18:59:52.560 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key array [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2017-06-19 18:59:52.560 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key final array [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2017-06-19 18:59:52.561 [DEBUG] [ndler.ZigBeeCoordinatorCC2531Handler] - ZigBee Coordinator CC2531 opening Port:'/dev/ttyACM1' PAN:9991, Channel:-1
2017-06-19 18:59:52.561 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Scheduling ZigBee start
2017-06-19 18:59:53.561 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - ZigBee network starting
2017-06-19 18:59:53.561 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Initialising ZigBee coordinator
2017-06-19 18:59:53.561 [DEBUG] [bee.discovery.ZigBeeDiscoveryService] - Creating ZigBee discovery service for zigbee:coordinator_cc2531:595f5da9
2017-06-19 18:59:53.561 [DEBUG] [bee.discovery.ZigBeeDiscoveryService] - Activating ZigBee discovery service for zigbee:coordinator_cc2531:595f5da9
2017-06-19 18:59:53.561 [DEBUG] [org.openhab.binding.zigbee          ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=307, service.bundleid=189, service$
2017-06-19 18:59:53.562 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - Key initialise [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2017-06-19 18:59:53.563 [DEBUG] [ndler.ZigBeeCoordinatorCC2531Handler] - Opening ZigBee CC2531 serial port
2017-06-19 18:59:53.563 [DEBUG] [ndler.ZigBeeCoordinatorCC2531Handler] - Connecting to serial port [/dev/ttyACM1]
2017-06-19 18:59:53.877 [INFO ] [ndler.ZigBeeCoordinatorCC2531Handler] - Serial port [/dev/ttyACM1] is initialized.
2017-06-19 18:59:55.589 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - initResponse is JOINED
2017-06-19 18:59:55.589 [DEBUG] [bee.handler.ZigBeeCoordinatorHandler] - initializeNetwork is true
2017-06-19 19:00:51.184 [DEBUG] [bee.discovery.ZigBeeDiscoveryService] - Starting ZigBee scan for zigbee:coordinator_cc2531:d7fc4893
2017-06-19 19:00:51.184 [ERROR] [etwork.impl.ZigBeeNetworkManagerImpl] - Synchronous command send failed due to IO exception.
    java.io.IOException: Input/output error in writeByte
    at gnu.io.RXTXPort.writeByte(Native Method)
    at gnu.io.RXTXPort$SerialOutputStream.write(RXTXPort.java:1145)
    at com.zsmartsystems.zigbee.dongle.cc2531.network.impl.CommandInterfaceImpl.sendRaw(CommandInterfaceImpl.java:298)
    at com.zsmartsystems.zigbee.dongle.cc2531.network.impl.CommandInterfaceImpl.sendPacket(CommandInterfaceImpl.java:179)
    at com.zsmartsystems.zigbee.dongle.cc2531.network.impl.CommandInterfaceImpl.sendSynchronousCommand(CommandInterfaceImpl.java:264)
    at com.zsmartsystems.zigbee.dongle.cc2531.network.impl.ZigBeeNetworkManagerImpl.sendSynchronous(ZigBeeNetworkManagerImpl.java:832)
    at com.zsmartsystems.zigbee.dongle.cc2531.network.impl.ZigBeeNetworkManagerImpl.sendSynchronous(ZigBeeNetworkManagerImpl.java:807)
    at com.zsmartsystems.zigbee.dongle.cc2531.network.impl.ZigBeeNetworkManagerImpl.sendCommand(ZigBeeNetworkManagerImpl.java:803)
    at com.zsmartsystems.zigbee.dongle.cc2531.ZigBeeDongleTiCc2531.sendCommand(ZigBeeDongleTiCc2531.java:198)
    at com.zsmartsystems.zigbee.ZigBeeNetworkManager.sendCommand(ZigBeeNetworkManager.java:484)
    at com.zsmartsystems.zigbee.ZigBeeNetworkManager.permitJoin(ZigBeeNetworkManager.java:944)
    at com.zsmartsystems.zigbee.ZigBeeNetworkManager.permitJoin(ZigBeeNetworkManager.java:917)
    at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.startDeviceDiscovery(ZigBeeCoordinatorHandler.java:467)
    at org.openhab.binding.zigbee.discovery.ZigBeeDiscoveryService.startScan(ZigBeeDiscoveryService.java:85)
    at org.eclipse.smarthome.config.discovery.AbstractDiscoveryService.startScan(AbstractDiscoveryService.java:199)
    at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.startScan(DiscoveryServiceRegistryImpl.java:382)
    at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.startScans(DiscoveryServiceRegistryImpl.java:358)
    at org.eclipse.smarthome.config.discovery.internal.DiscoveryServiceRegistryImpl.startScan(DiscoveryServiceRegistryImpl.java:216)
    at org.eclipse.smarthome.io.rest.core.discovery.DiscoveryResource.scan(DiscoveryResource.java:84)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_131]
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)[158:org.glassfish.jersey.core.jerse$
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)[157:org.glassfish.jersey.core.jersey-common:2.22.2]
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)[158:org.glassfish.jersey.core.jersey-server:2.22.2]
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)[155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
    at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76)[10:com.eclipsesource.jaxrs.publisher:5.3.1.201602281253]
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[79:org.eclipse.jetty.security:9.2.19.v20160908]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:287)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.eclipse.jetty.server.Server.handle(Server.java:499)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[80:org.eclipse.jetty.server:9.2.19.v20160908]
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[72:org.eclipse.jetty.io:9.2.19.v20160908]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[83:org.eclipse.jetty.util:9.2.19.v20160908]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[83:org.eclipse.jetty.util:9.2.19.v20160908]
    at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]

I’ve seen this before with some Chinese sticks. I don’t know what causes it - it looks like the serial port (ie USB) momentarily drops and the serial driver throws an exception.

Is your stick a TI stick, or is it from somewhere else? What firmware is running?

(ps. Please don’t post logs as quotes - use the </> button to format the block. It’s very hard to read when you they are posted as quotes).

Updated formatting - thank you for the note. This is a TI 2531 stick programmed with a TI CC Debugger. I’ve tried this with both:

Z-Stack Home 1.2.2a.44539\Projects\zstack\ZAP\ZNP-HexFiles\CC2531\CC2531ZNP-Pro-Secure_LinkKeyJoin.hex
Z-Stack Home 1.2.2a.44539\Projects\zstack\ZAP\ZNP-HexFiles\CC2531\CC2531ZNP-Pro-Secure_Standard.hex

The error log above is from CC2531ZNP-Pro-Secure_LinkKeyJoin.hex

Strange - I don’t know what this is then - sorry.

I’ve now updated the binding with the latest changes. This refactors the converters, and fixes a few bugs including the issue where color changes were happening slowly (although the issue was not limited to color changes). It also adds the color temperature channel.

I’d welcome feedback. Here’s it’s now working nicely with a Hue bulb I’m using for testing…

This should also be added to the main OH repository in the coming day or two so that the binding can be installed through PaperUI.

I want to beta test this also!
Any suggestions on where I can get a good quality ZigBee stick? (that has been tested and working with the binding)