loading

I thought this was incredibly cool and decided to make an instructable so you could do it too.

The basic idea of this instructable is to ask siri to turn off your light or multiple lights at the same time.

The development environment is NodeJS (a 'flavour' of javascript), on an Intel Edison.

Since it uses NodeJS the server can be run from virtually any system, i decided to use the edison as it's already my base station for my home automation ( which includes web streaming, a pebble smartwatch app and An ios app (instructable coming soon))

NEEDED

  1. a computer, raspberry pi, intel edison, etc
  2. nodeJS 12.x
  3. Links to control home items or smart items.
  4. Minimal knowledge of the terminal environment

Notes

  • Works with local network only. An exception is a special forwarding that requires an apple TV.
  • Works with iDevices only.
  • Since Siri supports devices added through HomeKit, this means that with HomeBridge you can ask Siri to control devices that don't have any support for HomeKit at all. For instance, using the included shims, you can say things like:
  • Siri, unlock the front door. (Lockitron)
  • Siri, open the garage door. (LiftMaster MyQ)
  • Siri, turn on the Leaf. (Carwings)Siri, turn off the Speakers. (Sonos)
  • Siri, turn on the Dehumidifier. (WeMo)
  • Siri, turn on Away Mode. (Xfinity Home)
  • Siri, turn on the living room lights. (Wink, SmartThings, X10, Philips Hue)
  • Siri, set the movie scene. (Logitech Harmony)

Credit:

None of this will be possible without help from HAP-NodeJS by Khaos Tian & Homebridge by Nick Farina

If you enjoyed this instructable, please vote for me in the phone competition


Also if you like photography, check out my website

Step 1: Set Up Edison

Assuming you've set up your edison (latest image, and got it working at least) on to the next step, if not here are 2 links to help you do so.

Once that is done, configure your edison by going into the terminal and typing 'configure_edison' where you can select a name (advise: leave this blank and just use root instead, it's easier to remember), your password and connect to wifi.

Step 2:

Go ahead and download Winscp

in your home directory type

vi /etc/opkg/base-feeds.conf

You'll see a blank black screen where you'll copy and paste this inside

src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/all

src/gz core2-32 http://repo.opkg.net/edison/repo/all

Ensure the contents match exactly then press esc

type ':wq' to exit.

Step 3: Node >12.x

If you already have Node 12.x Skip this step, Vanilla Edison as of (8/17/15) for some reason is allergic to node 12 even as they continue releasing updates.

Installing Node 12 is easy, but takes a fair bit of time.

Here's the code to do that

wget https://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.... --no-check-certificate

tar xvf node-v0.12.7.tar.gz

cd node-v0.12.7

./configure

make

make install

NOTES

  • the 'make' command takes 2 hours. this is basically compiling the binaries you just downloaded or in other words, turning them into something the edison can truly understand.
  • if you want to see exactly how long it takes your edison, you can use 'time make' instead of 'make'
  • if a node 12.8 or 12.9 comes out, just switch out the numbers above.
  • confirm after all is done that your node version is indeed 12.x by typing node -v. the first time i compiled, my node version actually didn't change, a restart fixed that.
  • If all else fails, i've included my precompiled version (it may be faster to take this route. It definitely is faster to try this first) and use WinSCP to transfer it over. you MUST './configure, make install & make' in my experience, it'd take less than a minute to make and configure.
  • i've tried using n & nvm on 2 separate edisons to no avail. You can try your luck

Step 4:

Type these into the terminal (be patient as it downloads)

$ git clone https://github.com/nfarina/homebridge.git

$ cd homebridge

$ npm install

DONT FORGET: this program is incompatible with nodeJS < 12.x

$cd homebridge

$node app

if all is well, you should get this error:

Starting HomeBridge server...
Couldn't find a config.json file [snip]

This just means you haven't configured any links yet.

using WinSCP or any other program of your choice, navigate to homebridge and look at the config sample for 'inspiration'. i personally have it set up to control lights that i have set up links with express(NodeJS) & Arduino.

My personal homebridge folder is attached in case you have trouble setting up homebridge and getting to this point. Feel free to 'winscp' it over to your edison but remember you need to change the links.

if you don't have a brightness link, you should put a dummy link, In my experience, siri hates not being able to control brightness.

LINK

Setting up a server to listen and control things has been done time and time before, in fact one of the highest viewed instructable does just this.

off the top of my head a simple way to generate a link using NodeJS will be using the code below(assuming you have express)(if you don't, go into the terminal and type 'npm install express')

var express = require('express');
var app = express();

var mraa = require('mraa')

var LED = new mraa.Gpio(13); //13 is notoriously the pin number for the onboard LED(assuming arduino-board)

LED.dir(mraa.DIR_OUT); //LED.write(1) turns it on!!


/****Simple Server****/

app.get('/', function (req, res) {

res.send('Hello World!');

});

app.get('/on', function (req, res) {

res.send('LED on');

LED.write(1);


});

app.get('/off', function (req, res) {

res.send('LED off');

LED.write(0)

});


var server = app.listen(1111, function () {

var host = server.address().address;

var port = server.address().port;

console.log('Example app listening at http://%s:%s', host, port);

});

Thats It !

i can't remember the specifics for the edison, but you may have to keep constantly writing one to the LED for it to stay on (the default me be off). This however is just speculation.

Step 5: IOS Setup

NOTE: default password is 031-45-154

Refer to the pictures

  1. Download Insteon+. i found this to be the easiest and cleanest to set up with. You can experiment with others
  2. navigate to the app
  3. Click the plus button and add a device
  4. After a few seconds the scan should come up with whatever devices you added
  5. Add it using the password above
  6. Voila, ask it to control you lights
  7. 'Lamp' is NOT a good word. idk if it's my accent, but you'll almost always get 'turn on my alarm' everytime you actually say 'turn on my lamp'

Step 6: Finished

That's it.

If you enjoyed this, please Vote for me in the Seeed Phone competition!

This took me a few days to get working right, i've outlined my 'path to success' but you may still stumble into roadblocks (especially on the edison). Comment and let me know your problem (or message me) and i'll help in whatever way i can. Comments are preferred as they can help others too and can be answered by others.

Have fun bossing siri around.

<p>It looks to me like Apple broke this. I have had homebridge working for several months now without issue. Updated this week to iOS 9.3 and now nothing works. My iPhone still sees my homebridge Pi but none of the devices are seen anymore. I have tried resetting the iPhone, deleting and re-adding my iCloud account, nothing seems to work. So ticked off that Apple broke this.</p>
<p>Update your homebridge (npm -g update homebridge) and then all accessories should come back automatically, if they don't reset homekit config. If that also doesn't' work then change the address character in your json config file and relaunch homebridge.</p><p>(User name : CB:24:4E:E3:CE:11) Change any one of these, like 11 to 12.</p><p>But you defiantly have to update.</p>
Thanks, I tried the update and it didn't work so I ran the original install command and that worked. Everything is working again, thanks!
<p>to hard for me!!! hehe!</p>

About This Instructable

11,209views

45favorites

License:

More by oooseun:MyGarage DIY Get Siri to control your home How i took this picture and how you can too 
Add instructable to: