PaperUI unable to select ttyUSB1

Running Openhabian 2.3.0-1 on RPI-3 and two bindings that require serial USB adapters (ModBus Transport market:binding-3528475 - 1.0 and RegoHeatPump 2.3.0)

When using the PaperUI to configure them neither binding will allow me to select ttyUSB1 although this appears in /dev. No option to edit in PaperUI and trying to use text things files has proven too difficult as the ModBus interface requires three different but linked ‘things’.

Is this a bug in the PaperUI or just a limitation of the simple approach.

Have you added tty and dial out to your openhab group?

https://www.openhab.org/docs/installation/linux.html#recommended-additional-setup-steps

Privileges for Common Peripherals

An openHAB setup will often rely on hardware like a modem, transceiver or adapter to interface with home automation hardware. Examples are a Z-Wave, Enocean or RXFcom USB Stick or a Raspberry Pi add-on board connected to the serial port on its GPIOs. In order to allow openHAB to communicate with additional peripherals, it has to be added to corresponding Linux groups. The following example shows how to add Linux user openhab to the often needed groups dialout and tty. Additional groups may be needed, depending on your hardware and software setup.

sudo adduser openhab dialout
sudo adduser openhab tty

If you are looking to enable sound privileges for openHAB, it will also be necessary to add openHAB to the “audio” group.

sudo adduser openhab audio

Additionally it’s needed to allow the java environment to access the serial port of the connected peripheral. Therefore the following setting has to be added/adapted on your system in file /etc/default/openhab2:

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"

With openhabian you may be able to accomplish this via sudo openhabian-config and use the tools to make sure everythinig has the proper access.

1 Like

Checked and openhab is a member of both the tty and dial groups. Thought it was as both bindings offer ttyUSB0 when either one or both USB serial adaptors is plugged in.

Looks like the modbus binding is 1.x binding. Have you check github for issues or tips for using with openhab2.

Initially I was using the Modbus 1.x binding from the standard add-on files but now moved to the 2.x version available by the Eclipse IoT Market. I have posted a similar question in the Modbus 2.x thread but was told that it was not a modbus problem so try elsewhere. They could be right as both the Modbus and Rego bindings won’t show the ttyUSB1 for selection.

Take a look at this post, maybe some helpful info.

https://community.openhab.org/t/modubs-configuration-for-ee800-device/21274

Thanks for the link but this is from 18 months ago and recommends going back to the 1.x version which doesn’t support things in the PaperUI. I could go back but would prefer to resolve the issue, if it is an issue with the PaperUI not being able to select anything but ttyUSB0 for either of the bindings. Should I raise it as a bug or is that not established yet?

I had the same issue a couple of days ago. The solution to my problem was:

  1. Add the entry to EXTRA_JAVA_OPTS
  2. Restart OH2 service (very important!)

Then they started to appear in the drop downs in the paperUI.

Hope this helps!

Sorry if I am being a bit thick but where and how do I add EXTRA_JAVA_OPTS on openhabian?

/etc/default/openhab2

sudo nano /etc/default/openhab2

Then paste in the EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"

then exit and yes to save.

I have added the EXTRA_JAVA_OPTS line but still no luck getting the PaperUI to offer anything but ttyUSB0.
Restarted openhab2.service but printenv does not list EXTRA_JAVA_OPTS as a variable so not sure if the solution does not work or my implementation of it.

If you can see issues related to opening the serial port with Linux, and you are using non standard serial ports (e.g. /dev/ttyAMA0) you might have to configure openHAB to detect and access the port correctly:

Adapt java command line arguments to include -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0 (where /dev/ttyAMA0 is the serial port). If you have multiple serial ports to configure, separate them with colon (:). Depending on openHAB installation method, you should modify start.sh, start_debug.sh, start.bat, or start_debug.bat (standalone/manual installation) or EXTRA_JAVA_OPTS in /etc/default/openhab2 (debian installation)
Depending on linux distribution, you might need to add the user running openHAB to dialout user group. With Debian openHAB installation: sudo usermod -a -G dialout openhab. The user will need to logout from all login instances and log back in to see their new group added. If the user added to this group still cannot get permission, rebooting the box to ensure the new group permission is attached to the user is suggested.
When using more than one USB-Serial converters, it may happen that the /dev/ttyUSB0 device is named /dev/ttyUSB1 after a reboot. To prevent this problem, alias names can be assigned to serial devices by adding them to /etc/udev/rules.d/99-com.rules

