C-Gate on PI cannot connect with toolkit

Discussion in 'C-Bus Toolkit and C-Gate Software' started by discjockeyr, Apr 25, 2024.

  1. discjockeyr

    discjockeyr

    Joined:
    Jan 9, 2007
    Messages:
    59
    Likes Received:
    0
    Hi, i have setup the homebridge many years ago on raspberry PI and control my cbus with apple homekit but every time i need to change something on my cbus network i need to use the USB-serial cable to connect directly. I never manage to connect to remote c-gate with toolkit. The message i get is "Cannot connect to C-Gate server"
    the procedure i try is
    Connect to remote C-Gate-- IP:port (20123)

    Any idea what is my mistake?

    Thanks
     
    discjockeyr, Apr 25, 2024
    #1
  2. discjockeyr

    Conformist

    Joined:
    Aug 4, 2004
    Messages:
    762
    Likes Received:
    68
    Location:
    Adelaide, South Australia
    Have you checked the CGate access.txt file loaded on the Pi to allow remote programming from Toolkit?
    Mine is typically located in /usr/local/bin/cgate/config
    I got tired of trying to allow for all the different options so I just put a wildcard on everything (I'm satisfied it's not exposed to the wide world). There's a few duplicates in there I know, but I can't be bothered with the housekeeping ;-)
    So, mine looks like this...

    ##C-Gate Server Access Control File
    ## This file was written automatically by a command issued to the server
    ## Created:Tue Oct 05 16:22:26 CST 2004
    interface 0:0:0:0:0:0:0:1 Program
    interface 127.0.0.1 Program
    interface 127.0.0.1 Operate
    remote 127.0.0.1 Program
    remote 127.0.0.1 Operate
    remote 255.255.255.255 Program
    remote 255.255.255.255 Operate
    interface 255.255.255.255 Program
    interface 255.255.255.255 Operate
    interface localhost operate
    interface localhost Program
    ## End of access control file
     
    Conformist, Apr 25, 2024
    #2
  3. discjockeyr

    glen_m

    Joined:
    Jun 26, 2016
    Messages:
    17
    Likes Received:
    8
    Location:
    NZ
    Probably work your way up the network stack (Sorry if you have already covered all of this):
    • Ping the PI running C-Gate using the IP address, from the PC running toolkit. If ping works ok, move onto next step. If not (assuming they are on the same network), if the PC running toolkit is a Laptop on wLAN, then check aspects like bridging enabled from wlan to lan
    • If you are using a hostname for the cgate server from your Toolkit config (from memory this allows this), then try pinging using that same hostname to test name resolution. If that does not work, just put an IP address in the Toolkit config
    • Probably the next step is what conformist mentions above - check the access.txt - If your PC running toolkit is on DHCP, then consider opening up the whole subnet
    • Check the event log for C-Gate (For my c-gate running under ubuntu that would be
      tail -f /usr/local/bin/cgate/logs/event.txt ) for messages while trying to connect
    • From the toolkit PC, make sure you can open a TCP connection to the C-Gate service - It wont work (due to lack of SSL), but it should not get rejected/disconnected immediately e.g. (telnet 192.168.1.2 20123) You will see similar entries to the following in the C-Gate log (expected for the telnet connection), but shows the PC can establish TCP connections to the C-Gate server on that port:
    • 20240429-202622 999 sys Selected client cipher: SSL_NULL_WITH_NULL_NULL​
    • 20240429-202622 804 cmd17 - Host:/192.168.1.10 closed command interface from port: 0​
    • Lastly - If you are also seeing similar log entries to above for the actual toolkit connections, I would recommend checking the version of Toolkit, C-Gate and Java you are running. If you are running 'distribution managed' Java, you are probably running on a later version than Toolkit/Cgate can handle - You either need to install your own 'downgraded' version, or adjust allowed ciphers - Details cab be found here: https://www.cbusforums.com/threads/c-gate-command-port-issue-with-toolkit.10610/ - That said, the error (in the past) that was displayed on Toolkit for this issue was "An error has occurred while initializing the secure socket layer - Cannot connect to C-Gate Server).
    Good luck
     
    glen_m, Apr 29, 2024
    #3
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.