• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HomeBridge with pilight on raspbian
#1
What is HomeBridge?
Quote:Homebridge is a lightweight NodeJS server you can run on your home network that emulates the iOS HomeKit API. It supports Plugins, which are community-contributed modules that provide a basic bridge from HomeKit to various 3rd-party APIs provided by manufacturers of "smart home" devices.

Since Siri supports devices added through HomeKit, this means that with Homebridge you can ask Siri to control devices that don't have any support for HomeKit at all. For instance, using just some of the available plugins, you can say:
  • Siri, unlock the front door.
  • Siri, open the garage door.
  • Siri, turn on the coffee maker.
  • Siri, turn on the living room lights.
  • Siri, good morning!
For more information click here

You will need a Iphone 5 or newer for this to work, updated to the latest version of IOS 9.

I recommend you stop the pilight service to speed this up, its however not required!
Quote:sudo service pilight stop

SSH Into Raspberry
Quote:Default Username: pi
Default Password: raspberry

Quote:sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git-core libavahi-compat-libdnssd-dev make

Raspbian Wheezy Only:
Quote:sudo nano /etc/apt/sources.list - Replace Wheezy with jessie
sudo apt-get update

All Version:
Quote:sudo apt-get install gcc-4.9 g++-4.9

Raspbian Wheezy Only:
Quote:sudo nano /etc/apt/sources.list - Replace jessie with wheezy

Install Node 4.2.4 or higher
Raspberry Pi Model A, B, B+ and Compute Module
Code:
wget https://nodejs.org/dist/v4.2.4/node-v4.2.4-linux-armv6l.tar.gz
tar -xvf node-v4.2.4-linux-armv6l.tar.gz
cd node-v4.2.4-linux-armv6l
sudo cp -R * /usr/local/

Installing Homebridge - This can take a couple of hours
Quote:sudo npm install -g homebridge

Install Homebridge-http to interact with pilight - This can take a couple of hours
Quote:npm install -g homebridge-http

Go to the home dir.
Quote:cd ~

Now run homebridge for the first time
Quote:homebridge

you should receive the following error:
Quote:Couldn't find a config.json file at '/home/pi/.homebridge/config.json'. Look at config-sample.json for examples of how to format your config.js and add your home accessories.

After running it for the first time it should create a folder .homebridge in your home directory.
to check to see if .homebridge was created run:
Quote:ls -all

now if there is no .homebridge folder something didn't go alright.

Now edit the config file by doing the following.
Quote:nano .homebridge/config.json

Code:
{
    "bridge": {
        "name": "pilight Bridge",
        "username": "CC:22:3D:E3:DD:30",
        "port": 51826,
        "pin": "420-00-420"
    },
    "description": "This is an example configuration file with one pilight device. You can use this as a template for adding more devices",
    "accessories": [
        {
            "accessory": "Http",
            "name": "Tafel",
            "switchHandling": "yes",
            "http_method": "GET",
            "on_url": "http://localhost:5001/control?device=[DeviceName]&state=on",
            "off_url": "http://localhost:5001/control?device=[DeviceName]&state=off",
            "status_url": "http://localhost:5001/status/100059",
            "service": "Light",
            "brightnessHandling": "no",
            "brightness_url": "http://localhost/controller/1707/%b",
            "brightnesslvl_url": "http://localhost/status/100054",
            "sendimmediately": "",
            "username": "",
            "password": ""
        }
    ]
}

Replace [DeviceName] with the name of your device you can find this by going to your webgui and then adding /config to the url, where you can find your Device Name.
For example
http://127.0.0.1:5001/config

After changing the config file try loading your new config by running:
Quote:homebridge

Now you will need a IOS app to add this new device to your iphone's homekit database, this can be done by apps such as Insteon+ or Lutron Home+
 
