Configuring zigbee binding

Hi @Bruce_Osborne,

Thanks for the official instructions.

Indeed I’ve looked into the that page quite a bit. I even saw this configuration line:

Thing zigbee:coordinator_cc2531:stick1 "Zigbee USB Stick" [zigbee_port="/dev/ttyACM0", zigbee_baud=38400]

I am wondering where should I add this line into? Which configuration file?

Is it possible to increase the logging level of openhab to “debugging” so I could see a bit more what is happening?

You are saying that the UI recommendation for the ZigBee is HABmin. I opened the UI with HABmin, and try to look what I how I could configure the binding there:

I cannot find how I could change the settings of the binding there. What am I missing?

Indeed you are wrong :wink: You just have to configure them properly, as explained in the docs.

1 Like

HI @weakfl,

Thanks a lot for the link to the documentation. This is helpful indeed. I could go a step further, however I haven’t solved the problem completely.

Setting the usb stick for openhab:

Added the openhab group:

sudo usermod -a -G dialout openhab

I ran udevadm info -a -p $(udevadm info -q path -n /dev/ttyACM0). This reported:

Summary
  looking at device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/tty/ttyACM0':
    KERNEL=="ttyACM0"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0':
    KERNELS=="1-1.3:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="cdc_acm"
    ATTRS{authorized}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceClass}=="02"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bInterfaceProtocol}=="01"
    ATTRS{bInterfaceSubClass}=="02"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{bmCapabilities}=="2"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3':
    KERNELS=="1-1.3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="02"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="32"
    ATTRS{bMaxPower}=="50mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 2"
    ATTRS{bcdDevice}=="0009"
    ATTRS{bmAttributes}=="80"
    ATTRS{busnum}=="1"
    ATTRS{configuration}==""
    ATTRS{devnum}=="4"
    ATTRS{devpath}=="1.3"
    ATTRS{devspec}=="  (null)"
    ATTRS{idProduct}=="16a8"
    ATTRS{idVendor}=="0451"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Texas Instruments"
    ATTRS{maxchild}=="0"
    ATTRS{product}=="TI CC2531 USB CDC"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="removable"
    ATTRS{serial}=="__0X00124B000BE8D2ED"
    ATTRS{speed}=="12"
    ATTRS{urbnum}=="14"
    ATTRS{version}==" 2.00"

and generated this line for 99-com.rules

SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", ATTRS{serial}=="__0X00124B000BE8D2ED", SYMLINK+="ttyCC2531"

rebooted the system and checked the symlink:

root@bigz:/dev# ll /dev/ttyCC2531
lrwxrwxrwx 1 root root 7 Sep 21 19:32 /dev/ttyCC2531 -> ttyACM0

This is a pretty impressive stuff. So I added

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyCC2531"

to /etc/default/openhab2

restarted the service and checked openhab. The setting is in:

root@bigz:/etc/default# ps ax | grep ttyCC2531
 2464 ?        Ssl    0:23 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dfelix.cm.dir=/var/lib/openhab2/config -Djava.library.path=/var/lib/openhab2/tmp/lib -Djetty.host=192.168.178.24 -Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses=192.168.178.24 -Dorg.osgi.service.http.port=9090 -Dorg.osgi.service.http.port.secure=9443 -Djava.awt.headless=true -Dgnu.io.rxtx.SerialPorts=/dev/ttyCC2531 -Djava.endorsed.dirs=/usr/lib/jvm/java-8-openjdk-armhf/jre/jre/lib/endorsed:/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/endorsed:/usr/share/openhab2/runtime/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-openjdk-armhf/jre/jre/lib/ext:/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/ext:/usr/share/openhab2/runtime/lib/ext -Dkaraf.instances=/var/lib/openhab2/tmp/instances -Dkaraf.home=/usr/share/openhab2/runtime -Dkaraf.base=/var/lib/openhab2 -Dkaraf.data=/var/lib/openhab2 -Dkaraf.etc=/var/lib/openhab2/etc -Dkaraf.logs=/var/log/openhab2 -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/var/lib/openhab2/tmp -Djava.util.logging.config.file=/var/lib/openhab2/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /usr/share/openhab2/runtime/lib/boot/activation-1.1.1.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-api-2.3.0.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-core-2.2.11.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-impl-2.2.11.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.jaas.boot-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.main-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

Now the cool stuff: I was able to add the CC2531EMK Coordinator as a thing, but I am not able to configure it:

The openhab service runs as openhab:

root@bigz:/dev# ps -ef | grep openhab
openhab   2464     1 18 19:35 ?        00:01:21 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dfelix.cm.dir=/var/lib/openhab2/config -Djava.library.path=/var/lib/openhab2/tmp/lib -Djetty.host=192.168.178.24 -Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses=192.168.178.24 -Dorg.osgi.service.http.port=9090 -Dorg.osgi.service.http.port.secure=9443 -Djava.awt.headless=true -Dgnu.io.rxtx.SerialPorts=/dev/ttyCC2531 -Djava.endorsed.dirs=/usr/lib/jvm/java-8-openjdk-armhf/jre/jre/lib/endorsed:/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/endorsed:/usr/share/openhab2/runtime/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-openjdk-armhf/jre/jre/lib/ext:/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/ext:/usr/share/openhab2/runtime/lib/ext -Dkaraf.instances=/var/lib/openhab2/tmp/instances -Dkaraf.home=/usr/share/openhab2/runtime -Dkaraf.base=/var/lib/openhab2 -Dkaraf.data=/var/lib/openhab2 -Dkaraf.etc=/var/lib/openhab2/etc -Dkaraf.logs=/var/log/openhab2 -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/var/lib/openhab2/tmp -Djava.util.logging.config.file=/var/lib/openhab2/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /usr/share/openhab2/runtime/lib/boot/activation-1.1.1.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-api-2.3.0.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-core-2.2.11.jar:/usr/share/openhab2/runtime/lib/boot/jaxb-impl-2.2.11.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.jaas.boot-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.main-4.2.1.jar:/usr/share/openhab2/runtime/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

The user openhab is a part of the dialout group

root@bigz:/dev# grep openhab /etc/group
tty:x:5:iobroker,openhab
dialout:x:20:osmc,iobroker,openhab
openhab:x:121:

and the device has rw for /dev/ttyACM0, so openhab has the correct permissions on the file:

root@bigz:/dev# ll /dev/ttyCC2531
lrwxrwxrwx 1 root root 7 Sep 21 19:32 /dev/ttyCC2531 -> ttyACM0
root@bigz:/dev# ll /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Sep 21 19:32 /dev/ttyACM0

The /var/log/openhab2/openhab.log says that the port does not exist:

Summary
2019-09-21 19:36:56.688 [ERROR] [ding.zigbee.handler.ZigBeeSerialPort] - Serial Error: Port  does not exist.
2019-09-21 19:36:56.691 [ERROR] [.cc2531.network.ZigBeeNetworkManager] - Failed to open the dongle.
2019-09-21 19:41:01.737 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at 'things/zigbee:coordinator_cc2531:16d54e5cd6a/config'
java.lang.NullPointerException: null
        at com.zsmartsystems.zigbee.app.discovery.ZigBeeDiscoveryExtension.extensionShutdown(ZigBeeDiscoveryExtension.java:96) ~[?:?]
        at com.zsmartsystems.zigbee.ZigBeeNetworkManager.shutdown(ZigBeeNetworkManager.java:529) ~[?:?]
        at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.dispose(ZigBeeCoordinatorHandler.java:303) ~[?:?]
        at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.handleConfigurationUpdate(ZigBeeCoordinatorHandler.java:554) ~[?:?]
        at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.updateConfiguration(ThingRegistryImpl.java:91) ~[?:?]
        at org.eclipse.smarthome.io.rest.core.internal.thing.ThingResource.updateConfiguration(ThingResource.java:438) [120:org.eclipse.smarthome.io.rest.core:0.10.0.oh240]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) [172:org.glassfish.jersey.core.jersey-server:

Hi @weakfl, @Bruce_Osborne, @Andrew_Rowe

Now this is a confusing part. After all those updates to configurations I rebooted the RPI and was surprised to see that openhab was not running at all. So I started it with /etc/init.d/openhab2 start. A few seconds later, the services booted up and the coordinator was all green!!!:

(of course I redused the speed to 38400, maybe that helped?). I still see errors in the log

Summary
2019-09-21 19:52:56.534 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while disposing handler of thing 'zigbee:coordinator_cc2531:16d54e5cd6a': null
java.lang.NullPointerException: null
        at com.zsmartsystems.zigbee.app.discovery.ZigBeeDiscoveryExtension.extensionShutdown(ZigBeeDiscoveryExtension.java:96) ~[?:?]
        at com.zsmartsystems.zigbee.ZigBeeNetworkManager.shutdown(ZigBeeNetworkManager.java:529) ~[?:?]
        at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.dispose(ZigBeeCoordinatorHandler.java:303) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.10.0.oh240]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
2019-09-21 19:52:56.982 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Stopped HABmin servlet
2019-09-21 19:52:57.041 [INFO ] [assic.internal.servlet.WebAppServlet] - Stopped Classic UI
2019-09-21 19:52:57.526 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Stopped Paper UI
2019-09-21 19:52:57.555 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - QueuedThreadPool[ESH-httpClient-common]@191583b{STOPPING,10<=10<=40,i=0,q=2}[org.eclipse.jetty.util.thread.TryExecutor$$Lambda$116/32388847@4c8d3] Couldn't stop Thread[ESH-httpClient-common-89,5,main]
2019-09-21 19:52:57.558 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - QueuedThreadPool[ESH-httpClient-common]@191583b{STOPPING,10<=10<=40,i=0,q=2}[org.eclipse.jetty.util.thread.TryExecutor$$Lambda$116/32388847@4c8d3] Couldn't stop Thread[ESH-httpClient-common-91,5,main]
2019-09-21 19:52:57.576 [INFO ] [panel.internal.HABPanelDashboardTile] - Stopped HABPanel
2019-09-21 19:52:57.586 [INFO ] [ebuilder.internal.HomeBuilderServlet] - Stopped Home Builder
2019-09-21 19:52:57.614 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard
2019-09-21 19:57:53.537 [INFO ] [ebuilder.internal.HomeBuilderServlet] - Started Home Builder at /homebuilder
2019-09-21 19:57:53.649 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2019-09-21 19:58:08.648 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2019-09-21 19:58:11.717 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.178.24:9090
2019-09-21 19:58:11.725 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.178.24:9443
2019-09-21 19:58:12.458 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2019-09-21 19:58:13.649 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2019-09-21 19:58:14.367 [WARN ] [ence.jdbc.internal.JdbcConfiguration] - JDBC url is missing - please configure in openhab.cfg like 'jdbc:<service>:<host>[:<port>;<attributes>]'
2019-09-21 19:58:14.372 [WARN ] [persistence.jdbc.internal.JdbcMapper] - JDBC::openConnection: no driver available!
2019-09-21 19:58:14.375 [WARN ] [persistence.jdbc.internal.JdbcMapper] - JDBC::openConnection: no driver available!

Let me try to couple the osram plug. How do I add an osram thing Which type does it belong to?

In the $OH_CONFIG area there is a things directory. You make a file there ending in .things.I have not yet worked with Zigbee in OH but the same developer does Z-Wave too… I have been helping clean up our data there.
@chris could clarify more.

1 Like

Use discovery to find your devices and then there will be no need for things files. But if you want to use things files, they would go in the directory ‘things’ in your OpenHAB2 configuration directory (folder) as Bruce stated

good to know! Will keep this in mind

My controller can do Zigbee as well as Z-Wave but I have not configured it since I have no Zigbee devices.

HI @Andrew_Rowe, @Bruce_Osborne,

Thanks a lot for your replies!

It may sound like a stupid question, but does one do a discovery to find my devices? The manual of osram plug says that if I press the on button some X sec, it would click and start broadcasting that it is alive (it does “click” after some X seconds). But how do I start discovery on the usb stick/openhab? There are two physical buttons on the stick, but they do not really do anything.

Cheers,
Arturas

Select the controller in HABmin. There is an option to put it in inclusion mode. I think you use the upper right menu and choose advanced.
I am away from my system right now.

Hi All,

wait a minute. I’ve visited the openhab GUI again, and in the corner there was this plug there saying that there’s something discovered! I pressed on it, and now I have a device in!

Now there’s a question mark associated to it. Does it mean anything? I tried to re-couple it with OH (pressing the button on the plug until it “clicks”), but no knew devices are found, or the question mark is gone.

How can I control the plug from OH to of/off the plug?

@Bruce_Osborne: it is cool you’ve got z-wave. What devices are you using there? I haven’t found a lot of products using z-wave there.

Cheers,
Arturas

Good news!

I removed the device and a sec later it was re-discovered again, this time with more infos:

On/Off button appeared and I am able to use it!

Gentlemen, thanks a lot for your help!

What manuals should I read to configure it “properly”? It looks to me that I have overlooked quite a bit of infos somehow.

@Bruce_Osborne,

Thanks for help.

This may be a weird question, but I can control the device from configuration->bindings->Osram Plug 01->on/of