Here’s the link https://github.com/ssalonen/openhab2-addons/blob/modbus-openhab2-native-binding/addons/binding/org.openhab.binding.modbus/README.md#serial-port-configuration

Read thru the link, you may have a few extra things to setup.

Thanks although I have been through this github info before and tried the suggestions without success. I think I will have to give up on the PaperUI which I am pretty sure is where the problem lies and use the github readme to implement the three ‘things’ using the text files. instead.

Do you have anything showing in your log’s?

Whats the output of

dmesg -T | grep tty

ls -l /dev/ttyAMA0

ls -la /dev

Also check to see if you’ve done the following in

 /etc/init.d/openhab and to /usr/share/openhab/bin/openhab.sh

Add the following line.

"-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0 "

right after “-Dosgi.noShutdown=true”

The ttyAMA0 is listed but not sure why this is important as I want to be able to use two USB serial adaptors which are listed as ttyUSB0 and ttyUSB1 in ls -la /dev. Should I modify them in the files with =/dev/ttyUSB0), /dev/ttyUSB1?

Once I get that working I might address the labelling of the serial ports so that they can be plugged in randomly.

Can you provide a screen shot with the above outputs? AMA0 is listed tell’s nothing other than it’s listed. What are its permissions? Is it linked? If linked, whats the name? etc… for all the other info that’s needed to help troubleshoot an issue.

I would very much like to help solve your issue but with vague information this post may become extremely long with wild guesses from every direction.

Will post info tomorrow, many thanks.

I checked the two files you requested but neither exist. I do have a /etc/init/d/openhab2 file but no -Dosgi.noShutdown entry to put new line under. Below are the outputs you requested

[14:04:09] openhabian@openHABianPi:~$ dmesg -T | grep tty
[Mon Aug 13 16:57:05 2018] Kernel command line: 8250.nr_uarts=0 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbdepth=16 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3f000000 vc_mem.mem_size=0x3f600000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[Mon Aug 13 16:57:05 2018] console [tty1] enabled
[Mon Aug 13 16:57:05 2018] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[Mon Aug 13 16:57:22 2018] usb 1-1.4: cp210x converter now attached to ttyUSB0
[Mon Aug 13 16:57:22 2018] usb 1-1.3: pl2303 converter now attached to ttyUSB1
[Mon Aug 13 17:13:43 2018] pl2303 ttyUSB1: pl2303 converter now disconnected from ttyUSB1
[Tue Aug 14 13:54:06 2018] usb 1-1.3: pl2303 converter now attached to ttyUSB1

[14:07:20] openhabian@openHABianPi:~$ ls -l /dev/ttyAMA0
crw-rw---- 1 root dialout 204, 64 Aug 13 16:57 /dev/ttyAMA0

[14:08:36] openhabian@openHABianPi:~$ ls -la /dev
total 4
drwxr-xr-x 16 root root        3420 Aug 14 13:54 .
drwxr-xr-x 22 root root        4096 Aug  6 18:34 ..
crw-r--r--  1 root root     10, 235 Aug 13 16:57 autofs
drwxr-xr-x  2 root root         620 Aug 13 16:57 block
drwxr-xr-x  2 root root          60 Jan  1  1970 bsg
crw-------  1 root root     10, 234 Aug 13 16:56 btrfs-control
drwxr-xr-x  3 root root          60 Jan  1  1970 bus
crw-------  1 root root     10,  63 Aug 13 16:57 cachefiles
drwxr-xr-x  2 root root        2540 Aug 14 13:54 char
crw-------  1 root root      5,   1 Aug 13 16:57 console
crw-------  1 root root     10,  62 Aug 13 16:57 cpu_dma_latency
crw-------  1 root root     10, 203 Aug 13 16:56 cuse
drwxr-xr-x  7 root root         140 Aug 13 16:57 disk
crw-rw----  1 root video    29,   0 Aug 13 16:57 fb0
lrwxrwxrwx  1 root root          13 Nov  3  2016 fd -> /proc/self/fd
crw-rw-rw-  1 root root      1,   7 Aug 13 16:57 full
crw-rw-rw-  1 root root     10, 229 Aug 13 16:56 fuse
crw-rw----  1 root gpio    254,   0 Aug 13 16:57 gpiochip0
crw-rw----  1 root gpio    254,   1 Aug 13 16:57 gpiochip1
crw-rw----  1 root gpio    254,   2 Aug 13 16:57 gpiochip2
crw-rw----  1 root gpio    248,   0 Aug 13 16:57 gpiomem
crw-------  1 root root     10, 183 Aug 13 16:57 hwrng
lrwxrwxrwx  1 root root          25 Nov  3  2016 initctl -> /run/systemd/initctl/fifo
drwxr-xr-x  2 root root          60 Jan  1  1970 input
crw-r--r--  1 root root      1,  11 Aug 13 16:57 kmsg
lrwxrwxrwx  1 root root          28 Nov  3  2016 log -> /run/systemd/journal/dev-log
brw-rw----  1 root disk      7,   0 Aug 13 16:57 loop0
brw-rw----  1 root disk      7,   1 Aug 13 16:57 loop1
brw-rw----  1 root disk      7,   2 Aug 13 16:57 loop2
brw-rw----  1 root disk      7,   3 Aug 13 16:57 loop3
brw-rw----  1 root disk      7,   4 Aug 13 16:57 loop4
brw-rw----  1 root disk      7,   5 Aug 13 16:57 loop5
brw-rw----  1 root disk      7,   6 Aug 13 16:57 loop6
brw-rw----  1 root disk      7,   7 Aug 13 16:57 loop7
crw-rw----  1 root disk     10, 237 Aug 13 16:57 loop-control
drwxr-xr-x  2 root root          60 Aug 13 16:56 mapper
crw-r-----  1 root kmem      1,   1 Aug 13 16:57 mem
crw-------  1 root root     10,  59 Aug 13 16:57 memory_bandwidth
brw-rw----  1 root disk    179,   0 Aug 13 16:57 mmcblk0
brw-rw----  1 root disk    179,   1 Aug 13 16:57 mmcblk0p1
brw-rw----  1 root disk    179,   2 Aug 13 16:57 mmcblk0p2
drwxrwxrwt  2 root root          40 Jan  1  1970 mqueue
drwxr-xr-x  2 root root          60 Aug 13 16:56 net
crw-------  1 root root     10,  61 Aug 13 16:57 network_latency
crw-------  1 root root     10,  60 Aug 13 16:57 network_throughput
crw-rw-rw-  1 root root      1,   3 Aug 13 16:57 null
crw-------  1 root root    108,   0 Aug 13 16:56 ppp
crw-rw-rw-  1 root tty       5,   2 Aug 14 14:08 ptmx
drwxr-xr-x  2 root root           0 Nov  3  2016 pts
brw-rw----  1 root disk      1,   0 Aug 13 16:57 ram0
brw-rw----  1 root disk      1,   1 Aug 13 16:57 ram1
brw-rw----  1 root disk      1,  10 Aug 13 16:57 ram10
brw-rw----  1 root disk      1,  11 Aug 13 16:57 ram11
brw-rw----  1 root disk      1,  12 Aug 13 16:57 ram12
brw-rw----  1 root disk      1,  13 Aug 13 16:57 ram13
brw-rw----  1 root disk      1,  14 Aug 13 16:57 ram14
brw-rw----  1 root disk      1,  15 Aug 13 16:57 ram15
brw-rw----  1 root disk      1,   2 Aug 13 16:57 ram2
brw-rw----  1 root disk      1,   3 Aug 13 16:57 ram3
brw-rw----  1 root disk      1,   4 Aug 13 16:57 ram4
brw-rw----  1 root disk      1,   5 Aug 13 16:57 ram5
brw-rw----  1 root disk      1,   6 Aug 13 16:57 ram6
brw-rw----  1 root disk      1,   7 Aug 13 16:57 ram7
brw-rw----  1 root disk      1,   8 Aug 13 16:57 ram8
brw-rw----  1 root disk      1,   9 Aug 13 16:57 ram9
crw-rw-rw-  1 root root      1,   8 Aug 13 16:57 random
drwxr-xr-x  2 root root          60 Jan  1  1970 raw
crw-rw-r--  1 root netdev   10,  58 Aug 13 16:57 rfkill
brw-rw----  1 root disk      8,   0 Aug 13 16:57 sda
brw-rw----  1 root disk      8,   1 Aug 13 16:57 sda1
drwxr-xr-x  4 root root          80 Aug 13 16:57 serial
lrwxrwxrwx  1 root root           7 Aug 13 16:57 serial1 -> ttyAMA0
crw-rw----  1 root disk     21,   0 Aug 13 16:57 sg0
drwxrwxrwt  2 root root          40 Nov  3  2016 shm
drwxr-xr-x  3 root root         160 Aug 13 16:57 snd
lrwxrwxrwx  1 root root          15 Nov  3  2016 stderr -> /proc/self/fd/2
lrwxrwxrwx  1 root root          15 Nov  3  2016 stdin -> /proc/self/fd/0
lrwxrwxrwx  1 root root          15 Nov  3  2016 stdout -> /proc/self/fd/1
crw-rw-rw-  1 root tty       5,   0 Aug 14 13:58 tty
crw--w----  1 root tty       4,   0 Aug 13 16:57 tty0
crw--w----  1 root tty       4,   1 Aug 13 16:57 tty1
crw--w----  1 root tty       4,  10 Aug 13 16:57 tty10
crw--w----  1 root tty       4,  11 Aug 13 16:57 tty11
crw--w----  1 root tty       4,  12 Aug 13 16:57 tty12
crw--w----  1 root tty       4,  13 Aug 13 16:57 tty13
crw--w----  1 root tty       4,  14 Aug 13 16:57 tty14
crw--w----  1 root tty       4,  15 Aug 13 16:57 tty15
crw--w----  1 root tty       4,  16 Aug 13 16:57 tty16
crw--w----  1 root tty       4,  17 Aug 13 16:57 tty17
crw--w----  1 root tty       4,  18 Aug 13 16:57 tty18
crw--w----  1 root tty       4,  19 Aug 13 16:57 tty19
crw--w----  1 root tty       4,   2 Aug 13 16:57 tty2
crw--w----  1 root tty       4,  20 Aug 13 16:57 tty20
crw--w----  1 root tty       4,  21 Aug 13 16:57 tty21
crw--w----  1 root tty       4,  22 Aug 13 16:57 tty22
crw--w----  1 root tty       4,  23 Aug 13 16:57 tty23
crw--w----  1 root tty       4,  24 Aug 13 16:57 tty24
crw--w----  1 root tty       4,  25 Aug 13 16:57 tty25
crw--w----  1 root tty       4,  26 Aug 13 16:57 tty26
crw--w----  1 root tty       4,  27 Aug 13 16:57 tty27
crw--w----  1 root tty       4,  28 Aug 13 16:57 tty28
crw--w----  1 root tty       4,  29 Aug 13 16:57 tty29
crw--w----  1 root tty       4,   3 Aug 13 16:57 tty3
crw--w----  1 root tty       4,  30 Aug 13 16:57 tty30
crw--w----  1 root tty       4,  31 Aug 13 16:57 tty31
crw--w----  1 root tty       4,  32 Aug 13 16:57 tty32
crw--w----  1 root tty       4,  33 Aug 13 16:57 tty33
crw--w----  1 root tty       4,  34 Aug 13 16:57 tty34
crw--w----  1 root tty       4,  35 Aug 13 16:57 tty35
crw--w----  1 root tty       4,  36 Aug 13 16:57 tty36
crw--w----  1 root tty       4,  37 Aug 13 16:57 tty37
crw--w----  1 root tty       4,  38 Aug 13 16:57 tty38
crw--w----  1 root tty       4,  39 Aug 13 16:57 tty39
crw--w----  1 root tty       4,   4 Aug 13 16:57 tty4
crw--w----  1 root tty       4,  40 Aug 13 16:57 tty40
crw--w----  1 root tty       4,  41 Aug 13 16:57 tty41
crw--w----  1 root tty       4,  42 Aug 13 16:57 tty42
crw--w----  1 root tty       4,  43 Aug 13 16:57 tty43
crw--w----  1 root tty       4,  44 Aug 13 16:57 tty44
crw--w----  1 root tty       4,  45 Aug 13 16:57 tty45
crw--w----  1 root tty       4,  46 Aug 13 16:57 tty46
crw--w----  1 root tty       4,  47 Aug 13 16:57 tty47
crw--w----  1 root tty       4,  48 Aug 13 16:57 tty48
crw--w----  1 root tty       4,  49 Aug 13 16:57 tty49
crw--w----  1 root tty       4,   5 Aug 13 16:57 tty5
crw--w----  1 root tty       4,  50 Aug 13 16:57 tty50
crw--w----  1 root tty       4,  51 Aug 13 16:57 tty51
crw--w----  1 root tty       4,  52 Aug 13 16:57 tty52
crw--w----  1 root tty       4,  53 Aug 13 16:57 tty53
crw--w----  1 root tty       4,  54 Aug 13 16:57 tty54
crw--w----  1 root tty       4,  55 Aug 13 16:57 tty55
crw--w----  1 root tty       4,  56 Aug 13 16:57 tty56
crw--w----  1 root tty       4,  57 Aug 13 16:57 tty57
crw--w----  1 root tty       4,  58 Aug 13 16:57 tty58
crw--w----  1 root tty       4,  59 Aug 13 16:57 tty59
crw--w----  1 root tty       4,   6 Aug 13 16:57 tty6
crw--w----  1 root tty       4,  60 Aug 13 16:57 tty60
crw--w----  1 root tty       4,  61 Aug 13 16:57 tty61
crw--w----  1 root tty       4,  62 Aug 13 16:57 tty62
crw--w----  1 root tty       4,  63 Aug 13 16:57 tty63
crw--w----  1 root tty       4,   7 Aug 13 16:57 tty7
crw--w----  1 root tty       4,   8 Aug 13 16:57 tty8
crw--w----  1 root tty       4,   9 Aug 13 16:57 tty9
crw-rw----  1 root dialout 204,  64 Aug 13 16:57 ttyAMA0
crw-------  1 root root      5,   3 Aug 13 16:57 ttyprintk
crw-rw----  1 root dialout 188,   0 Aug 14 14:08 ttyUSB0
crw-rw----  1 root dialout 188,   1 Aug 14 13:54 ttyUSB1
crw-------  1 root root     10, 239 Aug 13 16:56 uhid
crw-------  1 root root     10, 223 Aug 13 16:56 uinput
crw-rw-rw-  1 root root      1,   9 Aug 13 16:57 urandom
crw-rw----  1 root video   246,   0 Aug 13 16:57 vchiq
crw-rw----  1 root video   249,   0 Aug 13 16:57 vcio
crw-------  1 root root    250,   0 Aug 13 16:57 vc-mem
crw-rw----  1 root tty       7,   0 Aug 13 16:57 vcs
crw-rw----  1 root tty       7,   1 Aug 13 16:57 vcs1
crw-rw----  1 root tty       7,   2 Aug 13 16:57 vcs2
crw-rw----  1 root tty       7,   3 Aug 13 16:57 vcs3
crw-rw----  1 root tty       7,   4 Aug 13 16:57 vcs4
crw-rw----  1 root tty       7,   5 Aug 13 16:57 vcs5
crw-rw----  1 root tty       7,   6 Aug 13 16:57 vcs6
crw-rw----  1 root tty       7, 128 Aug 13 16:57 vcsa
crw-rw----  1 root tty       7, 129 Aug 13 16:57 vcsa1
crw-rw----  1 root tty       7, 130 Aug 13 16:57 vcsa2
crw-rw----  1 root tty       7, 131 Aug 13 16:57 vcsa3
crw-rw----  1 root tty       7, 132 Aug 13 16:57 vcsa4
crw-rw----  1 root tty       7, 133 Aug 13 16:57 vcsa5
crw-rw----  1 root tty       7, 134 Aug 13 16:57 vcsa6
crw-------  1 root root     10, 137 Aug 13 16:56 vhci
crw-------  1 root root     10, 130 Aug 13 16:57 watchdog
crw-------  1 root root    252,   0 Aug 13 16:57 watchdog0
crw-rw-rw-  1 root root      1,   5 Aug 13 16:57 zero

Thanks, this will help. Do you have any errors in your logs regarding modbus, if so please post.

Looking at ls -l /dev/ttyAMA0 output the owner is root and user is dialout. Should this be tty instead of dialout? Asking cause I’m not sure but currently looking thru some doc’s to find out. If you know that it’s correct let me know.

Edit: Do you have a modbus.cfg file, if so please post the contents.

Think I may have overlooked something. Your not able to select ttyUSB1 and looking back over the post it may not be added to the EXTRA JAVA OPTS if you copied the examples above EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"

I dont see /dev/ttyUSB1 included. Add the /dev/ttyUSB1 to your extra java opts file and save.
Then run this:
sudo service openhab2 stop && sudo rm -rf /var/lib/openhab2/cache/* && sudo rm -rf /var/lib/openhab2/tmp/* && sudo reboot
to clean up the cache & temp files as well as reboot the system. Then you should be able to see and select the USB1.