News about HomeKit and Vera

If you’re interested in HomeKit and being able to control your Vera with Siri, please read on.

I successfully “hacked” together a way to control my Vera using Siri and HomeKit.

I’ll start by getting this overwhelming excitement out before going into the technical details and what it means for you…

“Turn on my outdoor lights”
“Dim my outdoor lights to 20%”
“Lock my front door”

I actually got it working, and I’m just totally blown away at how incredible it is to control things using Siri. In fact, I can see myself walking up to my front door and using an Apple watch to tell Siri “Unlock my front door” and have it unlock within seconds. I now have a reason to get an Apple watch, just for this ability alone. You’re laying on the couch and ready to watch a movie… lift up your arm and speak into your apple watch… “Dim the lights to 10%”. Woah, incredible. Up until now, I’ve been using an app to control things and you need to open an app, wait for a connection, go to the right screen, then tap on a light to control it. On my best days i can do that in 5 seconds, normally, 10-15 seconds. With Siri… 3 seconds.

Moving on to where HomeKit and Vera currently stand…

The crappy news is that you probably won’t see Vera including HomeKit anytime soon, if ever. Looks like Apple wants HomeKit enabled things like light switches, light bulbs, locks, etc… to have built in wifi or bluetooth so they can communicate directly with your iPhone on the same WiFi network, or if you’re not on the same network, an Apple tv will act as a bridge between your devices and your iPhone while your away from your house. Not only that, each HomeKit enabled product needs to be certified by Apple.

Apple said that devices that don’t support HomeKit can take advantage of HomeKit by using a bridge. Unfortunately it looks like the only devices that are allowed to be “bridged” are devices that report things like a motion detector, or a temperature sensor. You cannot bridge devices that control things like a lock, or a light switch, or a thermostat. LAME! Vera cannot legally get around this, because Apple wont certify them, and if Vera were to circumvent Apple and implement HomeKit on their own, they would likely get sued.

Why would they get sued, and how can you circumvent Apple to get Vera to work with HomeKit?

Bear with me as i’m still learning the details of how this all works. Basically Apple has created the HomeKit Accessory Protocol. This protocol is how all HomeKit devices, bridges, and your iPhone communicate with each other. The only way to get the documentation on how this protocol works is to pay a fee to apple, sign an NDA, and join the MFI (Made for iPhone?) program. If you try to reverse engineer the protocol, my understanding is that you would be breaking the law, specifically the DMCA. If someone reverse engineers the protocol, and writes a program that uses the protocol, is that illegal? That i don’t know. So if Vera implements the HomeKit Accessory Protocol because they reverse engineered it, i think Apple would shut that down real quick.

How did you get Vera to work with HomeKit?

