Page 1 of 10

Homebridge for HomeKit hack

PostPosted: Wed Sep 23, 2015 3:22 pm
by rehafer
Has anyone looked at Homebridge ( https://github.com/nfarina/homebridge )? It looks interesting but somewhat beyond my skill level. From what I can glean from Git Hub, a properly written config.jason file could make Indigo HomeKit available.
I'm guessing that the approach is a little to sketchy for official support, but maybe worth a look.

Re: Homebridge for HomeKit hack

PostPosted: Wed Sep 30, 2015 12:35 pm
by durosity
I'd truly love home kit integration through something like this.. the ability to just shout over to my iPhone "Hey siri turn on the bedside lights" would be amazing.

Re: Homebridge for HomeKit hack

PostPosted: Thu Oct 01, 2015 6:38 am
by pvrfan
durosity wrote:
I'd truly love home kit integration through something like this.. the ability to just shout over to my iPhone "Hey siri turn on the bedside lights" would be amazing.

Then just buy an iHome SmartPlug for $40:

http://www.ihomeaudio.com/iSP5WC/

Craig

Homebridge for HomeKit hack

PostPosted: Thu Oct 01, 2015 6:45 am
by durosity
Not suitable I'm afraid, I also need to retain control via indigo. I more meant I'd love a bridge that is HomeKit enabled but has an API that indigo can read to action changes in realtime, as per this development.


Sent from my iPhone using Tapatalk

Re: Homebridge for HomeKit hack

PostPosted: Mon Oct 05, 2015 4:02 am
by gemx
Hello,

For your information i have try homebridge with indig and it's work.

How it's work :
Siri order on IOS --> homebridge --> Webserver --> API Indigo --> Device

I can ask on my Appl Watch to open or close a light or start a scene. 8)

What you need :
- On IOS the APP MyTouchHome (2$99)
- On your mac
- Node.js
- Homebridge
- Wamp
- Indigo (of course).

Here an exemple of the config file of homebridge :
Code: Select all

    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "XXX-XX-XX"
    },
   
    "description": "This is an example configuration file with all supported devices. You can use this as a template for creating your own configuration file containing devices you actually own.",

    "accessories": [
       
        {
            "accessory": "Http",
            "name": "Kitchen light",
            "on_url": "http://localhost/api/kitcheLightOn.php",
            "off_url": "http://localhost/api/kitcheLightOff.php",
            "http_method": "POST"
        }
    ]
}



I have only 3 little problem :
- I need tu use a php web serve between homebridge and indigo, because i have some problem to contact API directly and the authentification method. But may be you can.
- it's not very secure, be sure the http://localhost/api/XXX is not allow on Internet
- I need t start manullay homebridge. But i think i can use Automator for this.

If you want i explain how, i can do this.

Re: Homebridge for HomeKit hack

PostPosted: Mon Oct 05, 2015 4:51 am
by durosity
gemx wrote:
If you want i explain how, i can do this.


I've been playing around with it this weekend but with no joy, alas it's all above my current level of abilities. A step by step guide would be awesome!

Re: Homebridge for HomeKit hack

PostPosted: Mon Oct 05, 2015 6:06 am
by gemx
Ok, i will try. Sorry for my english. For mr the most difficulty is to install php on mac. Step 6.

1/ First install node.js https://nodejs.org/en/
2 / Type this command :
Code: Select all
$ git clone https://github.com/nfarina/homebridge.git
$ cd homebridge
$ npm install


If the git clone don't work install git : http://sourceforge.net/projects/git-osx-installer/

3/ When homebridge is install you can find the folder on your folder user

4/ Replace config.json by config-sample.json

5/ Replace all the accessories section by something like this :
Code: Select all
"accessories": [
        {
            "accessory": "Http",
            "name": "Kitche light",
            "on_url": "http://localhost/api/kitchenlightOn.php",
            "off_url": "http://localhost/api/kitchenlightOff.php",
            "http_method": "POST"
        }
    ]


6/ Then install a pfpf webserver on your mac : http://php.net/manual/en/install.macosx.php
7/ Create a folder API on your php sever
8/ create a file (kitchenlightOn.php) like this :
Code: Select all
<?php
      echo exec("curl -X PUT -d isOn=0 http://127.0.0.1:8176/devices/Switcherkitchen --digest -u LOGIN:PASSWORD" );
?>


you have all the documentaion about the API : http://wiki.indigodomo.com/doku.php?id= ... stful_urls

9/ Try to http://localhost/api/kitchenlightOn.php if it's work.

10/ Start Homebridge :
$ cd homebridge
$ npm run start


11/Install MyTouchHome and verrify you see Your device.

