Apple homekit integration!

Discussion in 'Voice Control' started by ievolve, Nov 7, 2016.

  1. ievolve

    tobex

    Joined:
    Nov 3, 2006
    Messages:
    728
    Likes Received:
    0
    Location:
    Sydney, Australia
    tobex, Jun 9, 2017
  2. ievolve

    Mick01

    Joined:
    Aug 12, 2009
    Messages:
    30
    Likes Received:
    0
    Location:
    Melb
    Wondering if anyone can help to get this to work.
    Have iMac running VMware window 7 with CNI2
    Cant seem to get connect to C-Gate...
    i can access toolkit with no problems.
    Anyone with similar setup with a guide to what i am doing wrong?

    thanks



    Last login: Thu Jul 6 16:26:20 on ttys000
    Mick-iMac:~ mick$ HOMEBRIDGE
    [7/6/2017, 4:27:46 PM] Loaded plugin: homebridge-cbus
    [7/6/2017, 4:27:46 PM] Registering platform 'homebridge-cbus.CBus'
    [7/6/2017, 4:27:46 PM] ---
    [7/6/2017, 4:27:46 PM] Loaded config.json with 0 accessories and 1 platforms.
    [7/6/2017, 4:27:46 PM] ---
    [7/6/2017, 4:27:46 PM] Loading 1 platforms...
    [7/6/2017, 4:27:46 PM] [CBus] Initializing homebridge-cbus.CBus platform...
    cbus:client Opening connection to C-Gate… +0ms
    [7/6/2017, 4:27:46 PM] Loading 0 accessories...
    cbus:client C-Gate socket error: Error: connect ECONNREFUSED 127.0.0.1:20023 +5ms
    cbus:client C-Gate connection could not be opened; exiting. +1ms
    Mick-iMac:~ mick$

    {
    "bridge": {
    "name": "My Home",
    "username": "CC:22:3D:E3:CE:30",
    "port": 51826,
    "pin": "031-45-154"
    },

    "description": "My home HomeKit API configuration file",

    "platforms": [
    {
    "platform": "homebridge-cbus.CBus",
    "name": "CBus",
    "client_ip_address": "127.0.0.1",
    "client_controlport": 20023,
    "client_cbusname": "mick",
    "client_network": 254,
    "client_application": 56,
    "client_debug": true,

    "platform_export": "my-platform.json",

    "accessories": [
    { "type": "LIGHT", "id": 7, "name": "STUDY LIGHT" }
    ]
    }
    ],
    "accessories": [ ]
    }
     
    Last edited by a moderator: Jul 6, 2017
    Mick01, Jul 6, 2017
  3. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hello Mick01
    It is not immediately clear to me where you have CGate and homebridge running in the VM setup.
    Or any networking issues that might cause.
    So this is a guess.
    If you open a telnet session from wherever homebridge is running and try to connect to CGate at CGate server address port 20023 should rule out any access.txt issues for a start.
    Or if Toolkit can open CGate successfully then leave it running and try telnet to CGate again from where homebridge is running.
     
    Last edited by a moderator: Jul 7, 2017
    DarylMc, Jul 7, 2017
  4. ievolve

    Mick01

    Joined:
    Aug 12, 2009
    Messages:
    30
    Likes Received:
    0
    Location:
    Melb
    Hi Daryl,

    I have c-gate running in window7 and homebridge in iOS
    Are you saying I should be running homebridge in window7 environment also?

    I have opened telnet,how do I connect to port 20023?

    Thanks for you reply..
     
    Mick01, Jul 7, 2017
  5. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hi
    Telnet to CGate ip address port 20023.
    I'm not sure how you would do that with the VM but someone else may be able tell you.

    I'm pretty sure CGate would run nicely on the OSX side.
    The software is CGate zip distribution from CIS downloads.
    I'm not an Mac user but there are plenty around here.
    Google CGate on OSX
     
    DarylMc, Jul 7, 2017
  6. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    I notice in your config.json the cgate server ip address is 127.0.0.1
    It probably is correct in the VM but probably not the right address to be looking for from your mac os.
    I'm not familiar with networking in the VM environment but if the VM has a different ip address for the network interface to the apple ip address then that is the one to use.
    If you do that you will probably have to edit access.txt file in cgate machine to allow access.

    What I think is best to do is see if you can find someone who has set it all up on Apple OS or grab a raspberry pi3
     
    Last edited by a moderator: Jul 7, 2017
    DarylMc, Jul 7, 2017
  7. ievolve

    Mick01

    Joined:
    Aug 12, 2009
    Messages:
    30
    Likes Received:
    0
    Location:
    Melb
    Thanks something to work with when I get home...
     
    Mick01, Jul 7, 2017
  8. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    See if you can get it going the way you have started.
    Eventually I think you want to get Homebridge and CGate on the mac or a raspberry pi.
    I don't know for sure but someone here has to be all over getting CGate running native on the mac.
    This is the link I used for raspberry pi.
    http://addictedtopi.tumblr.com/post/96351714013/installing-c-gate-on-a-raspberry-pi

    As always when changing things, make sure you have a safe backup of your projects.
    I made a spreadsheet with instructions for raspberry pi.
    Some of the things may help you to work through your setup.
    spreadsheet link
     
    Last edited by a moderator: Jul 14, 2017
    DarylMc, Jul 7, 2017
    tincanpete likes this.
  9. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    I'm really happy with the instructions I put in a spreadsheet from everyone else's links to get Homebridge CBus and CGate running on raspberry Pi3.
    I posted a video for people like myself who don't know too much about Linux showing the install process.
    Links to files are listed.
    It's really long 39 min and not too polished but it does work.
     
    Last edited by a moderator: Jul 11, 2017
    DarylMc, Jul 11, 2017
    tincanpete likes this.
  10. ievolve

    tobex

    Joined:
    Nov 3, 2006
    Messages:
    728
    Likes Received:
    0
    Location:
    Sydney, Australia
    #cbus #c-bus #raspberry #pi #homegate #automation #lighting #siri
     
    tobex, Jul 12, 2017
  11. ievolve

    Mick01

    Joined:
    Aug 12, 2009
    Messages:
    30
    Likes Received:
    0
    Location:
    Melb
    Still no luck

    I tried to telnet to port 20023, the command gets rejected with a "400 Syntax Error".

    Tried to search the forum for possible cause but with no luck.

    noop command replies with "200 ok"

    project dir command lists the projects
    but when I try to "telnet localhost 20023" I get the error 400 Syntax error.

    Any help will be appreciated.
     
    Mick01, Jul 13, 2017
  12. ievolve

    daniel C-Busser Moderator

    Joined:
    Jul 26, 2004
    Messages:
    770
    Likes Received:
    21
    Location:
    Adelaide
    Hi Mick,

    C-Gate by default permits connections from the same machine, but not from other machines. This is why Toolkit works out of the box, and the command "telnet localhost 20023" at the Windows prompt on the same machine works also.

    BTW - you are typing "telnet localhost 20023" when you are already connected to C-Gate (attempting Inception level stuff!?!).

    To allow other machines to connect to C-Gate you need to edit C:\Clipsal\C-Gate2\config\access.txt.

    This is covered in detail in the C-Gate manual in the section Reference > Access Control > Access Control Basics.

    But in short, you would just add the new line:

    Code:
    remote <your iOS machine's IP address> Program
    Then restart C-Gate.
     
    daniel, Jul 14, 2017
  13. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    daniel
    I read that as trying to start another telnet session from within CGate session too.

    The reason I asked Mick to try telnet to cgate was to make sure the pc has access.
    Mick you "are" connected to CGate and clearly have access from the location you used to open the telnet session.

    Back to the original issue
    Whatever IP address you used to connect to CGate by telnet is the one you load into config.json
    Assuming you opened the telnet session from the machine running Homebridge.

    Back to the telnet session you had connected to cgate.
    Open it again.
    type project list
    should show your project
    type net list
    should show your project open and running

    You could read the spreadsheet in the link I sent to get some ideas.
     
    Last edited by a moderator: Jul 14, 2017
    DarylMc, Jul 14, 2017
  14. ievolve

    Mick01

    Joined:
    Aug 12, 2009
    Messages:
    30
    Likes Received:
    0
    Location:
    Melb
    Thanks guys

    Added remote IP address of iOS to access.txt and still not luck.

    Restart C-Gate and still have the following...

    Opening connection to C-Gate… +0ms
    [7/14/2017, 3:46:04 PM] Loading 0 accessories...
    cbus:client C-Gate socket error: Error: connect ECONNREFUSED 127.0.0.1:20023 +4ms
    cbus:client C-Gate connection could not be opened; exiting. +1ms
     
    Last edited by a moderator: Jul 14, 2017
    Mick01, Jul 14, 2017
  15. ievolve

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,427
    Likes Received:
    64
    Location:
    Adelaide
    How are you running homebridge on iOS?

    Do you mean macOS?

    If C-Gate is running in a Windows VM on a macOS host, how is the networking for the VM set up? Bridge? NAT?

    Did you successfully telnet to C-Gate from within macOS?

    Nick
     
    NickD, Jul 14, 2017
  16. ievolve

    Mick01

    Joined:
    Aug 12, 2009
    Messages:
    30
    Likes Received:
    0
    Location:
    Melb
    How are you running homebridge on iOS?

    using Atom

    Do you mean macOS?

    Yes

    If C-Gate is running in a Windows VM on a macOS host, how is the networking for the VM set up? Bridge? NAT?

    Bridge

    Did you successfully telnet to C-Gate from within macOS?

    No

    I think I am about to call time on this...

    I can connect to Cbus via the CNI2 in the Window7 environment.

    I can see the address of the CNI..

    Followed the steps to setup homebridge but somehow its not connecting to cgate from the macOS environment.


    Obviously I have a setting wrong but can't seem to find it.
     
    Mick01, Jul 15, 2017
  17. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    It seems most likely to me that your problem is networking setup in the VM environment.
    Surely you can see CGate on the Windows VM has to have a reachable ip address for Homebridge on Mac to talk to it.
    Running CGate and Homebridge on Apple OS may be one way to get around that.

    If you look at CIS downloads site there is a CGate zip file for OS other than Windows.
    Apple OS is mentioned.
    How to go about using it I don't know.

    Raspberry pi is also an option you should consider.
    It's a low power gadget which can just sit in a corner running full time.
    Also you can muck about with it all you like without disturbing your PC or VM.
    Both Homebridge and CGate have good online instructions to set it up too.
     
    DarylMc, Jul 15, 2017
  18. ievolve

    Mick01

    Joined:
    Aug 12, 2009
    Messages:
    30
    Likes Received:
    0
    Location:
    Melb
    Thanks Daryl, I will give it a go ....failing that I will look at the raspberry option.

    CGate is working on the VM. I can see the IP address. I can access toolkit using the CNI.
    I tried everything I know and also the recommendations mention here but to no avail.
    So it has me stumped at the moment.
     
    Last edited by a moderator: Jul 15, 2017
    Mick01, Jul 15, 2017
  19. ievolve

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,427
    Likes Received:
    64
    Location:
    Adelaide
    As I understand it, in bridge mode, your VM will be given a new external IP.. different to that of thehost... so you can't use 127.0.0.1 or localhost to communicate between the host and the VM.

    If so I think you either need to configure C-gate to allow connections from the host IP, and configure homebridge with the external IP of the VM in order for it to find C-gate.

    You could probably also add another virtual adapter to allow a direct connection between the host and the VM.

    Nick
     
    NickD, Jul 19, 2017
  20. ievolve

    Mick01

    Joined:
    Aug 12, 2009
    Messages:
    30
    Likes Received:
    0
    Location:
    Melb
    If so I think you either need to configure C-gate to allow connections from the host IP, and configure homebridge with the external IP of the VM in order for it to find C-gate.
    Thanks for that Nick but I have given that a go without any luck.
     
    Mick01, Jul 24, 2017
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.