FREE web-browser control of your C-Bus network

Discussion in 'C-Bus Toolkit and C-Gate Software' started by greig, Mar 27, 2011.

  1. greig

    greig

    Joined:
    Aug 3, 2004
    Messages:
    72
    Likes Received:
    3
    Location:
    Petersham - Sydney
    Hi All,


    I've written a basic couple of pages in PHP that give me FULL control of my C-Bus network from a browser - and it even works from my iPhone.

    My application runs under WAMP on a (virtual) Windows 7 PC, and it talks directly to C-Gate and in turn to my CNI.

    I'm in the process of refining the code and am planning to release it into the public domain.

    2 sample pages are here:

    This one is a graphical view. It's essentially just a line-art drawing of the building with a simple HTML table layered invisibly over the top. Clicking on any of the ?rooms? pre-selects the room, then you click on the action required: on, off, or ramp.

    This is the very simple tabular version. It simply reads the Tags file and presents each Group's name to you in the table. As with the graphical version, you simply choose one or more Groups, then select the action.

    Unlike in the episode of Big Bang Theory, you can click away all night and day - the code's running in demo mode and you're NOT turning my lights on. Sorry. :D

    I'm after a COUPLE of guinea pigs who would like to try this out and help me debug it before I release it to the wild.

    Please let me know if you're interested, and perhaps provide a description of your network.

    FYI, I'm Sydney-based and work in IT. I *don't* code for a living, which will be apparent from the code. Still, this code has been running here at home on my network of 30+ devices and 80+ groups for almost 12 months and it meets my needs beautifully.

    Thanks,



    Greig.
     
    greig, Mar 27, 2011
    #1
  2. greig

    tobex

    Joined:
    Nov 3, 2006
    Messages:
    728
    Likes Received:
    0
    Location:
    Sydney, Australia
    Nice work.
     
    tobex, Mar 28, 2011
    #2
  3. greig

    greig

    Joined:
    Aug 3, 2004
    Messages:
    72
    Likes Received:
    3
    Location:
    Petersham - Sydney
    Thanks Tobex.

    I've written it up in a little more detail on my blog.

    After I get it tested on a couple of different networks I'll publish the code - aiming for something in the April timeframe.


    G.
     
    greig, Mar 28, 2011
    #3
  4. greig

    Roti

    Joined:
    Jun 5, 2006
    Messages:
    33
    Likes Received:
    0
    Nice Going.

    I've been wanting to do (or get someone else to) something like this for a while. I got started with one way web control then lost opportunity (and kept running out of time).

    I had been using Philips Pronto remotes to control everything (after creating my own 2-way C-Gate interface), but Pronto is now a dead product, so was looking to migrate everything back to touch screens running a web client.

    I shall watch your progress with interest.
     
    Roti, Mar 29, 2011
    #4
  5. greig

    greig

    Joined:
    Aug 3, 2004
    Messages:
    72
    Likes Received:
    3
    Location:
    Petersham - Sydney
    "C-ChangePHP"

    I've just shipped the code and documentation to my first beta-tester. It will be interesting to find out if it behaves in the outside world, away from its author! (I'm only a little bit nervous).

    Over breakfast and a strong coffee today the project was named "C-ChangePHP". :D

    - Greig.
     
    greig, Apr 3, 2011
    #5
  6. greig

    DaveQB

    Joined:
    Jul 1, 2010
    Messages:
    25
    Likes Received:
    0
    Location:
    DaveQB
    Absolutely awesome greig

    I have just had CBus installed (new house) and have started playing with it with a CNI.

    I have a VM running c-gate permanently and hook into it with Toolkit from my desktop.
    I have been thinking about different frontends I could create. Besdies simply monitoring with shell scripts, I thought about creating a web app with something like CherryPy.

    Well done.
    I too am in IT and in Sydney but not a coder for a living.

    I will grab project and slap it onto my network and report.

    Thanks again.
     
    DaveQB, Apr 21, 2011
    #6
  7. greig

    DaveQB

    Joined:
    Jul 1, 2010
    Messages:
    25
    Likes Received:
    0
    Location:
    DaveQB
    Ahh I see it is not released to all yet.

    What licence will is be under? GPL?
     
    DaveQB, Apr 21, 2011
    #7
  8. greig

    greig

    Joined:
    Aug 3, 2004
    Messages:
    72
    Likes Received:
    3
    Location:
    Petersham - Sydney
    Hi Dave,


    Yes, GPL.

    Hit me up with your e-mail address in private and I'll send you the code to test out.

    I'm Beta-ing it with a couple of users (all o/s) and have made a few improvements to it of late that enhance its utility for those with networks that extend beyond the standard Lighting Application.

    I'm off to MEL for the weekend, but by Tuesday I should have another update with some additions including the ability to specify a binary value for a Group (relevant for Trigger Groups) and perhaps some in-built scene support.

    :)


    G.
     
    greig, Apr 21, 2011
    #8
  9. greig

    DaveQB

    Joined:
    Jul 1, 2010
    Messages:
    25
    Likes Received:
    0
    Location:
    DaveQB
    Roger roger and fantastic.

    PM on it's way...
     
    DaveQB, Apr 21, 2011
    #9
  10. greig

    greig

    Joined:
    Aug 3, 2004
    Messages:
    72
    Likes Received:
    3
    Location:
    Petersham - Sydney
    C-ChangePHP released for download today

    It's HERE!

    https://bimbonet.net/blogs/greiginsydney/?p=215

    After heaps of testing and code revisions, I think it's ready for you all to try and break it. Or benefit from it.

    Initially this code was focussed on App56 (Lighting), but with an enthusiastic test guinea pig pushing me to add more functionality, it now handles reads and writes of *all* your Applications (including the Comfort Alarm, plus Trigger and Enable Control Groups).

    Let me know if if gives you any grief and I'll do my best to help out.


    - Greig.
     
    greig, May 17, 2011
    #10
  11. greig

    DaveQB

    Joined:
    Jul 1, 2010
    Messages:
    25
    Likes Received:
    0
    Location:
    DaveQB
    Awesome Greig! Reading the doco as I type this.

    This weekend could be the weekend ;)
     
    DaveQB, May 20, 2011
    #11
  12. greig

    mich

    Joined:
    May 13, 2011
    Messages:
    14
    Likes Received:
    0
    Location:
    Sydney
    Hi,

    I just stumbled across this today by trawling the c-bus forums. I cant believe my months of searching for c-bus/cbus and java and php never returned this. I am a full-time php coder (at the moment, formerly an electrical/telco engineer) and cant wait to have a go at this tonight and get it working.

    Will let you know how I go.

    Cheers;
    Michael.
     
    mich, May 24, 2011
    #12
  13. greig

    mich

    Joined:
    May 13, 2011
    Messages:
    14
    Likes Received:
    0
    Location:
    Sydney
    ps: i get the feeling these php pages do not get updated with status info (ie. whether a light is already on or off etc.) is it possible to get the status info using c-gate/telnet?
     
    mich, May 24, 2011
    #13
  14. greig

    greig

    Joined:
    Aug 3, 2004
    Messages:
    72
    Likes Received:
    3
    Location:
    Petersham - Sydney
    Hi Mich,


    If you edit the config file to point to your Tags file, point it to c-gate, and set demo=0 you should be fine.

    It's static rather than dynamic though - you'll only read the status of the channel/Group at the time the bus is queried.


    G.
     
    greig, May 24, 2011
    #14
  15. greig

    Ingo

    Joined:
    Dec 2, 2006
    Messages:
    290
    Likes Received:
    1
    Location:
    South Africa
    You could also use an auto page refresh to query the bus OR if you are a 'fulltime PHP coder' then perhaps you could add Comet/Reverse AJAX to push data back to the browser and donate your work to the community for the next release. That would be a very nice addition.

    Ingo
     
    Ingo, May 24, 2011
    #15
  16. greig

    mich

    Joined:
    May 13, 2011
    Messages:
    14
    Likes Received:
    0
    Location:
    Sydney
    Hi,

    I got it to work as per the basic download last night. The only thing I had to change was the location of the html in relation to the php header statement as I kept getting warnings that the headers could not be modified. That took about 2mins to fix and it then worked just like it says on the box.

    I'm renovating at the moment, so no promises on how quick (as that is taking alot of my spare time) but i've already spent some time playing around with this which will work on the iphone/ipad.

    http://furf.com/exp/touch-punch/slider.html

    I think i'd like to get this project as a whole working with mysql and ajax for sure with lots of javascript/jquery thrown in.

    Greig you've done an amazing job getting the project to where it is - especially in terms of the documentation which is not one of my strong points.

    I can see this will keep me occupied/distracted for many months to come

    :D
     
    mich, May 25, 2011
    #16
  17. greig

    mich

    Joined:
    May 13, 2011
    Messages:
    14
    Likes Received:
    0
    Location:
    Sydney
    Hi,

    I managed to get some basic ajax working to update the status column of your table view in real time. It changes almost immediately as you press a button on a switch. It does this by doing an ajax refresh every 1000ms on the page using a recursive script. Its only in bits and peices for testing right now otherwise i'd email it back to you to consider using in a release update.

    What I am interested to know from the clipsal guys is whilst i've read that its a no-no to poll devices directly too regularly, is it ok to poll c-gate via telnet regularly via a PC - eg. every 300-1000ms? This seems to be the only way to get up to date status info - is that correct?

    Regards;
    Michael.
     
    mich, May 26, 2011
    #17
  18. greig

    Ingo

    Joined:
    Dec 2, 2006
    Messages:
    290
    Likes Received:
    1
    Location:
    South Africa
    Mich,

    What I've been toying with is to connect to all the CGate streams and then read the received data from there. Have a look at the CGate documentation and you will see there are a few telnet ports that you can connect to. One or two of them are of real value when you are looking for realtime status updates.


    Regards,
    Ingo
     
    Ingo, May 26, 2011
    #18
  19. greig

    greig

    Joined:
    Aug 3, 2004
    Messages:
    72
    Likes Received:
    3
    Location:
    Petersham - Sydney
    Hey Mich,


    Well done with the real-time and Ajax. That would REALLY be the icing on the cake!! And as Ingo's said, I think there's enough real-time status info coming from one of the C-Gate ports.

    And thanks for the documentation compliment. NO-ONE likes writing docos - but I knew it had to be done. Horrible. Would much rather be coding. :p


    G.
     
    greig, May 27, 2011
    #19
  20. greig

    mich

    Joined:
    May 13, 2011
    Messages:
    14
    Likes Received:
    0
    Location:
    Sydney
    I finally had an hr or two last night to spend messing around with this a bit more. all seems very promising. I can use a comet/ajax approact to get real-time event info from port 20025 and use port 20023 to issue set/ramp commands.

    Unless anyone recommends a better way, i think i'll use port 20025 to register an event (eg from a switch being pressed etc.) then have that trigger a status poll via port 20023 of the entire network at that time.

    I'll try and keep all the code as modular as possible so others can use it as they require.

    Exciting stuff :)
     
    mich, Jun 1, 2011
    #20
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.