CGate on Linux ARM

Discussion in 'C-Gate Developers' started by DarylMc, Jun 22, 2012.

  1. DarylMc

    cheekymonkey

    Joined:
    Mar 10, 2013
    Messages:
    19
    Likes Received:
    1
    Location:
    Perth, WA
    I'm not sure if you worked this out but now my big project of building the dining table for xmas lunch and the associated celebrations are over I've had some time to play and connected my 5000SM2 directly to the Pi.

    The connections I used were

    Code:
     Pi pin               5000SM2 pin
     
     1 (3.3v)	->    7
     6 (GND)        ->    9 (Common)
     8 (TX)         ->    8 (RX)
     10 (RX)	->    10 (TX)
    
    The console needs to be disabled on the pi and the safest way is to install rpi-serial-console, simply run:

    Code:
    sudo wget https://raw.github.com/lurch/rpi-serial-console/master/rpi-serial-console -O /usr/bin/rpi-serial-console && sudo chmod +x /usr/bin/rpi-serial-console
    Then to disable the serial console, simply run:
    Code:
    sudo rpi-serial-console disable
    Update /etc/init.d/ser2sock so the start line changes from
    Code:
    /usr/local/bin/ser2sock -d -p 10001 -s /dev/ttyUSB0 -b 9600
    to
    Code:
    /usr/local/bin/ser2sock -d -p 10001 -s /dev/ttyAMA0 -b 9600
    The pi then needs to be rebooted for the changes to take effect
     
    Last edited by a moderator: Jan 6, 2014
    cheekymonkey, Jan 6, 2014
    #21
  2. DarylMc

    zx9

    Joined:
    Jun 8, 2009
    Messages:
    49
    Likes Received:
    0
    Location:
    Melbourne
    intermitted problems with ser2sock

    Hi,

    following the excellent guide I got my Pi working pretty easily and have since moved all my logic onto my Pi using nodejs.

    The only issue I am having is now and again the cbus connection USB to serial via ser2sock falls over. This seems random and it may stay up for a month or only a day. When it does fail cgate reports 'restarting stuck transmitter' errors and the only way to fix it is to stop & restart the ser2sock service. Before I go a build the detect&restart functionality into nodejs I though I would ask if anyone has experienced this behaviour and is there a fix?

    thanks,
     
    zx9, Jul 25, 2014
    #22
  3. DarylMc

    zx9

    Joined:
    Jun 8, 2009
    Messages:
    49
    Likes Received:
    0
    Location:
    Melbourne
    An update for anyone who may come across a similar problem. A couple of days after I posted the above I went and downloaded the latest ser2sock from github. It's now been 6 weeks with no problems so fingers crossed i believe it's resolved the issue.
     
    zx9, Sep 9, 2014
    #23
  4. DarylMc

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    It's been 5 years since my original post and I finally have CGate running on rapsberry pi :)
    I can't even remember why I wanted to do it 5 years ago but it is very useful for homebridge-cbus.

    My sincere thanks to everyone who has contributed and made that possible.
     
    Last edited by a moderator: May 6, 2017
    DarylMc, May 6, 2017
    #24
  5. DarylMc

    IanCun

    Joined:
    Sep 6, 2012
    Messages:
    71
    Likes Received:
    0
    Location:
    UK
    IanCun, Oct 5, 2017
    #25
  6. DarylMc

    vworp

    Joined:
    Aug 17, 2005
    Messages:
    18
    Likes Received:
    1
    Location:
    Stoke On Trent, UK
    Does anyone have a backup image of a working cgate & ser2socks setup I could pinch?
    I'm trying to run through the guide at addictedtopi.com but I'm failing miserably somewhere.

    My ultimate aim is to get this MQTT interface and node-red running together on the pi.
     
    vworp, Oct 28, 2017
    #26
  7. DarylMc

    IanCun

    Joined:
    Sep 6, 2012
    Messages:
    71
    Likes Received:
    0
    Location:
    UK
    I've got it up and running, but it's got a lot of other server things running on it too. However, I can try and make a clean image if the authors are happy with that, but it may not be for a few weeks as I'm quite busy at the moment.

    Which part are you having problems with and I'll see if I can help in the meantime :).
     
    IanCun, Oct 28, 2017
    #27
  8. DarylMc

    vworp

    Joined:
    Aug 17, 2005
    Messages:
    18
    Likes Received:
    1
    Location:
    Stoke On Trent, UK
    I pretty certain I'm having problems with it all :)
    I'm reasonably confident I've followed the instructions at addictedtopi correctly. I was able to remotely connect to the pi's cgate from a windows PC (but it was very slow to connect). I've since updated Toolkit to 1.15.2, and am now getting "An error occured while initialising secure socket layer. Cannot connect to C-Gate server".
    I'm running on a raspberry pi 2 model B,running Jessie, if thats any help.
     
    vworp, Oct 29, 2017
    #28
  9. DarylMc

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Last edited by a moderator: Oct 29, 2017
    DarylMc, Oct 29, 2017
    #29
  10. DarylMc

    vworp

    Joined:
    Aug 17, 2005
    Messages:
    18
    Likes Received:
    1
    Location:
    Stoke On Trent, UK
    I'll double check later, but I think the pi is on Java 8, but c-gate 2.10.2

    Is updating the pi c-gate as simple as running the c-gate portion here with a corrected url at the start? Or is it a safer bet to downgrade the pc toolkit for now?
     
    vworp, Oct 30, 2017
    #30
  11. DarylMc

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    I'm not much of an expert in Linux.
    If you look at the install process I think you will be able to figure out how to upgrade CGate.
    wget http://203.41.170.20/downloads/CGate/cgate-2.11.1_3240.zip
    Should be just a matter of removing the old one and installing the new.
    Your problem does sound like a version compatibility issue.
    Another option would be to use a compatible Toolkit version.

    I use a CNI to connect to CBus but I've got some instructions which I think are pretty good here.
    https://1drv.ms/f/s!AminzOc-NC4UgZkT2UPvhaDRGwe_3w
    That should get you close except for the serial part.
    And a long boring video if it is of any use.
     
    Last edited by a moderator: Oct 30, 2017
    DarylMc, Oct 30, 2017
    #31
  12. DarylMc

    Monkey Magic

    Joined:
    Aug 11, 2015
    Messages:
    27
    Likes Received:
    2
    Location:
    Townsville
    Going from my really poor memory that is what I did to get mine working, just have to change the wget location to point to the lastest cgate.

    I think there were also some changes to the auto start up as the later versions changed how services were started...... but manually starting still worked.

    Josh
     
    Monkey Magic, Oct 30, 2017
    #32
  13. DarylMc

    vworp

    Joined:
    Aug 17, 2005
    Messages:
    18
    Likes Received:
    1
    Location:
    Stoke On Trent, UK
    Ok, looks like I'm getting somewhere. I've updated cgate on the pi to 2.11.1 and can connect to it from toolkit 1.15.2.
    When I try to open the network, I get an error, "PCI failed to reset. Unable to open the network"
     
    vworp, Nov 3, 2017
    #33
  14. DarylMc

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    I'm just going to list a few things to rule out.
    Not sure if it is necessary but have you shut down CGate service on the PC?
    In the Toolkit file menu are you using connect to remote CGate?
    Have you added the PC ip address to CGate access.txt file?
    Can you telnet from the PC to the pi on port 20023 just to verify access?

    If you read through the spreadsheet I posted online there is instructions how to connect to a remote CGate.
    Never having used a remote CGate before I struggled a bit at first.

    Can you mention a little more about the project.
    Is it just CGate running at this stage?
     
    DarylMc, Nov 3, 2017
    #34
  15. DarylMc

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    If CGate is running on the pi and you can access it from the PC maybe you have some problem with the serial implementation.
    What is your CBus interface?
    Is it RS232 PCI or 5000SM2?
    CGate logs may help
    cd /usr/local/bin/cgate/logs
     
    DarylMc, Nov 3, 2017
    #35
  16. DarylMc

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,151
    Likes Received:
    17
    I have just gone through all of this twice once for a temporary install and then again here at my house to talk to a remote network as part of my HA system.

    To upgrade G-Gate you need to stop the service and then remove/rename the old version. Download the new version (get the link from the CIS website and substitute that into the WGET command used). Everything else should be the same.

    You will have to upgrade to Java 8, 7 wont work with the newer version of C-Gate. Plenty of help on the net - just google it. Once you have confirmed you are V8 then install C-Gate.

    You will have to redo the access.txt file in the config directory to allow remote machines to use C-Gate. The config file will also need to be re-edited if you are following the guides where it connects and opens a project automatically.

    If toolkit still cant connect then there are a number of steps to check whats happening.

    You should have enabled SSH on the Pi so, SSH into the pi and run a telnet command to the C-Gate server (port 20023) and issue a few commands when connected (noop for starters - sometimes this will return an error so issue it again, then say net list to get a list of the networks connected - use the C-Gate manual to find a few basic commands).

    If working there fine then telnet into C-Gate from your PC the has toolkit installed. Do the same as above. If you have configured the access.txt file correctly you should see the same results. If not then you have got something wrong. If all works then there should be no reason that Toolkit will not work.

    Don't confuse Toolkit connecting OK with C-Gate not connecting to the C-bus network. if the net list does not return any networks then you need to fix the connection of C-Gate to C-bus.

    I used a CNI with C-Gate which is much simper than a serial connection, but the CNI can only handle one connection at a time (pain in the ass that is) and sometimes does not drop a connection so C-Gate wont connect again. Toggle the power to the CNI to force the connection to be dropped and try and connect C-Gate again.

    Mick
     
    znelbok, Nov 3, 2017
    #36
  17. DarylMc

    vworp

    Joined:
    Aug 17, 2005
    Messages:
    18
    Likes Received:
    1
    Location:
    Stoke On Trent, UK
    Apologies, all my fault. I'd introduced a typo in the ser2sock startup script, was calling /ttyUSB1 instead of /ttyUSB0.
    I can now telnet and connect via toolkit ok.
    I've rebooted the pi, telneted back in and can see with Project List that I'm running my project "PI" (just a temp empty project to get me started)
    What would be the most sensible course of action from here, import my existing HOME project that I've been using for years?

    Thanks for all the help so far. I'm probably going to take a backup image, then reinstall from scratch in the next few days. I figure repeating the process a few times with aid with comprehension.
     
    vworp, Nov 4, 2017
    #37
  18. DarylMc

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,151
    Likes Received:
    17
    Just copy the project from your tag folder (C:\Clipsal\C-Gate2\tag\<project>.xml) on your PC to the tag folder on the Pi.

    use WinSCP to allow access via windows if you dont want to setup samba and create shares - although this wouuld be a good exercise an would allow you to easily backup your tag folder from your PC.
     
    znelbok, Nov 4, 2017
    #38
  19. DarylMc

    vworp

    Joined:
    Aug 17, 2005
    Messages:
    18
    Likes Received:
    1
    Location:
    Stoke On Trent, UK
    I do believe I'm all up and running. Tags copied over, able to open and modify the remote network. I briefly had the cgateweb MQTT service running, and Node-Red translating Alexa voice controls directly to C-Bus (shockingly straightforward).

    I've opened an issue on github with my cgateweb problem, I'll try and get it sorted out over there.

    Thanks again for the help.
     
    vworp, Nov 5, 2017
    #39
  20. DarylMc

    discjockeyr

    Joined:
    Jan 9, 2007
    Messages:
    59
    Likes Received:
    0
    Hi guys,
    i know that this post is already old but i am trying to setup the PI to work with my CBUS. I have follow all the instructions with the only difference in some updated versions like c-gate 2.11.4 and toolkit 1.15.5 with rasbian strech. My problem is that i can connect to remote c-gate but when i am trying to scan for units i am getting the error: "PCI failed to reset. Unable to open the network". I am using the 5500PC module and when i am trying directly from the toolkit with local c-gate and a USB to serial adapter everything are ok. any idea?
    Just a very very stupid question...do i have to connect the usb adapter to the PI for the communication with 5500PC in this step? i don't think.
    sorry for the stupid question but i have trying everything and did not find a solution.
    thanks
     
    discjockeyr, Sep 24, 2018
    #40
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.