Openhab, Symlink, modbus - not port?!

Hello all. i am not a specialist in openhab, i nowadays is learning. i have a questions at the my learning. Please help me)
i created Symlink СhinaArduino for my arduino and this works now.
but when I run openhab i see error on console
in etc/init.d/openhab i am added string in args: -Dgnu.io.rxtx.SerialPorts=/dev/ChinaArduino4
(https://github.com/openhab/openhab/wiki/symlinks)

 Error connecting connection SerialConnection@8970bc[portName=/dev/ChinaArduino4,port=<null>] for e                                                        ndpoint ModbusSerialSlaveEndpoint@4cc1fd[portName=/dev/ChinaArduino4]: Could not get port identifier, maybe insufficient permissions. null
15:02:08.074 [WARN ] [.b.modbus.internal.ModbusSlave:355  ] - ModbusSlave (slave1): Error getting a new connection for endpoint ModbusSerialSlaveEndpoint@4cc1fd  [portName=/dev/ChinaArduino4]. Error was: Unable to validate object
15:02:08.085 [WARN ] [.b.modbus.internal.ModbusSlave:495  ] - ModbusSlave (slave1) not connected -- aborting read request net.wimpi.modbus.msg.ReadMultipleRegistersRequest@1babac. Endpoint ModbusSerialSlaveEndpoint@4cc1fd[portName=/dev/ChinaArduino4]
15:02:12.110 [ERROR] [pi.modbus.net.SerialConnection:125  ] - Could not get port dentifier, maybe nsufficient permissions. null
15:02:12.113 [ERROR] [dbusSlaveConnectionFactoryImpl:225  ] - connect try 1/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@1c5572e[portName=/dev/ChinaArduino4,port=<null>]. Endpoint                                                         ModbusSerialSlaveEndpoint@4cc1fd[portName=/dev/ChinaArduino4]
15:02:12.179 [ERROR] [pi.modbus.net.SerialConnection:125  ] - Could not get port identifier, maybe insufficient permissions. null
15:02:12.183 [ERROR] [dbusSlaveConnectionFactoryImpl:225  ] - connect try 2/3 er                                                        ror: Could not get port identifier, maybe insufficient permissions. null. Connec                                                        tion SerialConnection@1c5572e[portName=/dev/ChinaArduino4,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@4cc1fd[portName=/dev/ChinaArduino4]
15:02:12.245 [ERROR] [pi.modbus.net.SerialConnection:125  ] - Could not get portidentifier, maybe insufficient permissions. null
15:02:12.248 [ERROR] [dbusSlaveConnectionFactoryImpl:225  ] - connect try 3/3 error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@1c5572e[portName=/dev/ChinaArduino4,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@4cc1fd[portName=/dev/ChinaArduino4]
15:02:12.255 [ERROR] [dbusSlaveConnectionFactoryImpl:228  ] - re-connect reached max tries 3, throwing last error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection@1c5572e[portName=/dev/ChinaArduino4,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@4cc1fd[portName=/dev/ChinaArduino4]

root@raspberrypi:/home/pi# ls /dev -l | grep USB
lrwxrwxrwx 1 root root           7 ноя 24 18:19 ChinaArduino3 -> ttyUSB1
lrwxrwxrwx 1 root root           7 ноя 24 18:19 ChinaArduino4 -> ttyUSB0
crw-rw-rw- 1 root dialout 188,   0 ноя 24 18:19 ttyUSB0
crw-rw-rw- 1 root dialout 188,   1 ноя 24 18:19 ttyUSB1

A lot of hidden rocks under the water. How To Fix? Please help)

Do you have the correct permissions to read the serial port?

If you are using apt installation of openhab, the openhab user must be part of dialout group: Check note 4 in serial binding wiki page

Best
Sasmi

1 Like

Thank you for answering my questions
i used not apt-get install method.
i don’t have openhab user
This is my permission:

root@raspberrypi:/home/pi# ls /dev -la | grep USB
lrwxrwxrwx  1 root root           7 ноя 28 18:17 ChinaArduino3 -> ttyUSB0
lrwxrwxrwx  1 root root           7 ноя 28 18:17 ChinaArduino4 -> ttyUSB1
crwxrwxrwx  1 root dialout 188,   0 ноя 28 18:17 ttyUSB0
crwxrwxrwx  1 root dialout 188,   1 ноя 28 18:17 ttyUSB1

Have you tried the device (ttyUSB#) directly, and not the symlink?

Best
Sami

1 Like

Yes, of course.
When i use ttyUSB* this is nice works.
I’m in the wrong…

Hi @1injener!

Just a couple of questions:

  • Can you show use your udev rule?
  • What have you specified in the MODE parameter?

Best regards,

Aitor

1 Like

i use:

SUBSYSTEM=="tty", ATTRS{devpath}=="1.4.1", SYMLINK+="ChinaArduino1",GROUP="dialout", MODE="0777"
SUBSYSTEM=="tty", ATTRS{devpath}=="1.4.2", SYMLINK+="ChinaArduino2",GROUP="dialout", MODE="0777"
SUBSYSTEM=="tty", ATTRS{devpath}=="1.4.3", SYMLINK+="ChinaArduino3",GROUP="dialout", MODE="0777"
SUBSYSTEM=="tty", ATTRS{devpath}=="1.4.4", SYMLINK+="ChinaArduino4",GROUP="dialout", MODE="0777"

and when i use MODE=“0666” (as described in https://github.com/openhab/openhab/wiki/symlinks) i have error…

Ummmm… I’m not really sure what’s going on here…

Why are you editing the /etc/init.d/openhab file instead of the /etc/default/openhab one? By the way, you need to add the “-Dgnu.io.rxtx.SerialPorts=/dev/ChinaArduino4” string to the JAVA_ARGS field instead of the OPENHAB_ARGS field, just to be sure that you are editing the correct parameter.

Best regards,

Aitor

1 Like

Good afternoon!
Of course, I did it.

in default i have java version 1.7. At the same time I had an other error to modbus and i update java to 1.8.

root@raspberrypi:/home/pi# java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode)

reminder (it can help?): my openhab version: 1.8.3
(in this version there is an error with modbus binding and I replaced the file org.openhab.binding.modbus-1.8.3.jar to org.openhab.binding.modbus-1.9.0.jar - error disappeared. Thanks ssalonen! )
/dev/ttyUSB0 - work good
symlink - have error.