Cgate and OpenHab

Discussion in 'General Discussion' started by anatheama, Jun 26, 2021.

  1. anatheama

    anatheama

    Joined:
    Jun 26, 2021
    Messages:
    2
    Likes Received:
    0
    Apologies in advance if this is the wrong place, if this has been answered elsewhere - a solution would be welcome.

    I'm attempting to POC an OpenHab/Cbus integration for a wider solution.
    Have a 4 channel L5504VRF connected to a 5500PC serial Adapter.
    I loaded a project into the unit via USB and cycled plugs from toolkit on a windows 10 PC running ToolKit 1.15.7
    I then set up the clipsal cgate software on a SBC based on the guide https://www.cbusforums.com/forums/c-bus-toolkit-and-c-gate-software.4, basically the tarball, select the appropriate serial port and add ser2sock, and a non-system JRE8 instance.

    Connecting a serial adapter to the SBC and then connecting to it as a CNI from the windows machine works fine. I can see state and perform the same switch toggling. I can see the network, project units etc. To me this indicates that the Serial adapter can be trusted, the SBC can be trusted and the JRE8 version can be trusted.

    Openhab seems to not play quite so nicely though.
    Deployed to the same SBC running the cgate processes.
    The CBus binding installs correctly, and the Cbus bridge detects the running cbus process on 127.0.0.1 or 192.168.X.X
    The event logs shows the successful connection and noOp heartbeats from the process bridge.
    The Cbus networkconnection however will not connect, have tried passing it the id number and projectname for both the local and CNI projects, with identical results.
    The event log indicates that net list_all called from the openhab refresh is failing to complete.
    A manual connection attempt via the cgate.sh using basic commands works fine and a project and network appears to be created locally, albeit without any of the units live in the cbus hardware. Is there a more complete list of the commands that can be used to retrieve existing content from the cbus device and populate it into the project?


    OpenHab will not, however show this network bridge as 'online' as it "Cannot trigger scan for thing types '[cbus:network]' on 'CBusNetworkDiscovery' "

    From here on I'm assuming:
    It looks like the commands run by openhab such as 'net list_all' as part of its discovery are for an earlier version of clipsel and thus dont work (except it seemed to be correctly found in the log)
    OR
    there is something going on between OpenHab on Java11 and the ClipSal process on Java8
    OR
    there is something super obvious about user permissions that i need to run to let OH see the project files/cgate process.

    Can anyone advise possible next steps for debug?

    Equipment:
    armhf32 tinkerboardS running Buster
    System java:
    openjdk version "11.0.11" 2021-04-20 LTS
    OpenJDK Runtime Environment Zulu11.48+21-CA (build 11.0.11+9-LTS)
    OpenJDK Client VM Zulu11.48+21-CA (build 11.0.11+9-LTS, mixed mode)

    CGate java:
    openjdk version "1.8.0_275"
    OpenJDK Runtime Environment (Zulu 8.50.51.263-CA-linux_aarch32hf) (build 1.8.0_275-b01)
    OpenJDK Client VM (Zulu 8.50.51.263-CA-linux_aarch32hf) (build 25.275-b01, mixed mode)

    Process runs as root - either as cgate.sh interactively or as a system daemon:

    cat cgate.sh
    #!/bin/sh
    #
    # Simple wrapper script for C-Gate on Linux machines.
    # - It discovers the serial ports and passes them to the JVM.
    # - The loop is designed to support a server restart (result code 126).
    #

    RESTART=126
    while [ $RESTART -eq 126 ]
    do
    DEVICE_LIST=`ls -1 /dev/ttyS1 | paste -sd ":"`
    /usr/local/bin/zulu8.50.51.263-ca-jdk8.0.275-linux_aarch32hf/bin/java -Djava.library.path=. -DSERIAL_PORT_LIST=$DEVICE_LIST -jar cgate.jar
    RESTART=$?
    done


    Any advice super appreciated
    Thanks and regards.
     

    Attached Files:

    anatheama, Jun 26, 2021
    #1
  2. anatheama

    anatheama

    Joined:
    Jun 26, 2021
    Messages:
    2
    Likes Received:
    0
    Fixed. For future reference: add the connection as cni, with 'ip:port' port being whatever you set ser2sock to run on when creating network. For OH to pick it up it the network name seems to need to be numeric? In any event, simply copy a tag file over from toolkit on windows and then just replace iPs and COM/ttySn as needed. Turn on anything about auto discovery.
     
    anatheama, Jul 3, 2021
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.