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: