Openhab modbus serial communication

Hello community. The questions are about possibility to make modbus serial port communication. I use raspberry PI with running openhab server as master device. And I have RS232 slave device.

  1. Can I use raspberry PI USB port ? And then using USB/RS232 converter to connect to slave device.

  2. If I can use USB port, how can I distinguish these ports in .thing file (if I use for instance upper left USB port, what name I must type in port parameter of modbus serial Bridge) ?


Your operating system assigns names to serial devices it discovers, like ttyAMA0

There is a risk of this name changing if you swap sockets or add other devices, so you usually have to “do something” to make sure the same name is kept.
The notes for the serial binding offer a start

As I understand, if system discovers 4 USB ports, it assign /dev/ttyUSB0…/dev/ttyUSB3. And these names I must type in modbus serial bridge configuration. Am I correct ?

Yes, you will find examples in this forum.

One more question.
There is a risk of this name changing if you swap sockets or add other devices - what does it mean ?

As we know RS232 is point-to-point interface. I will not connect more than one device to USB serial port (beacuse I know that there will be interface converting to RS232).

Is there some order, in which system assign names to USB ports (for instance upper left USB port is always /dev/ttyUSB0 etc).

I know little about how unix-y operating systems assign port names.
Did you read the link I pointed to?

Yes, I read this article. And I read other article:

Where I found next sentence: openHABian comes with a menu option to configure the serial ports automatically. So all the rest here is only relevant for non-openHABian users. (I use openHABian).

But I don’t know where this menu is situated. After this I decide to find out conformity between ports and their names.