fruggy83 / openocean

27 stars 11 forks source link

Help Wanted: Cannot connect to USB300 #46

Closed lawarn closed 5 years ago

lawarn commented 5 years ago

Hi, I'm running the latest docker openhab version on a QNAP TS453. Unfortunately I can't connect to my USB300.

I tried the following: Install Enocean Binding Add Thing -> Enocean Gateway with Path = /dev/ttyUSB0

OH gives me the Status:OFFLINE - CONFIGURATION_ERROR Port could not be found.

I tried Openhab with a virtual machine running ubuntu server on my notebook which works perfect so the hardware might not be the problem.

Is it possible that i don't have the proper permissions to access the stick? Running "ls -l /dev/ttyUSB0" only shows "crw------- 1 root root 188, 0 Jan 5 21:01 /dev/ttyUSB0"

but i already added user openhab to dialout and tty group

any help would be appreciated as i'm not very into Linux and Docker ;)

Cheers,

Lars

fruggy83 commented 5 years ago

Hi @dominikkv,

can you help? If I am not wrong, you are already running as dockerized solution, are not you?

Best regards Daniel

dominikkv commented 5 years ago

Hi @lawarn,

here is my (old) docker-compose entry for OpenHAB (only USB relevant things):

version: '3'
services:
  openhab:
    image: openhab/openhab:2.4.0-amd64-debian
    container_name: openhab_container
    environment:
      EXTRA_JAVA_OPTS: "-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0" 
    tty: true
    devices:
      - "/dev/ttyUSB0"

Then, make sure to log in into karaf and install feature:install openhab-transport-serial

Now go into your openhab container docker exec -it openhab_container bash and check if you have any log file at /run/lock/ and you see your USB device at /dev/tty*

I experienced that the lock file was not always deleted after container reboot. To bypass this issue and to be able to access the USB device by many programs, I created another container running ser2net which has access to the device, and forwards the traffic throgh tcp. Put the two containers into the same network. In OpenHAB, you have to set path="rfc2217://ser2net:3001" (ser2net is the service name).

edgarjung commented 5 years ago

Hi Lars, your /dev/ttyUSB0 shows group root and owner root. Add your openhab to group root or do a sudo chmod 666 to /dev/ttyUSB0.

Best regards @gar

lawarn commented 5 years ago

I want to thank all of you for your answers. @edgarjung provided the solution, sometimes it's the simple things!

Regards,

Lars