Homebridge and Garadget notes

** Sadly, a tree fell on our old garage and took out our old opener not long after I recorded these notes, so they aren’t as refined as I’d like them to be; however, they might serve others getting stuck setting up their Garadget. **

To install homebridge, I followed these instructions:
https://community.garadget.com/t/homekit-integration-with-homebridge-garadget-plugin/664
and
https://github.com/nfarina/homebridge/wiki/Install-Homebridge-on-OSX

From Terminal.app, I ran:

sudo npm install -g --unsafe-perm homebridge
(unsafe-perm was needed on macOS Sierra, not sure about other systems)

After installing homebridge, begin installing plugins for your accessories. For instance, to install a plugin for an open source garage door opener, Garadget, read the plugin instructions, then open Terminal and paste in:

sudo npm install -g homebridge-garadget
cd ~/.homebridge
pico config.json

Paste in the text below and save it (you can skip the “Platforms” section, as that is for other devices I’m using on the network):

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

"description": "Garadget as an accessory.",
"accessories": [{
"accessory": "Garadget",
"name": "Garage Door",
"cloudURL": "https://api.particle.io/v1/devices/",
"deviceID": "500031001851353432393433",
"access_token": "7ab6b8b49072b6caf7490b8beb0a75086b1f4401"
}
],

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

"token" : "c.mLRXPhJxsllnEk2XGVkh4yE4iceogLwK19iyRihYLJaZOWWl6vadUBw0pYzNH5Nqyu5ANCjmnay4PzGXmCX7xiQifgJro7rymQgTKdsxQ4Z7GwJEUya0jpU2y3C8YBSLntYuy4kZIPsNaQDb",

"clientId": "0fb9563b-16b3-4452-8721-268df1104d5a",
"clientSecret": "8o4x71vmef6BDieuLTNwLyZx4",
"code": "RLZC9XJX",

"username" : "brad@schwie.com",
"password" : "schw0143"
}
]

}

The Garadget plug-in requires a bit more tinkering of obtaining a Device ID and Access Token using Chrome, as described here.

An example config.json file is here if you don’t want to copy and paste what I laid out above.

In my case, the Garadget device ID was:
https://api.particle.io/v1/devices/500031001851353432393433/setState
with access_token:
7ab6b8b49072b6caf7490b8beb0a75086b1f4401

Paste the Device ID and Access Token into your ~./homebridge/config.json file.

I can’t remember why, but I also needed to tweak my homebridge settings in ~./config.json file by changing the port number from 51826 to 59393.

TROUBLESHOOTING:
The garadget access_token reset 90 days after I started using homebridge. It took me a while to figure this out – just couldn’t dedicate time to it – but finally got it working again:

While running homebridge, I tried opening the garage door from the homekit hub device, my daughter’s iPad, using the Home app. But the garadget button in Home app said “No Response”, which was what I was seeing from other devices. When I looked at the output of homebridge from the macOS Sierra server, I noticed the following output, which indicated the token was no longer working:

[6/21/2017, 4:20:12 PM] [Garage Door] Set state to closed
[6/21/2017, 4:20:12 PM] [Garage Door] Error ‘null’ setting door state. Response: {“error”:”invalid_token”,”error_description”:”The access token provided is invalid.”}
[6/21/2017, 4:20:14 PM] [Garage Door] state = 1
[6/21/2017, 4:20:14 PM] [Garage Door] Set state to closed
[6/21/2017, 4:20:14 PM] [Garage Door] Error ‘null’ setting door state. Response: {“error”:”invalid_token”,”error_description”:”The access token provided is invalid.”}

At least two things can mess up your access_token:

1. Using the web app (accessing the garadget from a web browser – https://www.garadget.com/my/) seems to request a new token from the Garadget, which then causes the old token to be purged.

2. Every 90 days the garadget token seems to expire.

I’m not sure which of these cases bit me, but I’ll update this later when I know.

To fix this issue, open the config.json app (mine was at ~/.homebridge), I grabbed my updated token following these instructions (https://community.garadget.com/t/using-garadget-in-ifttts-recipes/440), and then I inserted the updated token in the config.json app. Bam. Everything is working again.

***********************************
To update npm:
sudo npm install -g npm

To find outdated homebridge plugins:
sudo npm outdated -g

To update homebridge:
sudo npm install -g -unsafe-perm homebridge@latest -g

To update home bridge plugins:
sudo npm install -g -unsafe-perm homebridge-pluginname@latest -g
sudo npm install -g -unsafe-perm homebridge-nest@latest -g
sudo npm install -g -unsafe-perm homebridge-platform-wemo@latest -g
sudo npm install -g -unsafe-perm homebridge-lifx-lan@latest -g
sudo npm install -g -unsafe-perm git+https://github.com/luisiam/homebridge-liftmaster2.git -g
sudo npm install -g -unsafe-perm homebridge-samsung-tizen

homebridge runs out of launchDaemons on the Mac mini. To restart it, unload it:
sudo launchctl unload /Library/LaunchDaemons/com.homebridge.server.plist

and then re-load it:
sudo launchctl load /Library/LaunchDaemons/com.homebridge.server.plist

Leave a Reply

Your email address will not be published. Required fields are marked *