Introduction: Integrate Smart Shades Into Apple HomeKit Using Raspberry Pi 3

Simple step by step guide to controlling Smart Shades (http://www.somasmarthome.com) with Apple HomeKit/Siri.

Will need:

1x Smart Shade (to get started - can buy them from http://www.somasmarthome.com)

1x Raspberry Pi 3 (integrated Bluetooth)

Step 1: Mount Your Smart Shade

Install and setup your Smart Shade into your desired location - steps for doing this can be found here - https://youtu.be/9DTAcZiiFYU

Step 2: Setup Your Raspberry Pi & Install Homebridge

Follow this great step by step guide to installing your Raspberry Pi and also installing the HomeBridge service which is used to connect/bridge your non-HomeKit accessories and make them HomeKit enabled

https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi

Step 3: Install the Smart Shades Python Script

1. Download the python script file from this website - https://bitbucket.org/jeremynoel476/smartblinds-diy

2. Extract the file from the downloaded zip file and place it in your /home/pi directory (I changed the name of the file and just called it "control.py" to make things easier)

3. Enable your Bluetooth adaptor - sudo hciconfig hci0 up

4. Now scan for your Smart Shades which are normally named RISExxx using this command - sudo hcitool lescan

5. Make note of the Smart Shade MAC address

Step 4: Install Command Prompt Package

This step is needed so that you can setup a switch button for HomeKit and have commands running to open and close shades.

To install this package for HomeBridge bring up the terminal on your Raspberry Pi and run this command at the prompt

sudo npm install -g homebridge-cmdswitch2

Or alternatively follow the guide from this link - https://www.npmjs.com/package/homebridge-cmdswitch2

Step 5: Create Switches for HomeKit

Next is to create a switch for HomeKit integration and add commands to move the shades up or down.

The following commands that work with the script are below, followed by my script setup:

sudo python control.py -t 00:00:00:00:00:00 -c get_battery [prints out the device's current battery level]

sudo python control.py -t 00:00:00:00:00:00 -c get_position [prints out the device's current position]

sudo python control.py -t 00:00:00:00:00:00 -c move_up [moves the device to its highest position]

sudo python control.py -t 00:00:00:00:00:00 -c move_down [moves the device to its lowest position]

sudo python control.py -t 00:00:00:00:00:00 -c move_target -a 75 [moves the device to the specified position with 0 being the highest and 100 the lowest position]


I created 2 switches 1 for each task so it didn't matter whether the switch was switched on or off but you can create just the 1 switch if you want.

To create the 2 separate switches, on your Raspberry Pi go to your /home/pi/.homebridge folder and edit the "config.json" file

Add in the following code under the platforms, you'll also notice on my "Close Shades" I have set a move_target so that it doesn't close all the way to allow the dogs to get in and out of the house without being blocked by the shades. Also insert your own Smart Shades MAC Address where replacing the 0's below.

{

"platform": "cmdSwitch2",
"switches": [{
"name": "Open Shades",
"on_cmd": "sudo python control.py -t 00:00:00:00:00:00 -c move_up",
"off_cmd": "sudo python control.py -t 00:00:00:00:00:00 -c move_up",
"state_cmd": "sudo python control.py -t 00:00:00:00:00:00 -c get_position"
},{
"name": "Close Shades",
"on_cmd": "sudo python control.py -t 00:00:00:00:00:00 -c move_target -a 65",
"off_cmd": "sudo python control.py -t 00:00:00:00:00:00 -c move_target -a 65",
"state_cmd": "sudo python control.py -t 00:00:00:00:00:00 -c get_position"
}]
}

Step 6: Download HomeKit Compatible APP on Phone

Now that the setup is complete you will need to download an app if you want to manually control the shades via HomeKit or by using Siri. You can also set scenes and events with time triggers to make them completely Smart Home Automated.

Just search for "HomeKit" on the App Store. There's quite a few free or paid ones. I personally use the "Home" APP that has the same logo as HomeKit. It's a paid APP so it's entirely up to you what you want to use.

Then your done!