Can I use "/dev/serial/by-id"?

I successfully configured the epsonprojector binding and used a usb-to-serial adapter.

epsonprojector.cfg

beamer.serialPort=/dev/ttyUSB1

Then I changed the device to the following.

/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0

As you might know, ths would be the better way, because the ttyUSB-number could chnage wehen the server reboots or the adapter is plugged out and in again.

But now I get this error:

[WARN ] [ector.internal.EpsonProjectorBinding] - Couldn't execute command 'Power', org.openhab.binding.epsonprojector.internal.EpsonProjectorException: gnu.io.NoSuchPortException

I guess this is because the link is owned by “root:root” and not “root:dailout” or openhab cannot follow the link.

Did anybody get this working?
Is it possible without executing openhab as “root”?
I tried chown the symlink, but that does not seem to be working. It is still “root:root”.

root@raspi2a:/dev/serial/by-id# ls -al
insgesamt 0
drwxr-xr-x 2 root root 80 Apr  9 00:09 .
drwxr-xr-x 4 root root 80 Mär 20 01:00 ..
lrwxrwxrwx 1 root root 13 Mär 20 01:00 usb-EnOcean_GmbH_EnOcean_USB_300_DB_FTO7LOL-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Apr  9 00:09 usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0 -> ../../ttyUSB1

I guess the same will apply if I try to change to use “by-id” for the enocean adapter… :neutral_face:

I don’t use these non-standard serial ports myself. But I’ve read that you need to tell the RXTX library which additional ports are available.

See also the Serial Binding documentation.

The thread below also has a discussion on how to properly configure this:

I have not tested that in openHAB, but I use the following “workarround” in another software:

I created a symbolic link like (in your case) /dev/beamer that points to the file in /dev/serial/by-id/

Perhaps if you add the port to the /etc/default/openhab file

@Peter_Loeffler

Since /dev/serial/by-id/*** is already a link to /dev/ttyUSB**, I think this is not necessary.

@rtvb @wborn
I tried it without the EXTRA_JAVA_OPTS first, because I did not needed it for the normal ttyUSB-devices.

But now I tried it.

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyUSB1:/dev/ttyS0:/dev/ttyAMA0:/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0"

But I get another issue now.

openhab keeps restarting without a WARN or ERROR in the log. :frowning:

2017-04-09 18:20:35.611 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'epson.items'
2017-04-09 18:20:42.159 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'epson.sitemap'
2017-04-09 18:20:45.326 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2017-04-09 18:20:46.828 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-04-09 18:20:48.470 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-04-09 18:20:49.428 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2017-04-09 18:20:50.067 [INFO ] [b.core.service.AbstractActiveService] - Epson projector Refresh Service has been started
2017-04-09 18:21:25.695 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'epson.items'
2017-04-09 18:21:32.418 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'epson.sitemap'
2017-04-09 18:21:36.414 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2017-04-09 18:21:37.433 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-04-09 18:21:39.167 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-04-09 18:21:39.688 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2017-04-09 18:21:40.337 [INFO ] [b.core.service.AbstractActiveService] - Epson projector Refresh Service has been started
2017-04-09 18:22:16.110 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'epson.items'
2017-04-09 18:22:22.935 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'epson.sitemap'
2017-04-09 18:22:27.033 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2017-04-09 18:22:28.145 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-04-09 18:22:29.853 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-04-09 18:22:30.377 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2017-04-09 18:22:30.938 [INFO ] [b.core.service.AbstractActiveService] - Epson projector Refresh Service has been started

I will use the normal /dev/ttyUSB devices, now. :wink:

I had similar issues until I removed all serial devices but the ones I’m actually using.

I tried it with only the one device at first. :confused:

Why don’t you use udev rules?

I never used udev rules before.

But I guess it is worth looking into it. :slight_smile:

However it would have been the best and easiest way if my first approach had worked. :wink:

General approach is well described in the documentation referenced in the 1st reply.

At the end you will have something similar to what I have in /etc/udev/rules.d/99-com.rules:

SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0043", ATTRS{serial}=="987654321987654321", SYMLINK+="ttyMySensors"
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="ttyRFLink"

You should be able to find adapter-specific attributes by running usb-devices.

Finally you will need to add your new port like /dev/ttyEPS to /etc/default/openhab2

1 Like

@christoph_wempe

the point was, that the device gets other names … and with a self-built link you are able to get always the same device
naming in udev is sure the finest solution