homebridge-indigo installation instructions

Posted on
Tue Feb 02, 2016 11:58 pm
webdeck offline
Posts: 359
Joined: May 07, 2005

homebridge-indigo installation instructions

IMPORTANT: These instructions only apply if you are NOT using the Homebridge Buddy plugin.

The Homebridge Buddy plugin handles all of the installation and configuration of Homebridge for you, and is recommended for the majority of users. So if you want the simplest install, ignore these instructions and go here:

http://forums.indigodomo.com/viewforum.php?f=204

But if you really want to do this the hard way and install and configure everything by hand, read on for the details...









Installing Homebridge 2.0

My instructions assume you want to install Homebridge onto a Mac. Feel free to translate these commands into some other OS.

First, you need Node.js and npm installed. There are many ways to do this, but for this example, I'm going to use MacPorts to do the installation because it's easier. Feel free to install them some other way if you prefer (e.g. Homebrew.)

Install MacPorts, following the instructions on this page: https://www.macports.org/install.php

Now, you can open terminal, and use MacPorts to install Node.js and npm:
Code: Select all
sudo port install nodejs
sudo port install npm

Now, you can use npm to install homebridge and my homebridge-indigo plugin:
Code: Select all
sudo npm install -g homebridge
sudo npm install -g homebridge-indigo

You can learn more about how to configure homebridge here: https://www.npmjs.com/package/homebridge

You can learn more about how to configure homebridge-indigo here: https://www.npmjs.com/package/homebridge-indigo

In a nutshell, you need to create a config.json file in your ~/.homebridge directory. A sample configuration is included with homebridge-indigo. Let's copy it to the right place to start:
Code: Select all
mkdir -p ~/.homebridge
cp /opt/local/lib/node_modules/homebridge-indigo/sampleconfig.json ~/.homebridge/config.json
open ~/.homebridge


These commands create the new .homebridge directory and put a sample config.json in there. Then it opens the .homebridge directory in the Finder so you can see it.

I recommend using a plain text editor, like TextWrangler http://www.barebones.com/products/textwrangler/ or CudaText https://sourceforge.net/projects/cudatext/files/latest/download?source=files, for example. Some editors will put in curly quotes instead of straight quotes, and that's going to cause you problems. You can turn this off on your Mac's System Preferences -> Keyboard -> Text -> uncheck "use smart quotes and dashes." Open the config.json file in the editor. It should look something like this:

Code: Select all
{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },

    "description": "This is an example configuration file to configure the Indigo platform plugin. See README.md for more details.",

    "platforms": [
        {
            "platform": "Indigo",
            "name": "My Indigo Server",
            "protocol": "http",
            "host": "127.0.0.1",
            "port": "8176",
            "path": "",
            "username": "myusername",
            "password": "mypassword",
            "includeActions": true,
            "includeIds": [ "12345", "67890" ],
            "excludeIds": [ "98765", "43210" ],
            "treatAsSwitchIds": [ "13579", "24680" ],
            "treatAsLockIds": [ "112233", "445566" ],
            "treatAsDoorIds": [ "224466", "664422" ],
            "treatAsGarageDoorIds": [ "223344", "556677" ],
            "thermostatsInCelsius": false,
            "accessoryNamePrefix": ""
        }
    ],

    "accessories": [
    ]
}


Don't mess with anything in the top bridge section - that is the HomeKit device that will be exposed to your HomeKit apps. There is also no reason to touch the accessories section at the bottom. Everything you need to edit is in the middle platforms section.

Edit host to point to your Indigo server if you're running it on a different Mac. If you changed the Indigo web server port, then edit port as well. Edit myusername and mypassword to be correct for your server. If you don't have passwords turned on for your server, then just delete those two lines. If you don't want switches created for your action groups, then change true to false next to includeActions. If you're using some kind of proxy in front of Indigo and changed its root directory, the you can put that inside the empty quotes next to path.

You can also exclude some devices based on their IDs, or only include a set of devices based on their IDs. There is a limit of 99 devices, so if you have a lot of devices and actions, you're going to want to do some including or excluding to stay under that limit. Note that Indigo will automatically exclude any device or action that has "Display in remote UI" unchecked, because they're not accessible from the RESTful API. So that's another way to trim down your device and action lists.

IMPORTANT: You must edit the includeIds and excludeIds lines in the sample configuration, or else none of your devices will be included. If you don't want to exclude any devices, you can just delete those two lines.

You can even "trick" HomeKit into thinking some on/off devices are switches, locks, doors, or garage doors. See the full documentation here for more details: https://www.npmjs.com/package/homebridge-indigo

Note that except for true and false, all the other values are inside double quotes - straight double quotes, not curly double quotes.

Don't forget to save the file when you're done.

Now you're ready to run homebridge. I use -D to get the extra debugging output:
Code: Select all
homebridge -D


Now, use a HomeKit enabled app on iOS to create a Home, then add devices, and you should see Homebridge, select that, you should get a warning, say add anyway, and then enter the PIN, which by default is 031-45-154. Then you should see your Indigo devices (and action groups if you chose to include them in your config.) Note that any Indigo devices that have Remote Display unchecked will not appear, as they are not exposed in the Indigo RESTful API.


Using Siri

Give iCloud a few minutes to catch up, and then you should be able to use Siri to control your devices. For example:
  • Turn on the Device Name
  • Dim the Device Name to 50 percent
  • Turn off the Device Name
  • Turn on the Action Group Name
  • What is the Thermostat Device Name current temperature?
  • Set the Thermostat Device Name heating threshold temperature to 70 degrees
  • Set the Thermostat Device Name cooling threshold temperature to 80 degrees
  • Set the Thermostat Device Name target temperature to 75 degrees


Running Homebridge automatically when you log in

In Terminal, which homebridge will tell you where homebridge was installed, and echo $HOME/.homebridge will tell you the path to your .homebridge directory.

The key to getting homebridge to run outside of Terminal is to pass it the -U flag that tells it where to find the .homebridge directory, since it can't find your home directory if it's run outside of a login shell.

One thing to be aware of with launchctl is that it is possible that it could start up homebridge before your Indigo server is ready, which means it won't discover any devices. To try to avoid that, the script below waits for one minute before starting homebridge.

First, create this shell script in your home directory and call it runhomebridge
Code: Select all
#!/bin/sh
export PATH=/usr/local/bin:/opt/local/bin:$PATH
sleep 60
exec homebridge >~/Library/Logs/homebridge.log 2>&1


Make the script executable with chmod +x ~/runhomebridge

Now, create this launchctl plist and save it as ~/Library/LaunchAgents/com.webdeck.homebridge.plist - NOTE: Replace USERNAME with your account name (the command whoami will tell you your account name)
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>KeepAlive</key>
   <true/>
   <key>Label</key>
   <string>com.webdeck.homebridge</string>
   <key>ProgramArguments</key>
   <array>
      <string>/Users/USERNAME/runhomebridge</string>
   </array>
</dict>
</plist>


To start: launchctl load -w ~/Library/LaunchAgents/com.webdeck.homebridge.plist

To stop: launchctl unload -w ~/Library/LaunchAgents/com.webdeck.homebridge.plist

All output will be logged to ~/Library/Logs/homebridge.log


If you run into issues, post the error messages in a new thread here and I (and the rest of the community) will do our best to support you.

-Mike

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest