Serial binding says port is not known /dev/ttyUSB0

  • Platform information:
    • Hardware: Raspberry Pi 4, 8GB
    • OS: Raspbian OS 64 Bit
    • Java Runtime Environment:
root@raspberrypi:/dev# java -version
openjdk version "11.0.10" 2021-01-19 LTS
OpenJDK Runtime Environment Zulu11.45+27-CA (build 11.0.10+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.45+27-CA (build 11.0.10+9-LTS, mixed mode)
  • openHAB version: 3.0.2, running in Docker
  • Issue of the topic:

I’m running Openhab 3.0.2 inside a Docker container. I’m able to access the console of the Openhab installation. I’m able to read out /dev/ttyUSB0, but the Serial binding notify that the port /dev/ttyUSB0 is not known. What do I have to do, to access the Serial interface in Openhab?

  • Please post configurations (if applicable):
UID: serial:serialBridge:c06017d258
label: Serial Bridge
thingTypeUID: serial:serialBridge
configuration:
  baudRate: 9600
  charset: UTF-8
  serialPort: " /dev/ttyUSB0"
  dataBits: 8
  stopBits: "1"
  parity: N

Have you mapped the device to the container. I have something like that:

devices:
      - "/dev/ttyUSB0:/dev/ttyS0"

in my docker-compose.yml.

Maybe the leading space in the serial port definition?

Other things you can check:

  1. Is the device /dev/ttyUSB0 defined?
  2. Is the device readable and writeable by the user running openhab?

Thank you franks for your fast reply.
The leading space in front of /dev/ttyUSB0 doesn’t do anything
And the device is defined, because I can read the serial communication via cat /dev/ttypUSB0
How can I check if the device is readable from user running openhab?
My openhab instance is running inside a Docker container. And I’m able to start command line inside openhab docker container. And I can read all data there as well. But not possible to attach this signal into Openhab things definition.

From inside the container? See my edited answer before.

As you, it seems, already have. Open a shell inside the running container and do the cat /dev/ttyUSB0 from there. As you can see, I mapped the outside device (/dev/ttyUSB0) to the standard serial port #1 (/dev/ttyS0). But this should not make a difference.

I am able to read from inside the Container using cat /dev/ttyUSB0
I had a mapping in my docker compose

Any ideas left?
I really need to get this thing done :slight_smile:

I solved this issue by not using the serial binding in openHAB. I use the following library which receives/sends the serial port data. In my case the port /dev/ttyUSB0 on raspi4 is not available in openHAB. I send commands from openHAB over MQTT to the MQTT-IO library which then sends/receives data over serial port: