Random serial (modbus) disconnect

  • Platform information:

    • Hardware:

      Rpi 3b+
      
    • OS:

       Linux openhabian 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l GNU/Linux
      
    • Java Runtime Environment:

      openjdk version "11.0.10" 2021-01-19 LTS
      OpenJDK Runtime Environment Zulu11.45+27-CA (build 11.0.10+9-LTS)
      OpenJDK Client VM Zulu11.45+27-CA (build 11.0.10+9-LTS, mixed mode)
      
  • openHAB version:

        3.1.0-SNAPSHOT - Build #2240
    
  • Issue of the topic:

I am using a USB -> Rs485 to communicate with our ventilation over modbus. Settings are 9600 baud, 8 data bits, 1 stop bit and even parity. At random, and when making changes to “modbus:poller” things, the serial gets disconnected (/dev/ttyUSB0). The only way to get it back online is either by rebooting or restarting openhab through “sudo systemctl restart openhab”. Using this item: RS485 USB Converter FTDI to communicate.

The log throws the following message:

[ERROR] [ling.ModbusSlaveConnectionFactoryImpl] - re-connect reached max tries 10, throwing last error: Could not get port identifier, maybe insufficient permissions. null. Connection SerialConnection [m_SerialPort=null, m_Parameters.getPortName()=/dev/ttyUSB0]. Endpoint ModbusSerialSlaveEndpoint [getPortName()=/dev/ttyUSB0]

I have made sure the port is added in /etc/default/openhab under javaopts, and the openhab user is a member of both tty and dialup groups. I have added a udev rule:

SUBSYSTEM==“tty”, ENV{ID_PATH}==“platform-3f980000.usb-usb-0:1.1.3:1.0”, SYMLINK+=“ttyModbus”, GROUP=“tty”, MODE=“0666”

This creates a symlink.but this does not work at all in openhab.

I am a bit unsure what to, so any pointers in the right direction is most welcome! Please tell me if I posted this in the wrong subforum as I am still quite new to the OpenHAB community!

Best regards,
Henrik