{"id":772,"date":"2017-06-21T18:40:57","date_gmt":"2017-06-22T00:40:57","guid":{"rendered":"http:\/\/www.schwie.com\/brad\/?p=772"},"modified":"2022-01-29T00:52:37","modified_gmt":"2022-01-29T06:52:37","slug":"homebridge-notes","status":"publish","type":"post","link":"https:\/\/www.schwie.com\/brad\/?p=772","title":{"rendered":"Homebridge and Garadget notes"},"content":{"rendered":"<p>** Sadly, a tree fell on our old garage and took out our old opener not long after I recorded these notes, so they aren&#8217;t as refined as I&#8217;d like them to be; however, they might serve others getting stuck setting up their Garadget. **<\/p>\n<p>To install homebridge, I followed these instructions:<br \/>\n<a href=\"https:\/\/community.garadget.com\/t\/homekit-integration-with-homebridge-garadget-plugin\/664\">https:\/\/community.garadget.com\/t\/homekit-integration-with-homebridge-garadget-plugin\/664<\/a><br \/>\nand<br \/>\n<a href=\"https:\/\/github.com\/nfarina\/homebridge\/wiki\/Install-Homebridge-on-OSX\">https:\/\/github.com\/nfarina\/homebridge\/wiki\/Install-Homebridge-on-OSX<\/a><\/p>\n<p>From Terminal.app, I ran:<\/p>\n<p><code>sudo npm install -g --unsafe-perm homebridge<\/code><br \/>\n(unsafe-perm was needed on macOS Sierra, not sure about other systems)<\/p>\n<p>After installing homebridge, begin installing plugins for your accessories. For instance, to install a plugin for an open source garage door opener, Garadget, <a href=\"https:\/\/github.com\/xNinjasx\/homebridge-garadget\">read the plugin instructions<\/a>, then open Terminal and paste in:<\/p>\n<p><code>sudo npm install -g homebridge-garadget<br \/>\ncd ~\/.homebridge<br \/>\npico config.json<\/code><\/p>\n<p>Paste in the text below and save it (you can skip the &#8220;Platforms&#8221; section, as that is for other devices I&#8217;m using on the network):<\/p>\n<p><code>{<br \/>\n  \"bridge\": {<br \/>\n    \"name\": \"Homebridge\",<br \/>\n    \"username\": \"CC:22:3D:E3:CE:39\",<br \/>\n    \"port\": 51826,<br \/>\n    \"pin\": \"031-45-154\"<br \/>\n  },<\/p>\n<p>  \"description\": \"Garadget as an accessory.\",<br \/>\n  \"accessories\": [{<br \/>\n    \"accessory\": \"Garadget\",<br \/>\n    \"name\": \"Garage Door\",<br \/>\n    \"cloudURL\": \"https:\/\/api.particle.io\/v1\/devices\/\",<br \/>\n    \"deviceID\": \"500031001851353432393433\",<br \/>\n    \"access_token\": \"7ab6b8b49072b6caf7490b8beb0a75086b1f4401\"<br \/>\n       }<br \/>\n  ],<\/p>\n<p>\"platforms\": [<br \/>\n        {<br \/>\n          \"platform\": \"BelkinWeMo\",<br \/>\n          \"name\": \"WeMo Platform\",<br \/>\n          \"expected_accessories\" : \"1\",<br \/>\n          \"timeout\" : \"25\",<br \/>\n          \"no_motion_timer\": \"60\",<br \/>\n          \"homekit_safe\" : \"1\"<br \/>\n        },<br \/>\n\t        {<br \/>\n            \"platform\": \"Nest\",<\/p>\n<p>            \"token\" : \"c.mLRXPhJxsllnEk2XGVkh4yE4iceogLwK19iyRihYLJaZOWWl6vadUBw0pYzNH5Nqyu5ANCjmnay4PzGXmCX7xiQifgJro7rymQgTKdsxQ4Z7GwJEUya0jpU2y3C8YBSLntYuy4kZIPsNaQDb\",<\/p>\n<p>            \"clientId\": \"0fb9563b-16b3-4452-8721-268df1104d5a\",<br \/>\n            \"clientSecret\": \"8o4x71vmef6BDieuLTNwLyZx4\",<br \/>\n            \"code\": \"RLZC9XJX\",<\/p>\n<p>            \"username\" : \"brad@schwie.com\",<br \/>\n            \"password\" : \"schw0143\"<br \/>\n        }<br \/>\n    ]<\/p>\n<p>}<\/code><\/p>\n<p>The Garadget plug-in requires a bit more tinkering of obtaining a Device ID and Access Token using Chrome, <a href=\"http:\/\/community.garadget.com\/t\/using-garadget-in-ifttts-recipes\/440\">as described here<\/a>.<\/p>\n<p>An example config.json file <a href=\"https:\/\/github.com\/xNinjasx\/homebridge-garadget\">is here<\/a> if you don&#8217;t want to copy and paste what I laid out above.<\/p>\n<p>In my case, the Garadget device ID was:<br \/>\n<a href=\"https:\/\/api.particle.io\/v1\/devices\/500031001851353432393433\/setState\">https:\/\/api.particle.io\/v1\/devices\/500031001851353432393433\/setState<\/a><br \/>\nwith access_token:<br \/>\n7ab6b8b49072b6caf7490b8beb0a75086b1f4401<\/p>\n<p>Paste the Device ID and Access Token into your ~.\/homebridge\/config.json file.<\/p>\n<p>I can&#8217;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.<\/p>\n<p>TROUBLESHOOTING:<br \/>\nThe garadget access_token reset 90 days after I started using homebridge. It took me a while to figure this out &#8211; just couldn&#8217;t dedicate time to it &#8211; but finally got it working again:<\/p>\n<p>While running homebridge, I tried opening the garage door from the homekit hub device, my daughter&#8217;s iPad, using the Home app. But the garadget button in Home app said &#8220;No Response&#8221;, 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:<\/p>\n<p>[6\/21\/2017, 4:20:12 PM] [Garage Door] Set state to closed<br \/>\n[6\/21\/2017, 4:20:12 PM] [Garage Door] Error &#8216;null&#8217; setting door state. Response: {&#8220;error&#8221;:&#8221;invalid_token&#8221;,&#8221;error_description&#8221;:&#8221;The access token provided is invalid.&#8221;}<br \/>\n[6\/21\/2017, 4:20:14 PM] [Garage Door] state =  1<br \/>\n[6\/21\/2017, 4:20:14 PM] [Garage Door] Set state to closed<br \/>\n[6\/21\/2017, 4:20:14 PM] [Garage Door] Error &#8216;null&#8217; setting door state. Response: {&#8220;error&#8221;:&#8221;invalid_token&#8221;,&#8221;error_description&#8221;:&#8221;The access token provided is invalid.&#8221;}<\/p>\n<p>At least two things can mess up your access_token:<\/p>\n<p>1. Using the web app (accessing the garadget from a web browser &#8211; https:\/\/www.garadget.com\/my\/) seems to request a new token from the Garadget, which then causes the old token to be purged.<\/p>\n<p>2. Every 90 days the garadget token seems to expire.<\/p>\n<p>I&#8217;m not sure which of these cases bit me, but I&#8217;ll update this later when I know.<\/p>\n<p>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.<\/p>\n<p>***********************************<br \/>\nTo update npm:<br \/>\nsudo npm install -g npm<\/p>\n<p>To find outdated homebridge plugins:<br \/>\nsudo npm outdated -g<\/p>\n<p>To update homebridge:<br \/>\nsudo npm install -g -unsafe-perm homebridge@latest -g<\/p>\n<p>To update home bridge plugins:<br \/>\nsudo npm install -g -unsafe-perm homebridge-pluginname@latest -g<br \/>\nsudo npm install -g -unsafe-perm homebridge-nest@latest -g<br \/>\nsudo npm install -g -unsafe-perm homebridge-platform-wemo@latest -g<br \/>\nsudo npm install -g -unsafe-perm homebridge-lifx-lan@latest -g<br \/>\nsudo npm install -g -unsafe-perm git+https:\/\/github.com\/luisiam\/homebridge-liftmaster2.git -g<br \/>\nsudo npm install -g -unsafe-perm homebridge-samsung-tizen<\/p>\n<p>homebridge runs out of launchDaemons on the Mac mini. To restart it, unload it:<br \/>\nsudo launchctl unload \/Library\/LaunchDaemons\/com.homebridge.server.plist<\/p>\n<p>and then re-load it:<br \/>\nsudo launchctl load \/Library\/LaunchDaemons\/com.homebridge.server.plist<\/p>\n","protected":false},"excerpt":{"rendered":"<p>** Sadly, a tree fell on our old garage and took out our old opener not long after I recorded these notes, so they aren&#8217;t as refined as I&#8217;d like them to be; however, they might serve others getting stuck &hellip; <a href=\"https:\/\/www.schwie.com\/brad\/?p=772\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-772","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts\/772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=772"}],"version-history":[{"count":6,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts\/772\/revisions"}],"predecessor-version":[{"id":1140,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=\/wp\/v2\/posts\/772\/revisions\/1140"}],"wp:attachment":[{"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.schwie.com\/brad\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}