HTTP control proxy via C-Gate and NodeJS

Discussion in 'C-Gate Developers' started by ievolve, Jan 28, 2012.

  1. ievolve

    ievolve

    Joined:
    Mar 20, 2010
    Messages:
    112
    Likes Received:
    1
    Location:
    Idaho
    After my last video there were several people asking about integrating my http proxy via C-Gate, instead of talking direct to the CNI. I decided to give it a whirl this afternoon.

    What I found was that talking to C-Gate GREATLY simplifies this process. Anyone who has done both can attest to just how much goes into talking direct to the CNI vs the C-Gate alternative.

    So, it was a fun experiment. I will likely continue to develop down both paths since most of the work from here on out will be in the HTML itself, I think I can keep the connection to the CBUS network agnostic to whether you would like to connect via CGate or direct to the CNI.

    Code is here: https://github.com/anthonywebb/node-cgate/blob/master/server.js

    Videdo is here:
     
    ievolve, Jan 28, 2012
    #1
    1. Advertisements

  2. ievolve

    ievolve

    Joined:
    Mar 20, 2010
    Messages:
    112
    Likes Received:
    1
    Location:
    Idaho
    In the process of getting this realtime interface built out I created a nice way to issue CGate commands when testing without having to flip between windows. It also proves the realtime HTTP channels which are now receiving commands as proxied from cGate.

    http://www.cbusforums.com/forums/showthread.php?p=38593

    Code has been updated on github, enjoy.
     
    ievolve, Feb 1, 2012
    #2
    1. Advertisements

  3. ievolve

    SirFloyd

    Joined:
    Feb 11, 2012
    Messages:
    2
    Likes Received:
    0
    Location:
    Melbourne
    Props on the great work you've done there.
    I'm in the middle of a little project, developing a java app of my own to use, and I stumbled upon this thread, I'd love to take a look at this and your other cbus stuff.

    I checked out your github link, but it seems those repos no longer exist :(
    Any chance I can still get a copy of your code to play around with?
     
    SirFloyd, Feb 12, 2012
    #3
  4. ievolve

    ievolve

    Joined:
    Mar 20, 2010
    Messages:
    112
    Likes Received:
    1
    Location:
    Idaho
    @sirfloyd, I tried to send you a PM with the code but it said you dont allow PM's from the board, if you leave me your email I will get you out some code to play with.
     
    ievolve, Feb 12, 2012
    #4
  5. ievolve

    SirFloyd

    Joined:
    Feb 11, 2012
    Messages:
    2
    Likes Received:
    0
    Location:
    Melbourne
    Cheers for the quick response.
     
    Last edited by a moderator: Feb 13, 2012
    SirFloyd, Feb 12, 2012
    #5
  6. ievolve

    abg

    Joined:
    Dec 25, 2007
    Messages:
    198
    Likes Received:
    2
    Location:
    Sydney
    Sonos Volume Control from keypad

    @ievolve do you have an example of controlling Sonos from c-Bus that you wouldn't mind sharing?

    I would love to be able to control the volume of a particular zone from a reflection keypad. I've been through 7 CR200 controllers that have failed (lower portion of touch screen dies) and generally once the music/radio is up and running volume is all I need to modify. I can do it from iPhone app but option to do it from a keypad would be great.

    Many thanks
     
    abg, Feb 23, 2012
    #6
  7. ievolve

    msniper

    Joined:
    Jul 19, 2007
    Messages:
    11
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Hi ievolve

    I have read all these posts and watched all your videos. Great work! node.js looks fantastic.

    Will you publishing the code back on github? I would love to take a look and have a play.

    Thanks
    Richard
     
    msniper, Mar 13, 2012
    #7
  8. ievolve

    martymonster

    Joined:
    Aug 5, 2004
    Messages:
    145
    Likes Received:
    0
    Hi,

    Tried to get your code from Github but get page not found error.
     
    martymonster, Apr 20, 2012
    #8
  9. ievolve

    RussellJ

    Joined:
    Jul 30, 2012
    Messages:
    1
    Likes Received:
    0
    Location:
    Brisbane
    Hi,

    I've also tried to get your code from Github. I'd love to see how you've done it, it's a project I've wanted to tackle myself for a couple of years now, but never found the time.

    Thanks.
     
    RussellJ, Jul 31, 2012
    #9
  10. ievolve

    tobex

    Joined:
    Nov 3, 2006
    Messages:
    728
    Likes Received:
    0
    Location:
    Sydney, Australia
    Im ready to do this but now the code is totally gone. Im annoyed that I didnt do more sooner.
     
    tobex, Sep 30, 2013
    #10
  11. ievolve

    millergarym

    Joined:
    Nov 17, 2013
    Messages:
    1
    Likes Received:
    0
    Location:
    Sydney
    millergarym, May 6, 2014
    #11
  12. ievolve

    zei20t

    Joined:
    Aug 18, 2010
    Messages:
    83
    Likes Received:
    0
    Location:
    Sydney, Australia
    its been down for ages unfortunately. I think people have contacted him but possibly not heard anything back.

    his work looks awesome! Id love to get into it.
     
    zei20t, May 6, 2014
    #12
  13. ievolve

    fleetz

    Joined:
    Nov 21, 2005
    Messages:
    358
    Likes Received:
    6
    Hi Anthony,

    Just tuned into your work on this and it is exemplary. Noticed your code is no longer on GitHub any chance it could be reinstated?

    Regards,

    Fleetz
     
    fleetz, Nov 4, 2014
    #13
  14. ievolve

    ievolve

    Joined:
    Mar 20, 2010
    Messages:
    112
    Likes Received:
    1
    Location:
    Idaho
    Hi Guys,

    Sorry for the lack of updates. I had posted up all the code and in the end pulled it down as the project started to become very specific to my needs with various integrations to hardware I built, etc. And I was concerned that it might be more work to support and explain than what I had time to do. So I pulled it down.

    I would very much like to clean up what is there and make it something more maintainable and manageable to work with.

    The code is solid, I have been running for years now without hiccup, the clipsal stack is simply amazing. If there is still interest I'd be up for taking a weekend to work through and clean up the code a bit. A lot of it was not documented at the time simply because I was just reading bits and brute forcing my way to functionality that needed at the time to do my simple proof of concept.

    So, if I put stuff back up, go easy on me. Though I write software professionally, the code here is mostly a hack that was not something I ever planned on building beyond my personal use.

    Regards,
    Anthony
     
    ievolve, Nov 6, 2014
    #14
  15. ievolve

    ievolve

    Joined:
    Mar 20, 2010
    Messages:
    112
    Likes Received:
    1
    Location:
    Idaho
    I know this thread is specifically talking about the CGate integration I did. Would be important to note that the most recent versions of the code talk direct to the CNI as opposed to CGate. I sort of put the CGate code on hold and started dealing direct with the CNI to remove the requirement to have a PC running CGate in the chain.

    What I wanted was a nice lightweight piece of code that I could run that would be totally self contained and run on something inexpensive and low power like a raspberry pi.

    Question for those of you interested in learning some more about the work I have done: Is the interest more on the CGate integration or the CNI integration?
     
    ievolve, Nov 6, 2014
    #15
  16. ievolve

    fleetz

    Joined:
    Nov 21, 2005
    Messages:
    358
    Likes Received:
    6
    Hi Anthony,

    Thanks again for reaching back to the forum.

    I am interested if there is sufficient interest by others here. My interest would be CNI also. I am sure you will hear from others in the not too distant future. :)

    Regards,

    Ian
     
    Last edited by a moderator: Nov 6, 2014
    fleetz, Nov 6, 2014
    #16
  17. ievolve

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    305
    Likes Received:
    1
    Location:
    FNQ
    Hello Anthony, so good to hear from you again!

    Put me down as an interested party. My vote would be for the c-gate option, as I've had it running on a RPi for a few years now and quite a few clients are happy with the iPad solution we have put together. My feeling is your work with node.js would further enhance what I've got.

    Anyway, good to hear you're still churning out code.

    Mark
     
    Mr Mark, Nov 6, 2014
    #17
  18. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,097
    Likes Received:
    15
    Location:
    Brisbane, QLD, Australia
    Hi Anthony
    Nice to see you back here.

    Hi Mark
    Glad to hear you have implemented some things with the raspberry pi.
    Could you explain to me your preference for CGate?
     
    DarylMc, Nov 6, 2014
    #18
  19. ievolve

    Mr Mark

    Joined:
    Jan 27, 2006
    Messages:
    305
    Likes Received:
    1
    Location:
    FNQ
    Hello Daryl.

    I first started (nearly three years ago) on this and was using raw data through a CNI - easy start. I found I preferred c-gate due to its 'English' data, plus the ability to have multiple clients connected at the same time.

    As time went on, using additional data from c-gate:
    - I know if networks are open/close/syncing/ok/in error;
    - Have time and date broadcast,and the ability to set time and date;
    - Broadcast temperature without polling etc.;
    - Status updates, without polling (I poll once, at start up only)
    - Log in security via access.txt.

    Plus I didn't get past interpreting MMIs. :)
    Once I started down the c-gate path, it just seemed so much easier.

    I did put together a more economical control option, where an iPad/iPod/iPhone opens a socket connection, sends a string before closing to work around the single connection issue through a CNI. Looks similar, but without feedback - no point without a constant connection.

    I had a few issues using c-gate on a RPi in the beginning, mainly due to the old CNI locking up, although upgrading the Lantronix firmware and changing some time out values (huge thanks to Ashleigh for this one). Now I use a C-Bus SIM wired into the RPi and have had no problem - tested with C-Bus power and RPi power flicked off and on and it recovers every time now.
     
    Last edited by a moderator: Nov 6, 2014
    Mr Mark, Nov 6, 2014
    #19
  20. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,097
    Likes Received:
    15
    Location:
    Brisbane, QLD, Australia
    Hi Mark
    Thanks for the reply.
    It's going to take me a while to digest it.

    I always considered using the CBus sim with the raspberry pi.
    Suppose I should find the price and look at having a go.

    My Linux skills have improved leaps and bounds lately.
    I'm reasonably confident I could navigate to a directory and create a text file now days:)

    Two way communication, CBus to Philips Hue is the thing I would most like to be able to do with the raspberry pi and CBus.
     
    DarylMc, Nov 6, 2014
    #20
    1. Advertisements

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.