CUL-Stick working only if OH2 started as root?

Hi,
I’m using a CUL-Stick in conjunction with the Intertechno binding .( nigthly build #464 online).
The stick is working as expected, however I had to start OH2 as user root to make it work. Although user openhab is member of the dialout group I couldn’tget it to work under this user.
Has anybody got it to work without using the root user?

Depends on how the CUL-stick is bound to yous system, so 1st thing is, what is your platform and distribution, 2nd, find the permissions for your device, e.g.

ls -l /dev/ttyUSB0

…if the CUL-Stick is ttyUSB0. Check owner, group and permissions.

CUL-STLCK is

/dev/ttyACM0

Which all users can use. Can’t show printout since I’m away from home.
Using the CUL-STICK via screen is possible for user openhab.

Plattform is RasPI2

Wrong statement!
I believed the output of

ls -l /dev/ttyACM0

to be:

crwxrwxrwx 1 root dialout 166, 0 Sep 8 20:24 /dev/ttyACM0

but that is lost after a reboot, then it looks like:

crw-rw---- 1 root dialout 166, 0 Sep 8 20:24 /dev/ttyACM0

However, even with that setting, user openhab as member of group dialout should be able to use the stick. Or am I lost?

Yes, membership of group dialout should suffice. Did you export /dev/ttyACM0 to the openHAB start script? see https://github.com/openhab/openhab/wiki/Serial-Binding#note2 for details, this should work for openHAB2, too.
Be aware that this has to be set in /opt/openhab2/start.sh (according to http://docs.openhab.org/installation/linux.html#service)

No I did not export /dev/ttyACM0 to the start script.Reading the links I’m not sure where to add the “-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0”.
Into the start.sh? In there as a new last line or as an additional string to the"exec" line?

Yes, I think start.sh should be the right file. As the call of openHAB is split into several lines, you should add the -Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0 \ in an extra line ahead the other options.

I’m feeling stupid, I can’t get it to work.
Changed the start.sh to look like:

#!/bin/sh

echo Launching the openHAB runtime…
-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0
DIRNAME=dirname "$0"
exec “${DIRNAME}/runtime/karaf/bin/karaf” “${@}”

When changing the service to be started as user openhab, stopping Openhab, disabelung the service, enabeling it again and starting openhab I get the “Can’t open CUL” error. A reboot didn’t change that.

Ah… Sorry for misleading instructions. Now, as I’m sitting right in front of my OH2-test installation… :wink:

add the line to

/etc/default/openhab2

this way:

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

/etc/default/openhab2 sounds like a directory in case of the repository installation, corect? Since I’m still on a manual one that would be where? The docs page says "not preconfigured ".
I’m not in front of my system but I believe there is a folder /opt/openhab2 /conf/services. In there? Which file then?

No, /etc/default/ is the directory, containing different files with defaults for different services, in this case openhab2, so the file is named openhab2

Made the file openhab2 in /etc/default with this line:

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

an changed the user and group that starts the service to openhab.

That way I’m getting again this error:

20:07:06.383 [ERROR] [io.transport.cul.CULLifecycleManager] - Can’t open CUL
org.openhab.io.transport.cul.CULDeviceException: gnu.io.UnsupportedCommOperationException: Invalid Parameter
at org.openhab.io.transport.cul.internal.serial.CULSerialHandlerImpl.openHardware(CULSerialHandlerImpl.java:104)[189:org.openhab.io.transport.cul:1.9.0.201608310111]
at org.openhab.io.transport.cul.internal.AbstractCULHandler.open(AbstractCULHandler.java:139)[189:org.openhab.io.transport.cul:1.9.0.201608310111]
at org.openhab.io.transport.cul.internal.CULManager.createNewHandler(CULManager.java:149)[189:org.openhab.io.transport.cul:1.9.0.201608310111]

and this CUL does NOT send the command!
So it was of no effect! :frowning: