Raspberry Pi - Make serial USB ports persistent via symlinks

raspberry
usb
symlink
Tags: #<Tag:0x00007f1e5189e538> #<Tag:0x00007f1e5189e3f8> #<Tag:0x00007f1e5189e2b8>
(Tomasz S) #17

Thanks. It helped it seems as after restarting OS finally OH2 can establish communication to my device without any problems.

0 Likes

(Duc) #18

On the symlink, I add a
sudo chown -h root:tty /dev/ttyUSB-ZStick
This way I have the same permission of the original. It works.

I don’t know if it’s necessary. What do you think ?

1 Like

(Phil) #19

After doing this my Zigbee binding stopped working. The Zigbee stick is “Online” but all Zigbee devices are “Unknown”.

0 Likes

(Roland Sebö) #20

i did everything, but the ttyUSB-ZStick dont show up in habmin or in paperui as port to choose. Someone maybe could help?

0 Likes

(Kim Andersen) #21

I have the same problem. I have given up trying to fix it.

0 Likes

(Roland Sebö) #22

Still wait for an answer, The port is missing in Paper UI and in Habmin too. If i write it manually like “/dev/ttyUSB-ZStick” than the stick does not work. I get a message: “Serial Error; Port {0} does not exist”,

But the port exist, if i ls -l /dev/ttyUSB* i gen an answer /dev/ttyUSB-ZStick -> ttyACM0

Pls help…

0 Likes

(SiHui) #23

If you don’t provide enough information we can’t answer, sorry.
Which openHAB version?
If you are on some of the newer snapshots there is a known issue:

0 Likes

(Kim Andersen) #24

Read above… There has been plenty informations, both in this thread an others… Symlinks does not work. Using 4 USB devices on a Rpi wiht openhab (atm openhab 2.5M1 build #1575) makes it a total nightmare whenever I reboot. And it´s not just zwave which is a problem.

0 Likes

(Roland Sebö) #25

Sry, but i dont know what information u need.
If i plug in the Aeotec z-wave stick, the system find it under /dev/ttyACM0.
A made a udev rule, where i set a link from /dev/ttyUSB-ZStick to ttyACM0.

But after this if i want to add the Stick as controller to Paper UI or Habmin, there is no possibility to choose any port, like before.
And if i write in manually the port name /dev/ttyUSB-ZStick or /dev/ttyACM0 than i get an error message “Serial Error; Port {0} does not exist”

0 Likes

(SiHui) #26

Sorry, it was not you I was answering to. Forgot the quote.

0 Likes

(SiHui) #27

As a minimum your openHAB version, even better #10:

In your case: old openHAB version, probably an operating system issue, newer snapshot openHAB version, probably an openHAB related problem (see my link to github)

0 Likes

(Roland Sebö) #28

I have the OpenHab 2.4 stable version and Ubuntu 18.04 LTS. Everything installed 3 days ago.

0 Likes

(Johannes) #29

Did you also add that that port Symlink in the extra java opts as described in the first part here https://www.openhab.org/docs/administration/serial.html#serial-port-configuration?

0 Likes

(Roland Sebö) #30

i added this to my /etc/default/openhab2

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB-ZStick"

0 Likes

(Johannes) #31

@Rintano I have been using 3 USB devices on a Pi 3b+ with Symlinks and Openhab no problem. Works fine on a reboot. The zwave binding is actually the one that worked best with Symlinks for me. On a Pi with Openhabian and oh 2.5M1 this works for me:
Definition of my Symlinks added to the bottom of /etc/udev/rules.d/99-com.rules

SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="ttyEnocean"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="ttyZwave"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="ttyZigbee"

and this is what I added in the EXTRA_JAVA_OPTS line in /etc/default/openhab2

-Dgnu.io.rxtx.SerialPorts=/dev/ttyEnocean:/dev/ttyZwave:/dev/ttyZigbee:/dev/ttyUSB0"

For me it was important to add them to the EXTRA_JAVA_OPTS line that was already there and not to make a new one and there is a bug in Openhabian that overwrites your EXTRA_JAVA_OPTS when you use the add common ports option in the openhabian-config.
I dint know if you have to do anything else when you use a manual installation.
Best regards Johannes

0 Likes

(Roland Sebö) #32

I have just one EXTRA_JAVA_OPTS too. no other, but OpenHab still dont have access to the port somehow

0 Likes

(Roland Sebö) #33

PROBLEM RESOLVED: sudo usermod -a -G dialout openhab
was need to make

1 Like

(Kim Andersen) #34

Why??

0 Likes

(Roland Sebö) #35

Because the openhab user need to be in the group dialout. if not, have no access to read the serial ports

0 Likes

(Kim Andersen) #36

But in the first message of this thread, #6 it says:

Add openhab user to the right groups:
sudo adduser openhab dialout
sudo adduser openhab tty

When I do that, I´m beeing told openhab is already a member of tty and dialout.

1 Like