After researching many hours on the internet and reviewed several sites related to the topic, I decided to summarize the details on how to control your smartthings hub with Siri and put together this post.
Here is how to install Homebridge (Apple HomeKit bridge) on a Raspberry Pi and integrate it with Smartthings:
1- You need to install your Raspberry Pi
- Install your Pi by following these instructions: https://www.raspberrypi.org/help/noobs-setup/
2- Install Node.js on the Raspberry Pi
- wget https://nodejs.org/dist/v5.2.0/node-v5.2.0-linux-armv7l.tar.gz
- tar -xvf node-v5.2.0-linux-armv7l.tar.gz
- cd node-v5.2.0-linux-armv7l
- sudo cp -R * /usr/local/
- To check Node.js is properly install and you have the right version, run the command:
- node –v
3- Install the latest version of NPM
- sudo npm install npm -g
4- Install Homebridge on the Homebridge
- sudo npm install -g homebridge
- sudo npm install -g homebridge-smartthings (See https://www.npmjs.com/package/homebridge-smartthings)
5- Login to the SmartThings IDE (https://graph.api.smartthings.com) and create a JSON API SmartApp
Login using your SmartThings account that you created as part of the SmartThings kit/hub install.
Goto the ‘My SmartApps’ tab
Click ‘+ New SmartApp’ button top right
Click ‘From Code’
In another browser window, go here:
click the ‘Raw’ button
Select all the code (Ctrl-A) and copy it (Ctrl-C)
Go back to the SmartThings IDE window and paste the code you just copied into the code window.
- Click ‘Create’
- Click ‘App Settings’
- Click ‘OAuth’
- Click ‘Enable OAuth in Smart App’ leave all settings as defaults
- Click ‘Update’
- Click ‘Publish’ and ‘For Me’
6- Install the new JSON API SmartApp in SmartThings
Load the SmartThings app on your iPhone.
Go to the ‘Marketplace’ by tapping the icon in the bottom right (blue, green and yellow icon that looks a bit like a star).
Tap ‘My Apps’
Tap ‘JSON API’
You can now select any of devices that you may want to control with HomeKit.
The next screen should then display the configuration that we need to use in the Homebridge server. It should look something like this (I’ve replaced the actual keys with xxx):
“description”: “JSON API”,
7- Setup a config.json file for Homebridge
- Connect to your Raspberry Pi:
- cd /home/pi/.homebridge
- sudo vi config.json
“description”: “JSON API”,
- Now we can start the Homebridge server by running: homebridge
- To view the running logs, you can
tailthe output log or error log:
- tail -f /var/log/homebridge.log
- tail -f /var/log/homebridge.err
8- Install plugins (https://www.npmjs.com/search?q=homebridge-plugin)
These are the ones that I tried and it’s respective npm commands:
- sudo npm i homebridge-harmonyhub
- sudo npm i homebridge-people
- sudo npm i homebridge-platform-wemo
- sudo npm i homebridge-lifx-lan
- sudo npm i homebridge-thermostat
9- Add HomeKit to iOS
HomeKit is actually not an app; it’s a “database” similar to HealthKit and PassKit. If you upgraded your device to iOS 10, there is a new app called “Home” where you should be able to discover the “homebridge” device on your network (if you have an older iOS version you can also try iDevice, Eve or Devices to discover “homebridge”).
When you attempt to add Homebridge, it will ask for a “PIN code”. The default code is 031-45-154, but I highly recommend you to change it to something else.
If iOS can’t find Homebridge, it could be related to the fact that the Homebridge server thinks it’s been paired with, but iOS thinks otherwise. It can be fixed by deleting
persist/ directory files which are next to your
config.json. If the issue continues, iOS device has gotten your Homebridge
username (looks like a MAC address) “stuck” somehow, where it’s in the database but inactive. Fix: change your
username in the “bridge” section of
config.json to be some new value.
10- Remote Access (outside the home network):
If you own a third-generation Apple TV or newer (or an iPad running iOS 10), HomeKit accessories can be controlled with an iOS device away from home, even when Wi-Fi or Bluetooth are not available and you’re using a phone’s cellular connection.
- Disable 2-factor authentication
- On Apple TV, sign out of iCloud and iTunes Store
- Sign back on on both iCloud and iTunes Store
- Verify that you can access Homekit from outside the home network (turn off wifi on your iphone)
- Re-enable 2-factor authentication
For additional information please check: https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi