top of page

Connecting Vera to Alexa with Hue-Hub Emulator


The first challenge facing most people looking to DIY their own IoT home solutions is "which wireless protocol will I use?" and subsequently "which hub system?". There are so many competing systems on the market from Zwave, Zigbee, Bluetooth, wifi, and other proprietary radio systems. Some home hub systems only support a few or a single radio, and so the entire purchase process can be intimidating.

For me, I was an early adopter of the Amazon Echo, and decided to build my connected home around voice control. As I live alone and in an apartment with no yard or garage it was important for me to choose a hub system which was reliable and had the greatest number of connected devices in its ecosystem; I chose to go with the Samsung Smartthings hub. This hub had the benefit of having one of the earliest native integrations with the Amazon Echo. However, Smartthings certainly has its downsides, the most prominent is that the user interface is TERRIBLE, challenging for even the most tech-saavy person to navigate.

My father, on the other hand, lives in a house with his wife which has a garage, a yard, two dogs, and three grown children that are always going in and out. For him, he was not initially interested in voice control, but being able to check on the dogs while at work, making sure no one forgot to close the garage doors, automating the outdoor spotlights, and ensuring the house was always locked at night. Additionally, he wanted a great user interface and customer service; he chose the Vera Mi Casa system.

After a year or so, and the Amazon Echo's, and voice-control's, prominent rise to the gold standard of smart home control, my dad decided that he wanted integration of voice control to his smart home. Unfortunately, Vera has still not moved to native integration with the Amazon Echo, and no plans have been rumored to be in the works. Several clever programmers such as Arm Suwarnaratana have figured out how to emulate the software of the hue lights hub, which DOES have native integration with Amazon Echo, and have used that to integrate the Vera hub devices. You can find his github here.

This post details the steps I took to integrate Vera with Amazon Echo's Alexa and create an easy-to-access smart home server implementing code written by Arm Suwarnaratana, and a no-longer-supported webpage tutorial by Aire Dalez (glad I saved his page to Evernote when I did!).

Needed Skills

- Basic understanding of Raspberry Pi

- Basic understanding of python (it's OK to be afraid of the terminal, I was too!)

- Basic computer know-how

Parts list and necessary code links

- Raspberry Pi 2 (with wifi) or 3 (with built-in wifi)

- 5V 1A Power Source for Raspberry Pi

- HDMI Monitor (for setup)

- Bluethooth/USB Keyboard/Mouse (for setup)

- 16 GB micro SD card Class 1 (with adapter if needed)

- Ethernet cable (if desired or wifi not available)

- Vera connected home system

- Amazon Echo/ Echo Dot

Step 1: Install Raspbian

Raspbian is the standard linux-based operating system of the Raspberry Pi. I will walk through the steps to install the OS and setup the PI briefly, but if you need more information there is a great tutorial on the Raspberry Pi website.

1. Connect the Raspberry Pi to the monitor, keyboard, and mouse. Do not yet power-up.

2. Go to the downloads page of the Raspberry Pi ad download the Raspbian .tor or .zip compressed file.

3. Extract the files to the micro SD card

4. Put the micro SD card in the Raspberry Pi, and plug in the power supply. Follow install instructions.

5. Connect the ethernet cable or setup wifi. If you need assistance you can find more information here.

6. Open the command line and enter the following commands to make sure your Pi software is all up to date.

sudo apt-get update

sudo apt-get dist-upgrade

7. If you are not in the UK, which is the default setting, navigate to the keyboard and mouse settings, and change the keyboard country to the United States > English (US).

8. Inevitability, you are going to want to access your server without all the do-dads (monitor, keyboard, mouse) attached. In the terminal be sure that SSH is enabled by going to...

sudo raspi-config

Under advanced settings, ensure that SSH is enabled (should be enabled by default, but always good to check!). You will need SSH software on your computer; as a Window's user I am partial to PuTTy, but you can go to the Raspberry Pi site on SSH and find other options. You can, from this point forward, access the Pi via SSH and disconnect the monitor (called headless), or continue with your monitor-pi setup.

Step 2. Install Docker

Docker is a method of packaging files systems. To be honest I am not super familiar with it, but you can find more information here if you're interested. Simply enter the following in the terminal:

sudo apt-get install docker.io

Step 3: Update Java Version

So this was a major thorn in my side when I was first setting this up. The version of Java that has been tested with this installation was version 8, but sometimes the default version is a previous one. First, check to see what version you are running. In the terminal, enter:

java -version

javac -version

If the versions are not both at least version 8, or are not the same version, you will need to do the following.

sudo apt-get install oracle-java8-jdk

then use the above commands to check the java version again. If they are not both updated...

sudo update-alternatives --config java

Then select the appropriate versions and check the versions again. The versions should be the same at this point. I found this ubuntu forum very helpful when I was stuck on this problem.

Step 4: Update Maven

Maven is a tool that helps with unpacking compressed files. It is an easy update and worth doing so you don't run into problems down the road.

sudo apt-get install maven

Step 5: Create a New Directory

We are going to create a new directory where we will install the Amazon-Echo-Bridge software. Again, we use the terminal.

mkdir habridge

You can use the file manager to create a new directory as well, but it is much less clumsy to use the terminal, so don't be afraid!

Step 6: Install Amazon-Echo-Bridge

Arm Suwanaratana, or armzilla as he is known on github, created a great piece of java software that emulates a Phillips Hue hub and allows you to add your Vera devices in a way that the Amazon Echo can integrate and recognize. This tutorial was built with version 0.2.1, but the newest version, 0.4.0 should also work just the same.

The link to the github repository can be found here.

I will admit, as this was one of my first Raspberry Pi projects and I downloaded the file using the UI. However, I would recommend using the wget terminal command.

wget https://github.com/armzilla/amazon-echo-ha-bridge/archive/v0.4.0.tar.gz

If you run into an error you can also try...

wget --no-check-certificate https://github.com/armzilla/amazon-echo-ha-bridge/archive/v0.4.0.tar.gz

If you want to cheat like I did you can follow these steps using the Graphical UI.

1. Navigate to the github repository for the Amazon-Echo-Bridge.

2. Click on the link to "releases".

3. Navigate to the version and right click to download (you will want the .tar.gz version, NOT .zip).

4. Go to the download location and cut and paste the file to the directory you made previously called "habridge".

Step 7: Run Amazon-Echo-HA Bridge

First, you need to know your Raspberry Pi's IP address. This is very simple, just navigate to the terminal and enter:

ifconfig

You should see the IP address, among other information, reported. Now we will run the bridge. Using the terminal again...

java -jar amazon-echo-bridge-0.1.3.jar –upnp.config.address=<your Pi IP Address

Step 8: Populating the Bridge with Devices

Ok! The hard parts are DONE! Now we are going to add devices to the bridge. You will need your vera web-app handy. Again, here is where I cheated a bit on the setup, but I am working to improve a set of directions that are completely headless. For now, if you want to go completely headless you will need to setup a VNC client, I use tightVNC. For more information about using tightVLC, see the makeusof.com tutorial by Christian Cawley.

From the browser, navigate to

http://<your Pi IP address>:8080/configurator.html

Give the website time to load, it can take up to 5 minutes.

Now you are ready to add devices. You will need to know your Vera's IP address which you can find in the app. Follow these steps to add devices in the appropriate fields.

1. Vera request port is by default 3480, unless you are an advanced user, do not change this.

2. Device ID - go into the Vera web-app > Devices > Open Device Settings > Advanced > use the number for "Id" as the Device ID.

3. Add a name for the device that Amazon's Alexa will call it, remember not to make super similar names such as "den" and "fan" to avoid confusion.

4. Click "Generate URL's".

5. Then click "Add Device".

6. Test ON/OFF to ensure you are not generating an error.

When you are done populating, or if you just want to test out if it is working after the first few additions, ask Alexa to discover new devices by asking "Alexa, discover new smart home devices" or navigating to the appropriate command in the Alexa App.

Step 9: Survive a Reboot

Now of course it would be a tragedy if you lost power to your device and you had to fire up the Amazon-Echo-Bridge every single time. To prevent that from happening, we will set the Raspberry Pi to run the program at boot. Back into the terminal...

nohup java -jar /home/pi/echobridge/amazon-echo-bridge-0.2.1.jar –upnp.config.address=<your Pi IP Address> /dev/null 2>&1

Remember to change the version number if you are using a newer version of the bridge than I did.

sudo reboot

Upon reboot, you can verify that your bridge is running via the command

ps –ef | grep java

And that's it! Now you have your home server up and running. You should be able to populate up to 25 devices using this bridge. You can run an additional bridge if you need more than 25 devices controlled by Alexa. Below I have some incomplete information for adding a second virtual bridge.

Step 10: Placing the Raspberry Pi into its Enclosure

Using a small screwdriver, place the Raspberry Pi into its new enclosure. I just wanted to make a note here for anyone else who uses the same enclosure that I did with the GPIO pin fan. When I hooked up the fan to the appropriate GPIO pins (instructions on the Amazon link), it changed the default display from HDMI to something else (presumably GPIO). Therefore, I would advice against connecting the fan until you are done setting up the Pi if you are using the GUI. Otherwise, you can always use a VNC connection to access the GUI once the fan is connected and the Pi is enclosed.

Next Steps

As I mentioned a couple times already, this was one of my first Raspberry Pi java projects, and as a result, there were a few things I did that were kind of sloppy. Going forward, these are the changes I would like to implement.

Add Photos

I do intend to add clear step-by-step photos when I re-do this project in the near future.

Clarification on Adding a Second Instance of Bridge

The directions I wrote above are simply the theoretical directions I gathered from an issues thread from the Amazon-Echo_bridge github site. I personally, had some success but do recall running into several issues I would prefer to document more clearly.

Create a Completely Headless Set of Instructions

Aside from the UI being a bit of a data hog, booting into the UI can create data safety concerns - no one wants their Pi becoming part of the next IoT botnet. I would like to recreate this process with a completely headless setup and ensure boot to terminal.

Create an Image File of Complete Raspberry Pi Bridge Micro SD

For those who don't really want or care for the challenge of setting up the server on the Pi, I would like to create a good, clean .IMG file of the entire micro SD card. I would then have a simple set of directions for changing the few details needed, like IP address,.

This bridge has been running flawlessly in my parent's home now for about six months. I would highly recommend this to anyone who is married to their Vera system and wants to play with the Amazon Echo! I welcome any and all comments and questions!

Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page