• Search

  • Where To Find Me

  • Blahg Categories

  • Digital Penguins

  • Meta

  • « | Main | »

    Home Automation with HomeBridge

    By Derek | March 14, 2016

    I found a cool project called Homebridge; it lets you bridge Apple’s HomeKit (and therefor Siri) to home automation items that aren’t natively HomeKit compatible.

    tl;dr I have my WeMo lights and my Craftsman AssureLink garage door opener added to my HomeKit configuration, along with my HomeKit native Ecobee 3 (which is not actually discussed here).

    Install Notes

    To get Homebridge running, you’ll need a computer that can run node.js. This includes at least Mac and Linux.

    Before You Install

    Since I have a Mac, I performed:

    $ sudo brew install npm

    before attempting the homebridge install, as I needed node.js installed first. I use homebrew to install and manage packages on my Mac.

    Install

    Then I installed according to the instructions.

    Before You Run Homebridge For The First Time

    Make sure you copy the config-sample.json to your ~/.homebridge directory, and rename that file config.json.

    Edit the file, in your favorite text editor.  I used vim.

    Before you get homebridge running, I recommend changing the PIN (in your ~/.homebridge/config.json file) to something other than the default. I don’t think it’s necessary to change your username, but it’s probably not a bad idea.

    Starting Homebridge

    Now, start it, and pair it with iOS. I recommend doing this before installing any plugins. If you don’t already have any HomeKit stuff, you won’t have a HomeKit configuration (listed under Settings in iOS).

    Elgato Eve For iOS

    A word about iOS apps. I’ve settled on Elgato’s Eve for my needs. It’s clean, straightforward, and free. Also, it looks nice on both the iPhone and iPad screens. I tried a few other apps, some were OK, but one in particular kept renaming my rooms “Replaced RoomName”. I finally figured out that it was creating HomeKit “Service Groups” with my Rooms, and then creating new replacement rooms. Very frustrating. I won’t name the app, because honestly, it might have been me doing something wrong.

    In order to pair Homebridge, if this is your first “Accessory” for HomeKit, fire up the Eve app. It should prompt you to add an accessory. I had to manually enter the PIN for mine, as I couldn’t get my iPhone to capture it from the screen, which worked perfectly for my Ecobee3.

    Once that’s done, you have a working HomeKit configuration. Now it’s time to add your stuff!

    Press CTRL+C to exit Homebridge.

    WeMo

    The first thing I added was my WeMo accessories. It seems there are a couple of different plugins for WeMo. I used the homebridge-platform-wemo located at that link. No reason, I just grabbed it first, and it worked.

    Install the plugin, then again, edit your config.json:

    Here’s my config snippet: (my entire config is posted below)

    "platforms": [
      {
        "platform": "BelkinWeMo",
        "name": "WeMo Platform",
        "expected_accessories" : "6",
        "timeout" : "25",
        "no_motion_timer": "60",
        "homekit_safe" : "1"
      }
    ]

    Make sure you leave homekit_safe set to 1. This causes Homebridge to “exit” (crash) if it doesn’t find the correct amount of accessories. Also, set expected_accessories to the number of WeMo devices you have. Sometimes when you start Homebridge, it doesn’t find all of them, you want it to exit, so you can start it again.

    Now, restart Homebridge. It should detect your WeMo devices, and you should see them show up in Eve. That’s literally it.

    Craftsman AssureLink

    Once I had that up and running, I looked briefly for support for the Craftsman AssureLink, without finding it. So, I gave up for the night.

    However, the next day I went to help a friend set Homebridge up. He has a Chamberlain garage door opener, which we got working, using the homebridge-liftmaster plugin.

    Through some searching, it appears that the LiftMaster, Chamberlain and Craftsman garage door openers all use the same APIs. Well, almost the same APIs. The Craftsman has a different URL and “app key” than the LiftMaster and the Chamberlain.

    Once I figured that out, I was able to get mine on-line.

    First, install the plugin.

    Part 1: config.json

    Then, edit your config.json, here’s my snippet: (entire config below)

    "accessories": [
      {
        "accessory": "LiftMaster",
        "name": "Garage Door Opener",
        "username": "REDACTED",
        "password": "REDACTED"
      }
    ],

    Your username and password is exactly what you use in your iOS app. However, this is only half of the equation.

    Part 2: Modify index.js

    Locate the plugin’s downloaded index.js file. As I run installed using brew on my Mac, mine was at the following path:

    /usr/local/lib/node_modules/homebridge-liftmaster/index.js

    I suggest you make a copy of this file before you edit it.

    cd /usr/local/lib/node_modules/homebridge-liftmaster/
    cp index.js index-dist.js

    Now, edit the file. You’ll change four lines total.

    The line that shows:

    var APP_ID = "JVM/G9Nwih5BwKgNCjLxiFUQxQijAebyyg8QUHr7JOrP+tuPb8iHfRHKwTmDzHOu"

    Change to:

    var APP_ID = "eU97d99kMG4t3STJZO/Mu2wt69yTQwM0WXZA5oZ74/ascQ2xQrLD/yjeVhEQccBZ"

    Then, find three lines that are similar to this:

    url: "https://myqexternal.myqdevice.com/ ...

    and change them all to:

    url: "https://craftexternal.myqdevice.com/...

    To be perfectly clear, you are only changing the word myqexternal to craftexternal.

    Do not change any other part of the lines!

    Save the file, and restart Homebridge.

    Homebridge should locate and recognize your Craftsman AssureLink. Don’t worry that it calls it a liftmaster. Test it out, it should work nicely.

    Congrats!

    Auto Start Homebridge

    Once you are certain that your Homebridge is working properly, and it has all the accessories added that you need, now you need to get it to auto-start when you log into your Mac.

    I followed the discussion Mac Auto Start Discussion here and ended up with a .plist as such:

    <?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>Label</key>
      <string>homebridge</string>
      <key>ProgramArguments</key>
      <array>
        <!-- Modify these two lines to reflect your node location and homebridge install location -->
        <string>/usr/local/bin/node</string>
        <string>/usr/local/bin/homebridge</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
      <key>KeepAlive</key>
      <true/>
    </dict>
    </plist>

    In the discussion, there are some lines for log files, but with those in, homebridge kept crashing, so I took them out.

    Anyways,  the link above takes you to the comment that I followed, by chrischernoff.

    Good Luck!

    Photos

    elgato-eve-ipad

    Elgato’s Eve on iPad

    URLs

    Homebridge

    Homebridge | https://github.com/nfarina/homebridge
    Homebridge config-sample.json | https://github.com/nfarina/homebridge/blob/master/config-sample.json
    Homebridge Mac Auto Start Discussion | https://github.com/nfarina/homebridge/issues/316

    Homebridge Plugins

    WeMo | https://github.com/rudders/homebridge-platform-wemo
    LiftMaster | https://github.com/nfarina/homebridge-liftmaster
    LiftMaster vs. Craftsman discussion | https://github.com/nfarina/homebridge/issues/136

    HomeKit iOS App

    Elgato’s Eve iOS app | https://itunes.apple.com/us/app/elgato-eve/id917695792?mt=8

    Home Automation Products I Used

    Belkin WeMo | http://www.wemo.com/products.html
    Chamberlain | https://www.chamberlain.com
    CraftsmanAssureLink | https://assurelink.craftsman.com

    Package Management

    Homebrew | http://brew.sh

    My config.json

    $ cat ~/.homebridge/config.json
    {
      "bridge": {
        "name": "Homebridge",
        "username": "REDACTED",
        "port": 51826,
        "pin": "REDACTED"
      },
      "description": "config file.",
      "accessories": [
        {
          "accessory": "LiftMaster",
          "name": "Garage Door Opener",
          "username": "REDACTED",
          "password": "REDACTED"
        }
      ],
      "platforms": [
        {
          "platform": "BelkinWeMo",
          "name": "WeMo Platform",
          "expected_accessories" : "6",
          "timeout" : "25",
          "no_motion_timer": "60",
          "homekit_safe" : "1"
        }
      ]
    }
    

    Topics: Apple, Home Improvement, Linux, Me, Technology | No Comments »

    Comments

    You must be logged in to post a comment.