Serial gateway issues - Ubuntu 16



  • Greetings All.
    I have hit a wall here. I am setting up openhab2 on my Ubuntu box. Im running Ubuntu 16.04 LTS, with Openhab 2 stable release installed.

    I can get every other thing configured and running smoothly EXCEPT for this serial gateway.

    My gateway is an Arduino Uno, flashed with the lastest stable MySensors library and serial gateway sketch. When its connected to the box via USB it comes up as /dev/ttyAMC0, and Im able to see it running via serial monitors. But when I go into openhab to add it the gateway still shows up as offline. I've already added openhab to 'dialout' and 'tty' groups and made the java exceptions changes and enabled the serial transport via karaf console as noted in the installation instructions.

    The only thing the logs are producing is a generic "unable to connect to serial port tty/ACM0 message.

    Im at a total loss here as Im a hardware guy, not really a software guy.


  • Hero Member

    Please post (copy and paste) the exact error message from karaf console.

    Is the Uno registered by Linux? dmesg, lsusb. Please check the spelling: is it ACM0 or AMC0?



  • Ok I have made some progress. I have a gateway showing up as online and it is discovering nodes...but after a while it all goes 'offline' and Im stuck rebooting the entire box.

    The UNO is registering with Ubuntu, it shows up as /dev/ttyACM0 (Arduino/Genuino Uno).

    The initial error message (I lost the copy of it) basically said it was "unable to open the serial port /dev/ttyACM0"

    What I did to get the gateway to come online.

    I added the following item in Openhab2.
    String UnoGateway { serial="/dev/ttyACM0@115200" }

    Then I added the following to the /etc/defaults/openhab2 file.

    #########################
    ## JAVA OPTIONS
    ## Additional options for the JAVA_OPTS environment variable.
    ## These will be appended to the execution of the openHAB Java runtime in front of a$
    ##
    ## A couple of independent examples:
    ##   EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0"
    ##   EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/$
    ##   EXTRA_JAVA_OPTS="-Djna.library.path=/lib/arm-linux-gnueabihf/ -Duser.timezone=E$
    
    EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0"
    

    I also added that line to the karaf runtime file.

    But I have no idea now why it keeps going offline.


  • Hero Member

    @dbagioni Is there an error message in the log to the time the gateway changes its state to offline?

    Have you considered using the binding for OH2 and MySensors?


 

386
Online

7.6k
Users

8.5k
Topics

91.2k
Posts