Reply
#2
Nice instructions (even though I don't actually have need for this myself Wink), However, there are 2 small problems:
1. You should probably run sudo apt-get update after modifying /etc/apt/sources.list so that apt-get will install gcc and g++ from the new repo. Then run it again after changing it back
2. The wget link to the npm download has been shortened by the forum, so copying the command won't work. You can remedy this by removing the url tags around it, so that it will show up as regular text.
 
Reply
#3
This is one of the posts/threads I hate! Sorry to be such direct.

What the hell is "HomeBridge"? I searched this forum, only one match. The author of that is the same "Jurre".
Jurre, do you think everyone can follow what you post here? Do you think one should google/search the web to understand the details?
Please make sure to introduce such new -- new to this forum -- item with description, best with a link for the background.

And yes working with REST should be easy, use /config and you get all you need .. and more, so you have to postprocess the data you get. But I think a system which sends REST cmds can handle json data to filter out what it needs.

Guenter
 
Reply
#4
(01-12-2016, 08:58 PM)pilino1234 Wrote: Nice instructions (even though I don't actually have need for this myself Wink), However, there are 2 small problems:
1. You should probably run sudo apt-get update after modifying /etc/apt/sources.list so that apt-get will install gcc and g++ from the new repo. Then run it again after changing it back
2. The wget link to the npm download has been shortened by the forum, so copying the command won't work. You can remedy this by removing the url tags around it, so that it will show up as regular text.
Good catch, I forgot to write that down. I also fixed that link.


(01-13-2016, 12:27 AM)gneandr Wrote: This is one of the posts/threads I hate! Sorry to be such direct.

What the hell is "HomeBridge"? I searched this forum, only one match. The author of that is the same "Jurre".
Jurre, do you think everyone can follow what you post here? Do you think one should google/search the web to understand the details?
Please make sure to introduce such new -- new to this forum -- item with description, best with a link for the background.
I got multiple questions asking me how I got HomeBridge working with pilight, I posted the steps here for those people. But point taken, ill might add some extra text to the introduction.


Quote:And yes working with REST should be easy, use /config and you get all you need .. and more, so you have to postprocess the data you get. But I think a system which sends REST cmds can handle json data to filter out what it needs.

I'm not sure what you are saying here, I'm not asking a question here, and im not even touching the /config info. I'm just posting the steps I did and the config file I use to make my setup work.
 
Reply
#5
Quote:I'm not sure what you are saying here, I'm not asking a question here, and im not even touching the /config info. I'm just posting the steps I did and the config file I use to make my setup work.
This relates to your other thread about REST/HomeBridge. If I didn't missed anything, the standard pilight doesn't support
Code:
http://localhost:5001/status?device=Tafel&on=1&off=0
so you have to use /config .. or did you wrote additional sw here, which wasn't clear for my, sorry.
 
Reply
#6
(01-13-2016, 01:30 AM)gneandr Wrote:
Quote:I'm not sure what you are saying here, I'm not asking a question here, and im not even touching the /config info. I'm just posting the steps I did and the config file I use to make my setup work.
This relates to your other thread about REST/HomeBridge. If I didn't missed anything, the standard pilight doesn't support
Code:
http://localhost:5001/status?device=Tafel&on=1&off=0
so you have to use /config .. or did you wrote additional sw here, which wasn't clear for my, sorry.

I'm aware of the config output, however HomeBridge does not accept such complicated response, in order for it to work with that I would need to write a additional parser that sits in between the config output and HomeBridge that then parses the config file to return a integer that is 1 or 0.
 
Reply
#7
Thanks for this tutorial.
Using iDevices and voice control for switching is a really exiting thing.

I used a Raspi 2 B with Jessie and run into trouble when installing nodejs.
Finally i came along with installing the packages node-v4.2.6-linux-armv7l.tar.gz and forcing unsafe-permissions when installing the home bridge packages

Code:
npm install --unsafe-perm --verbose -g homebridge
npm install --unsafe-perm --verbose -g homebridge-http

Now I got a running homebridge, that was found by my homekit app (MyTouchHome). I used an adapted version of the proposed config.json.
Using the app I see the devices and on switch processes on the terminal, but the lights actually don't switch on/off. Switching via plights Web-UI does works flawlessly. So obviously the connection between both system does not work.

Is there anything else I have to do for getting it up an running?
I´ve seen, that there is a npm package "homebridge-pilight". Do I need this package?

Thanks for your help
Tomtom
 
Reply
#8
Why not use this plugin: https://www.npmjs.com/package/homebridge-pilight
 
Reply
#9
(02-03-2016, 12:33 PM)mactron Wrote: Why not use this plugin: https://www.npmjs.com/package/homebridge-pilight

I´ve tried the plugin, but it does not work, so I was wondering wether someone else got plight 7 up and running and could help with a step by step instruction and sample config files.

TomTom
 
Reply
#10
(02-15-2016, 09:59 PM)tomtom Wrote: I´ve tried the plugin, but it does not work, so I was wondering wether someone else got plight 7 up and running and could help with a step by step instruction and sample config files.

TomTom

For me it works without problems. Could you give more information about what is not working?

Here is my working config.js:
Code:
{
  "bridge": {
    "name": "homebridge banana pi",
    "username": "CC:22:3D:E2:CE:30",
    "port": 51826,
    "pin": "031-45-153"
  },
  "accessories": [
    {
      "accessory": "pilight",
      "name": "Licht Schreibtisch",
      "device": "schreibtischlampe"
    },
    {
      "accessory": "pilight",
      "name": "Bildschirm Schreibtisch",
      "device": "schreibtischleiste"
    },
    {
      "accessory": "pilight",
      "name": "Stereoanlage",
      "device": "stereoanlage"
    }
  ],
  "platforms": [
  ]
}
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Does piSchedule work with pilight 8.1.1-nightly Peter S 0 1,403 06-29-2018, 07:57 PM
Last Post: Peter S
  pilight-console - an LCD / keypad interface for pilight frenchie71 3 1,140 11-21-2017, 11:15 PM
Last Post: curlymo
  Connect pilight to your hue bridge hannemann 3 2,400 01-03-2017, 11:26 PM
Last Post: hannemann
Wink PHP class using pilight socket connection Dan 0 1,357 11-03-2016, 11:41 AM
Last Post: Dan
  piScheduler -- A pilight extension for the daily switch plan gneandr 159 59,930 08-09-2016, 04:33 PM
Last Post: gneandr
  Controlling a RGB Led Strip over pilight mightyuhu 2 2,266 08-06-2016, 09:10 PM
Last Post: JohannK
  pilight voice commands kniazio 11 5,255 01-29-2016, 07:51 PM
Last Post: sral
  Python Ping pilight detect mobilephone Cryptomaster 0 2,022 01-10-2016, 04:17 PM
Last Post: Cryptomaster
  pilight config editor ktams 16 7,373 01-06-2016, 02:42 PM
Last Post: ktams
  command processing between pilight and openhab royhofman1989 3 2,682 07-13-2015, 11:26 AM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)