PaperUI unable to select ttyUSB1

I had already added the /dev/ttyUSB1 to the EXTRA JAVA OPTs but tried your clean up commands but still no luck. Neither the Heat Pump binding or Mod Bus binding can select anything but ttyUSB0. I know both USB ports work as I have got the Heat Pump going via the PaperUI and ModBus via text files. As I now have got it working for both I am giving up on the PaperUI issue and will use the text files for the ModBus as a work around.
Many thanks for all your help.

One last thing, both will work but only one at a time correct?

If so, look back at the output of ls -la /dev I see ttyAMA0 and a soft link to serial1. What I don’t see is the other serial having a soft link, its a directory, with no write access for the user and group. :thinking:

Both work and can use the heat pump on USB0 selected in PaperUI and Modbus selects USB1 in the things file.

But you need two serial devices to work at the same time. Compare your output with this screen shot.:astonished:

Screenshot%20at%202018-08-14%2016-37-25

On the RPI3 board the AMA serial is used for the Bluetooth connection. There are two serial ports enabled and these can be seen to be linked to their ttyUSBx devices in /dev/erial/by-id directory

[10:10:34] openhabian@openhabtest:~$ ls -all /dev/serial/by-id
total 0
drwxr-xr-x 2 root root 80 Aug 16 10:01 .
drwxr-xr-x 4 root root 80 Aug 16 10:01 …
lrwxrwxrwx 1 root root 13 Aug 16 10:01 usb-1a86_USB2.0-Serial-if00-port0 -> …/…/ttyUSB0
lrwxrwxrwx 1 root root 13 Aug 16 10:01 usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0 -> …/…/ttyUSB1

Got back to this as it is still causing problems and is inconsistent in its presentation. Not figured out how but occasionally when using the PaperUI I can edit the serial port location, other times only offers ports available in the drop down.
I have created links to fix ttyUSB0 and ttyUSB1 to specific interfaces called ttyModBus and ttyRego,

SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="ttyUSBModBus", GROUP="dialout", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="ttyUSBRego", GROUP="dialout", MODE="0666"

added

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/ttyUSB0:/dev/tty/USB1:/dev/ttyRego:/dev/ttyModBus"

These ports are passed to the openhab2.service and appear in the

sytemctl status openhab2.service
  

-Dgnu.io.rxtx.SerialPorts=/ttyUSB0:/dev/tty/USB1:/dev/ttyRego:/dev/ttyModBus

 but when I check via the console for the env variable it only lists 

```javascript
String  gnu.io.rxtx.SerialPorts /dev/ttyUSB1

I have cleaned the cache using openhab-cli but makes no difference, only ttyUSB1 is offered in the PaperUI for selection as this appears to be the only port JAVA is seeing.

Tried editing the json things file and it reported

[hingStatusInfoChangedEvent] - 'regoheatpump:serialRego6xx:53f727c3' changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR): Serial port with name /dev/ttyRego does not exist. Available port names: [/dev/ttyAMA0, /dev/ttyUSB1, /dev/ttyUSB0]

and the env variable now has four ports appearing but the last is truncated.

String          gnu.io.rxtx.SerialPorts /ttyUSB0:/dev/tty/USB1:/dev/ttyRego:/dev/ttyM

Any ideas why the other ports aren’t available and why on USB1 is offered?

I am running on an RPI 3B having moved Root to an external USB hard drive so unlikely to be SD card issues

openHAB Distribution Version Information
----------------------------------------
build-no        : Milestone Build
online-repo     : https://openhab.jfrog.io/openhab/online-repo-milestone/2.4

Repository        Version
----------------------------------------
openhab-distro  : 2.4.0.M3
smarthome       : 0.10.0.oh240M3
openhab-core    : 2.4.0.M3
openhab1-addons : 1.13.0.M3
openhab2-addons : 2.4.0.M3
karaf           : 4.1.5

Here’s a post about symlinks and issues that may help.
https://community.openhab.org/t/raspberry-pi-make-serial-usb-ports-persistent-via-symlinks/35847

Also, have you looked if there may be a change to the modbus.cfg (/etc/openhab2/services) file for your setup?

Thanks for the link, checked it out and I have done all that they recommend. I have been configuring the ModBus using things file

Bridge modbus:serial:endpoint [ port="/dev/ttyModBus", baud = 9600,stopBits = "1", parity = "none", dataBits = 8, encoding ="rtu" ] {
    Bridge poller holding [ start=1032, length=2, refresh=30000, type="holding"] {
       Thing data HeatMeter_HeatPower    [readStart="1032", readValueType="float32",readTransform="default" ]      
    }   
}

Same problem arises, reports port not found.
I am sure it must be a problem with the JAVA port access as although I tell JAVA to use four ports the env lists only tty USB0

The modbus.cfg file says you can override settings if errors with default parameters. Not sure if this will solve the issue but may be worth trying.

EDIT: Since you have a udev rule set for the symlinks, ttyUSBModBus and ttyUSBRego, try changing your EXTRA_JAVA_OPTS to include only these. You may have to stop and restart OH for change to happen. Then see what the output of, ls -l /dev/ttyUSBRego and ttyUSBModBus show. They should indicate a symlink to the USB1 or whatever link you have assigned above.

@H102 you seem to be talking about modbus.cfg file. Are you mixing 1.x and 2.x bindings?

Quote from readme:

Some examples:

* parameter="value" for text parameters
* parameter=4 for integer
* parameter=true for boolean

Is your stopBit parameter with double quotes?

Miika - The stop bit should be a text value according to the documentation so quotes correct.
https://www.openhab.org/addons/bindings/modbus/#thing-configuration. I am using the newly merged 2.4 binding from 2.4.0.M3 which can still use the things files.

1 Like

Tried just the symlinks in the udev rules file but same problem PaperUI only allows /dev/USB0 to be selected and Things file causes error report reading ttyUSBModBus. I did spot that I used ttyUSBModBus in the udev file and ttyModBus in the EXTRA_JAVA_OPTS but corrected that and again no change in result.

Hi,
have you solved this problem? I’m facing the same.
Thanks

Hi,

Anyone solve this problem? I still have the same issue.

  • I’ve udpated to the last snapshot
  • clean cache and tmp
  • symlinks added in udev rules
    lrwxrwxrwx 1 root root 7 wrz 29 18:00 /dev/ttyBT -> ttyACM0
    lrwxrwxrwx 1 root root 7 wrz 29 18:00 /dev/ttyZigbee -> ttyACM1
    lrwxrwxrwx 1 root root 7 wrz 29 18:00 /dev/ttyZwave -> ttyACM2
  • EXTRA_JAVA_OPTS in /etc/default/openhab2
    EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyBT:/dev/ttyZwave:/dev/ttyZigbee"
  • variable is visible in systemctl status openhab2.service:
    -Dgnu.io.rxtx.SerialPorts=/dev/ttyBT:/dev/ttyZwave:/dev/ttyZigbee

Any ideas?