however if I go to (accidentally discovered page in) sitemaps->home->osram plug 01 I find on/off there as well, but switching that does not do anything to the device.

Comments?

I also installed the android app (it found the server in the discover mode automatically), and I can control the switch :slight_smile:

Z-Wave devices are region-specific and I am in the US.I just realized my RPI crashed so I am going a little from memory here.
I have an Aeotec LED light https://www.amazon.com/gp/product/B00VQISQW4/
I have a few Neo Coolcam power outlets. https://www.aliexpress.com/item/32848343845.html
I have a few Neo Coolcam motion sensors https://www.aliexpress.com/item/32972306233.html
I have a Zooz ZEN-23 wall switch http://www.getzooz.com/zooz-zen23-24-toggle-switch.html

The power outlets seem OK but the motion sensors are cheap & finicky. I am looking toward Zooz or Homeseer sensors next.
I am impressed with the Zooz switch. I replaced the switch at the top og my basement steps and can control the light with the normal switch at the bottom too. Most any pther switch would require you to buy their slave switch. I am using motion sensors to control the Zooz switch so we do not leave that lght on when not needed.

@arturas I’m not sure if the sitemap is usable through HABmin, but you should be able to control the plug through Basic UI or the iOS/Android App (as you have already found out).

Basically you need two things, an item definition and a corresponding entry in your sitemap definition.

It looks like your plug also provides a channel for total active power. You should be able to use it by defining an item for it like this:

Number OsramPlug01_Power "OSRAM Plug 01 Power [%.0f W]" <energy> {channel="COPY THE CHANNEL LINK FOR ACTIVE POWER FROM THE THING"}

And a sitemap entry like this:

Text item=OsramPlug01_Power icon="energy" label="Plug 01 Power [%.0f W]"

Note: I’m configuring items and sitemap entries through the config files, but you should be able to create them in HABmin/PaperUI as well, if you prefer that.

@arturas One more thing: I’m not sure which OH version you are using, but for Zigbee I would recommend 2.5-M3. There have been many improvements and bugfixes since 2.4.

1 Like

@Bruce_Osborne:

Z-Wave devices are region-specific and I am in the US.I just realized my RPI crashed so I am going a little from memory here.

Thanks for sharing the devices that you use in the U.S. I lived in there for a half a year (east coast), and had a chance to visit a few places both on the west and east costs. I found that always pretty amazing that wall switches are so much alike there, compared to Europe, where no two houses have the same switches :slight_smile:

I am interested in motion sensors as well. It’s a pity the ones you’ve tested are not very robust. Automation of light switching in the areas where not needed is exactly what I’d like to do too. The price of the devices is a bit of a concern for me, as my summer house have quite a few rooms, a couple of not so very well lit corridors, and those amounts add up very fast. I’d prefer to build them myself, and be looking for some sort of developments boards (similar to nodemcu or esp8266). You do not happen to know any, do you?

Comparing zigbee with z-wave, am I to expect that z-wave would enjoy a lot larger operation ranges?

@weakfl:

It looks like your plug also provides a channel for total active power. You should be able to use it by defining an item for it like this:

These infos are very valuable. Directly changing the config files is my preferred way as well. As I am a bit new about the whole system, can you let me know the config file you are saving these setups into?

@weakfl:

One more thing: I’m not sure which OH version you are using, but for Zigbee I would recommend 2.5-M3. There have been many improvements and bugfixes since 2.4.

Thanks a lot for letting me know and bringing my attention to stable testing and development branches of the project. Maybe it makes sense to try out the milestone version of the software. I think I’ll grab my banana pi and give it a try :slight_smile:. Hopefully 1GB ram on it will be enough.

You can install a newer Zigbee binding on 2.4. I recommend users this install scrip with IH running.

I’m not sure if it still works with OH 2.4, but @5iver should be available to provide some insights.

Items should be in /etc/openhab2/items/default.items and your sitemap is probably /etc/openhab2/sitemaps/home.sitemap

That should be fine, I’m using a pi with 1GB ram as well (even with zram enabled for logs and swap).

Afaik @chris has just added support for the Tradfri motion sensors, those might be an option…

I have not been able to get a manual zigbee install working since it was migrated to bnd. And I have not tested anything on 2.4 for quite a while. Rather than copying the jar and dependencies into /addons/, I find it easier to use bundle:update. I plan to update the script, but my interest in OH is waning.

I managed to install the 2.5 SNAPSHOT on 2.4 stable last week - it works fine, but requires the xstream dependency which took me a while to find.

2 Likes