Ok so this is probably what you want to know. Some smart people reverse engineered the protocol and wrote some code to simulate HomeKit devices. Heres the project I found and got working [url=https://github.com/nfarina/homebridge]https://github.com/nfarina/homebridge[/url]

Basically you run this code on your computer while on the same network as your iphone. The code then allows you to simulate HomeKit devices, so that your iPhone will see them and allow you to control them. When you try to control one of these devices, the code gets notified that for instance, you want to turn on your bathroom light. From there, the code can take over and do anything you want.

What i was able to do is write some code that when a command comes into to control a light, i then send a command off to Vera to actually control the light. Its totally hacked together, but it works and proves that the ability to control your entire home using Siri and Vera is technically possible.

What does this mean for the Vera community

I’m writing this post because i just figured all this out and got a hacked together prototype working. I’m going to refine it so that everyone else can easily use it, no matter what your skill level is. I think i can make it so simple, it will take you under 2 minutes to get running. So follow this post and ill keep you updated over the weekend.

Heres my video demonstrating using HomeKit and Vera

That would be wonderful. Thanks @Albeebe !

Should this become a plugin?
Great!

Awesome work! Nice to see people are working hard to reverse engineer the protocol. Apple need to be slapped around hard for their vision on home automation: the insistence on proprietary, licensed, closed protocols has the potential to set the state of the art back half a decade.

Reading through some reports on the restrictions that Apple may place on HomeKit bridges, it seems to me that those restrictions are not as severe as all that. The restricitons seem to be:

  1. No locks
  2. Any device that is capable of communicating directly through Homekit must do so, i.e. all WiFi and Bluetooth devices.

Also, there is work being done on “official” HomeKit bridges, such as this one: http://z-wavealliance.org/first-z-wave-to-apple-homekit-bridge-demonstrated/

I don’t know if zwave.me is making an official bridge, or just hacking something together. I would think they are just hacking it together.

My mind is really just blown away today as I’ve been processing all this homekit stuff and what it means.

I downloaded a homekit app and there was that light in my hallway that I was able to expose to homekit. That really blew me away. I used an app unrelated to Vera to control a light using Vera! Think about that… It means that Vera could just become a dumb box that exposes your devices to HomeKit and you could use an app that has nothing to do with any particular controller.

Someone’s going to come along and make a slick app to control your home and it will work with Vera, SmartThings, HomeSeer etc…

That’s just crazy yet so incredible.

As for Apple being restrictive and not completely opening it up, I can kind of feel why there may be a necessary reason for it but I’m just to new to all this to have all the facts.

Sent from my iPhone using Tapatalk

Amazing! Would you mind posting your code?

I honestly just hacked the code together and I was surprised it worked. I’m trying to find time this weekend to package it up so you can try it out. Stay tuned.

Sent from my iPhone using Tapatalk

[quote=“Albeebe, post:6, topic:186853”]I downloaded a homekit app and there was that light in my hallway that I was able to expose to homekit. That really blew me away. I used an app unrelated to Vera to control a light using Vera! Think about that… It means that Vera could just become a dumb box that exposes your devices to HomeKit and you could use an app that has nothing to do with any particular controller.[/quote]Perhaps I lack vision, but I’m not understanding your direction or gaol. The idea of Vera, to me, is to have a smart box that automatically controls devices of various makes and technologies. Vera does that to a very large extent right now.

With Vera, the light can be automated, completely. It can also be controlled by an app, if you really want to. It can also be controlled by voice, if Apple chooses to allow you to, which so far they seem not to.

I presume that you are aware of the fact that you can control any device under Vera by simply sending a HTTP GET request to Vera. Are you also aware that Vera can itself send HTTP requests to other devices, like WiFi devices and Bluetooth/Zigbee gateways to control other devices? Already, Vera is vastly more flexible than Homekit and can already control FAR more non-Z-Wave devices than Homekit can.

So, my question is; why would I or anyone want to turn my far more open and far more extensible home automation controller into a dumb box, that is then controlled(manually) by Homekit, or any smartphone app? My goal is automation while yours seems to be, as stated so far, iPhone as a hand held remote control.

This doesn’t preclude other automation- but rather allows manual intervention via Siri. Same as using an app. I have schedules for all my devices but regularly override them via an app. Doing this via Siri would be awesome.

If I were an android user, I’d be using tasker and various plugins to make be his happen. No difference.

Really looking forward to this

@boojew - I agree with what you stated. Homekit supports Vera, then a Homekit app could be used as any other Vera app. However, this is contrary to @Albeebe who said:

He’s talking about using Vera as an unintelligent gateway to Z-Wave devices and using a Homekit iPhone app for control and intelligence. His description, sounds, to me, like reinventing the wheel.

I guess what I meant was instead of relying on Vera (the company) to build a better UI or a better app or relying on 3rd party developers that have a Vera to build better Vera apps or cool things for people to use… With homekit (at least for us iOS users) you have the potential for a developer that has for example a SmartThings hub or a wink hub to build some awesome tools or apps that can be used by people that have a Vera or a Homeseer hub.

I think what’s possible here is that you could take all your scenes and logic out of Vera and instead put it into a homekit app.

Just to clarify my view on home automation, I have sensors and scenes and logic that automated everything without me having to do anything. However there’s times when I’m in bed and I want to adjust the fan or I’m on the couch and want to dim the lights. Being able to tell Siri, turn the fan to 50% is so simple and easy vs using an app or getting up and going to a switch.

Sent from my iPhone using Tapatalk

I mean no disrespect to the Vera community and everything that people have contributed to making it an awesome system. Lots of crazy ideas are running through my head and I’m seeing glimpses of what could be possible but it’s to early to connect the dots. I’m just thinking out loud :slight_smile:

Sent from my iPhone using Tapatalk

I don’t think anyone is taking any offense to anything and, if they are, well $%^ 'em. Keep right on posting your views.

I view home automation differently than you seem to. Especially when you say things like [quote=“Albeebe, post:12, topic:186853”]I think what’s possible here is that you could take all your scenes and logic out of Vera and instead put it into a homekit app.[/quote] Which is exactly the opposite of what I want and seemingly counter to home automation.

For me, Vera or any HA controller is the master and where the “brains”(scenes and logic) should reside. I think that the phone apps should send commands to the central controller, but the system should not be dependent on the smartphone in any what whatsoever.

If the logic is in the Homekit app, on your iPhone, and you lose the phone on a bus or drop it in water, what happens to your home automation? If the logic stays on a fixed controller in the house, phones can come and go, so can internet connections, but the house continues to function as it should.

I get that what you really want is to have the ability to tell Siri to do your bidding and I suppose that you now have that. But, moving the logic and control into a smartphone app doesn’t make sense to me, though it would be great for Apple.

There are good reasons for having both. There are home-bound scenes, like managing the heating, turning lights on and off when on holiday, and so on. The stuff that makes your home a smart home. These scenes necessarily run on your hub (vera) and not your smart phone: they need to work when you and you smart phone are away from home, but the wife & kids aren’t.

But there are personal scenes as well. You have one to set the lights to movie mode. The kids have one for game mode. And your “get together with friends in the living room” scene may well differ from your wife’s. That is where I see a role for scenes run from HomeKit instead of from the hub. Currently this is where Homekit is positioned, and it’s a subset of the whole smart home architecture.

When it comes to integrating different home automation technologies, in my view that must take place at the hub, or in a “hub of hubs” (as OpenHAB calls itself). If not, hub centric scenes will not be possible. Perhaps we will see a Homekit based hub running on Apple Tv. But until then, there is still a role for Vera to handle the intellgent part of home automation. Someone mentioned a plugin for Vera to expose all devices attached to Vera to HomeKit. Architecturally, that is what needs to happen. If Apple disallows that, then they have missed the boat in my opinion.

Ok heres the code to try HomeKit with your Vera!

[url=https://www.dropbox.com/s/6cfd1q4cwy8ssof/homekit.zip?dl=0]Dropbox - homekit.zip - Simplify your life

You’ll need to install NodeJS on your machine, and it must be on the same network as your Vera

  1. Unzip the file
  2. Edit the app.js file and enter the IP address of your Vera on line 11
  3. Go to the command line and cd into the directory that contains the unzipped files
  4. Type: npm run start

This should run the homekit bridge, connect to your vera, and expose any lights, dimmable lights, and locks to HomeKit.

Next you need to download an app that lets you manage HomeKit devices. I found an app called MyTouchHome in the app store for $1.99 that lets you add HomeKit devices on your network to your “home” that you create in the app. Once you create a “home” you need to tap on the “+ Accessory” button. If everythings working, all your Vera devices will show up in the list.

Tap on a device and you’ll be prompted to enter a password. The password is ALWAYS going to be 03145154

notes

  1. HomeKit only allows devices that have a unique name. If you have a bunch of lights called “ceiling light” only one of the lights will show up in the list.
  2. Siri is a bit finicky so you might have to experiment by saying “TURN OFF CEILING LIGHT” or “TURN CEILING LIGHT OFF”. If you create a room using HomeKit and add the device to a room try saying “TURN THE BATHROOM CEILING LIGHT OFF”. You have to play around with it.
  3. I didn’t test unlocking/locking doors but it should work. However i think you need to say things like “TURN ON THE FRONT DOOR LOCK” or “TURN OFF THE FRONT DOOR LOCK” instead of saying unlock the front door.

Good luck, let me know if it works for you. What I made is just a very super early alpha version so no guarantees.

Hi,

I cant get it working, there is a debug log:

0 info it worked if it ends with ok
1 verbose cli [ ‘node’, ‘/usr/local/bin/npm’, ‘run’, ‘start’ ]
2 info using npm@2.7.4
3 info using node@v0.12.2
4 verbose run-script [ ‘prestart’, ‘start’, ‘poststart’ ]
5 info prestart VeraHomeKitBridge@0.0.0
6 info start VeraHomeKitBridge@0.0.0
7 verbose unsafe-perm in lifecycle true
8 info VeraHomeKitBridge@0.0.0 Failed to exec start script
9 verbose stack Error: VeraHomeKitBridge@0.0.0 start: node app.js
9 verbose stack Exit status 1
9 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:14:12)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid VeraHomeKitBridge@0.0.0
11 verbose cwd /Users/**********/Desktop/homekit
12 error Darwin 14.3.0
13 error argv “node” “/usr/local/bin/npm” “run” “start”
14 error node v0.12.2
15 error npm v2.7.4
16 error code ELIFECYCLE
17 error VeraHomeKitBridge@0.0.0 start: node app.js
17 error Exit status 1
18 error Failed at the VeraHomeKitBridge@0.0.0 start script ‘node app.js’.
18 error This is most likely a problem with the VeraHomeKitBridge package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node app.js
18 error You can get their info via:
18 error npm owner ls VeraHomeKitBridge
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

I?m using osx yosemite with latest nodejs installed from http://nodejs.org/ .

Got the same error running on a Raspberry Pi 2

Try this… Following the instructions to install HomeBridge at GitHub - homebridge/homebridge: HomeKit support for the impatient.

If you can get that installed and running, copy and paste the contents of my zip file into the homebridge directory and replace any file that it says exists.

Then try running it again and hopefully it works. Basically what I did was modify the HomeBridge code I found on GitHub so that it works with Vera

Sent from my iPhone using Tapatalk

can VERA runs node.js, can we use VERA itself as the bridge ?