MOdbus binding, changing of USB port issue on RPI

Today my openhab crashed(Again after 7 months) and my tenant had to use hard reboot(unplugging power for 2seconds). So now when it rebooted is seems like my modbus usb dongle is located at USB0, at least that and AMO0 is the only choices i get up in paperUI. It says that the modbus thing is online but the modbus poller are offline:

Status: OFFLINE - COMMUNICATION_ERROR Error with read: org.openhab.io.transport.modbus.ModbusConnectionException: Error connecting to endpoint ModbusSerialSlaveEndpoint@15f4ab8[portName=/dev/ttyUSB2] ![Capture1|690x361]

So its seems like the poller is still try to use usb2, which should be usb0. What can I do to change this and how to avoid this in the future?

You could start with the docs

To change your Modbus serial Thing port parameter, depends how you set it yourself. PaperUI or xxx.things file.

I set in paperUI, however it seems like you might be right that there is a conflict with the .things file somehow. How to give static usb name, and get this to show up in paperUI?

You might need to follow this advice https://www.openhab.org/docs/administration/serial.html#serial-port-configuration

Yes. You cannot alter anything in PaperUI that you set in a xxx.things file, if you use things files. You have to edit your things file.

Hi

To avoid a similar issue with the Velbus USB interface, I set them up using the /dev/serial/by-id path

This way, it doesn’t matter what Symlink the OS assigns.

Good luck

Hi @MDAR can you clearify this dev/serial/by-id path? Did you then set it up in.things file or in paperUI?

Hi Kim

I haven’t tried it directly from openHAB2 yet, as I tend to use a TCP gateway app so that I can make multiple connections.

Give me a minute and I’ll try it on a test machine. (It’s something I’ve been meaning to test for a while)

I’ve just tried this directly in a .things file and it didn’t go well

/dev/serial/by-id/usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00

There’s some advice here that you might be able to leverage