12/ You can say : "Turn On Kitchen light"
I hope i help you. Don't hesitate if you have some question.

Re: Homebridge for HomeKit hack

PostPosted: Mon Oct 05, 2015 11:34 am
by durosity
Well this is truly awesome! I'm a bit stuck with step 7/8 as I've never used php before but I've had a little play with it just directly talking to indigo with authentication off and it works amazingly well!

I'm now sitting here thinking someone smarter than me needs to write a plugin for indigo to tie it all together and give it two way communication ;)


Sent from my iPhone using Tapatalk

Re: Homebridge for HomeKit hack

PostPosted: Tue Oct 06, 2015 4:43 am
by durosity
Argh, i really wanted to get this working myself but i've just not been able to work out what you mean by 'Create a folder API on your php sever'.. i tried having a search around for that term but can't find anything that matches for PHP.. so how do i do that? :)

Re: Homebridge for HomeKit hack

PostPosted: Tue Oct 06, 2015 1:13 pm
by gemx
Hello,

It's very difficult to me to explain hoxw to install PHP on your mac. Because there is a lot of solution depending your version of MAC Version.

Maiby you can try a solution like MAMP : https://www.mamp.info/en/

I hope it's usefull.

Re: Homebridge for HomeKit hack

PostPosted: Tue Oct 06, 2015 1:29 pm
by gemx
Hello,

I have found somthing can be interresting. You can disable the disable digest authentication and use Basic autenthification : viewtopic.php?t=1590

In this cas, you don't need a php server you can directyl use the file conf :
Code: Select all
 "accessories": [
       
        {
            "accessory": "Http",
            "name": "Kitchen light",
            "on_url": "http://user:pass@127.0.0.1:8176/devices/office-lamp?isOn=1&_method=put",
            "off_url": "http://user:pass@127.0.0.1:8176/devices/office-lamp?isOn=0&_method=put",
            "http_method": "POST"
        }

I can't try for the moment but i will do it in few day.

Re: Homebridge for HomeKit hack

PostPosted: Tue Oct 06, 2015 5:24 pm
by jay (support)
gemx wrote:
I have found somthing can be interresting. You can disable the disable digest authentication and use Basic autenthification : viewtopic.php?t=1590


This is not recommended since it means your password is sent in clear text over the internet. Anyone snooping can see it and can then log in to your Indigo system and control it.

Re: Homebridge for HomeKit hack

PostPosted: Wed Oct 07, 2015 12:09 am
by howartp
durosity wrote:
Argh, i really wanted to get this working myself but i've just not been able to work out what you mean by 'Create a folder API on your php sever'.. i tried having a search around for that term but can't find anything that matches for PHP.. so how do i do that? :)

Durosity,

You need to find the folder that is your webserver's root on Mac. On Windows this defaults to c:\inetpub\wwwroot so http://mywinpc/hello.php would map to c:\inetpub\wwwroot\hello.php.

I'm not sure from the instructions if this thread is using a built in local webserver in OSX, or if one of the earlier packages is a webserver, but you need to identify the root folder.

What you're aiming for is to create a folder called API in that (e.g.) wwwroot folder, then a kitchenOn.php file in it, such that browsing http://mymac/API/kitchenOn.php is a valid path.

Hope that makes more sense for you; I'll follow this thread.


Sent from my iPhone using Tapatalk

Re: Homebridge for HomeKit hack

PostPosted: Wed Oct 07, 2015 1:26 am
by durosity
Ahh.. yes.. right i see.. i'll have a crack at that at the weekend.

Re: Homebridge for HomeKit hack

PostPosted: Thu Oct 08, 2015 3:12 pm
by himanshu
Hi

I had a crack at this using a slightly different approach, which does away with the apache / php installations or calling the API directly.

Its slightly easier, but not very elegant. The idea is this. There is already a very good presence plugin available called Beacon, which can accept http post requests. I modified the homebridge's accessories/http.js file very so slightly so it can post JSON data in a format that the Beacon plugin expects.

Now if I ask Siri to turn on the kitchen lights, a post request is made straight to Indigo, in a format that makes the Beacon plugin think its receiving a 'Enter' or 'Exit' location for a device. A trigger on an Enter ( configured as On in homebridge) event now turns on the lights, while that on an Exit event ( configured as Off in Homebridge) turns the lights off.

Very easily done, especially if you already have a working Beacon plugin setup. Even if not, its simpler than setting up Apache/ PHP. However, its a kludge and wont scale if the device you are trying to control has anything other than an on or off state.

If anyone is interested, I can post more details.

Cheers,

Himanshu


Sent from my iPhone using Tapatalk