- AWShome — Home Automation Using RPi + Alexa + IoT
- Hardware components
- Software apps and online services
- Hand tools and fabrication machines
- Home Automation with Amazon Echo + HA Bridge
- Section 1 Install HA Bridge.
- Section 2 Adding Vera/Vera Edge/Fibaro HCL and Fibaro HC2 into HA Bridge
- Section 3 Add customize device/scene
- Section 4 Voice Assistant with Amazon Echo
- Share this:
- Like this:
- Related
- 20 Comments
AWShome — Home Automation Using RPi + Alexa + IoT
Easily and INEXPENSIVELY control a bunch of outlets using your voice!
Hardware components
Raspberry Pi 2 Model B |
A Raspberry Pi 3 or even a Raspberry Pi Zero will work too! |
433Mhz RF Transmitter and Receiver |
Available for as low as $1 on Amazon as well! |
Jumper wires (generic) |
Female-Female if you want to use them without a Breadboard |
Breadboard (generic) |
Optional, with Female-Female Jumpers you can wire directly to the Pi |
USB Microphone |
Only for Advanced Portion! Any USB or Bluetooth (with dongle) microphone works! |
3.5mm Speaker |
Only for Advanced Portion! Any 3.5mm or Bluetooth (with dongle) speaker works! |
SparkFun Pushbutton switch 12mm |
Only for Advanced Portion, and optional! |
LED (generic) |
Only for Advanced Portion, and optional! |
Resistor 330 ohm |
Only for Advanced Portion, and if using LEDs |
Software apps and online services
Amazon Alexa Alexa Skills Kit |
Amazon Web Services AWS Lambda |
Amazon Web Services AWS IoT |
Amazon Alexa Alexa Voice Service |
Only for Advanced Portion! |
Hand tools and fabrication machines
Soldering iron (generic) |
Optional. Only if you want to add an Antenna to increase the range. |
Most wireless outlets like Wink and SmartThings cost around $70, and then each additional outlet can cost another $50! Older remote control outlets, like this one from Etekcity, can be as cheap as $5 an outlet!
The problem is, they don’t have all those fancy voice and Wi-Fi features the new ones do, that’s what this tutorial is going to help you solve!
We’ll be using a Raspberry Pi (any model will do, but the pins might be different!), a 433 Mhz Transmitter/Receiver to communicate with the wireless outlets, and some Female-Female Wire Jumpers. You’ll also need an AWS account to setup the Alexa, IoT and Lambda portions. Altogether it should cost about $50 for everything!
There’s no hard language dependency, all of the libraries I use are basic and written in multiple languages. I normally write everything in Javascript, but this tutorial will be Python to better match other Raspberry Pi tutorials.
All IDs in this tutorial were deleted after completion, so don’t worry about everyone being able to see my authentication secrets!
Preparing the Raspberry Pi Operating System
We start with the Raspberry Pi’s operating system. Your Pi may have come with an SD card with the operating system already good-to-go, or you might have an SD card with NOOBS. Either of those will work, but you can also follow the official tutorials to prepare your own SD card. For the next step I’ll assume you have the operating system installed and your Pi booted up.
Connecting to the Pi
You can easily get started using a Keyboard/Mouse/Monitor, but you will be able to do everything using just SSH so all you really need is an Ethernet cable. Here’s a longer tutorial on how to do things using only an Ethernet cable and Adafruit has a tool , but on my Mac it was as simple as plugging one in and starting SSH in Terminal (default password is raspberry ):
Once you’re there we can begin installing our first dependency: pi-switch-python , which in turn has its own dependencies. Their page will have the most up-to-date instructions, but the main commands are below for convenience. Note libboost can take a LONG time, mine took half an hour!
From now on I won’t include the output of the commands, just the current directory, and the commands themselves (everything after the dollar sign)
The final installation step is the actual AWShome library, which just needs to be cloned:
Wiring up the Components
Both the schematic and the picture below use matching colors. I used a breadboard and a Pi Cobbler to make it easier to show, but they aren’t necessary if you use Female-Female jumpers.
Home Automation with Amazon Echo + HA Bridge
Hi guys, today my sharing is how to build an HA system with Amazon Echo, Google Home, HA Bridge and Raspberry Pi 3
Brief introduction
HA Bridge emulates Phillips Hue so that Google Home and Amazon Echo can be recognized any devices that are not yet supported by Google Home and Amazon Echo.
Google Home and Amazon Echo used as voice assistant to control devices created in HA Bridge and Home Assistant.
This sharing consists of 5 sections.
- Install HA Bridge
- Adding Vera/Vera Edge to HA Bridge
- Add customize device/scene
- Voice Assistant with Amazon Echo
- Voice Assistant with Google Home (No longer supported due to Google change the pairing method)
Section 1 Install HA Bridge.
- Before start, make sure to update Raspberry Pi to latest
- On your Raspberry Pi, navigate to /home/pi
- Make and habridge folder
- Change your folder and download ha-bridge jar files
- Create the systemd service file
- Copy and paste the following
- Save the file by hit CTRL-X, then hit Y and ENTER key.
- Install Java 8 SDK
and select the JDK 8 version (/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java).
Then run below to check Java 8 SDK is successfully install.
java version “1.8.0_65”
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)
http://you-habridge-ip
Here you go your first HA Bridge
Special Thanks
HA Bridge contribute by bwssytems (Github), and guide by BarryHampants
Section 2 Adding Vera/Vera Edge/Fibaro HCL and Fibaro HC2 into HA Bridge
- If you have Vera/Vera Edge/HCL or HC2, you can now add them into HA Bridge so that Google Home and Amazon Echo can control them.
- Click “Bridge Control” from HA Bridge tab
- Supply Name(can be any name), IP of your Vera and click “Add” button to add. For Fibaro HC2 or HCL, you just need to supply, IP, username, and password click “Add” button when done.
- Click “Save” button and the system will automatically reload the settings
- Click “Fibaro Devices”, you can see the list of available devices. Click “Build item” on any device you wish to add into voice assistant
- Click “Add Bridge Device” to confirm add
- You can now try turn on/off the device or scene you just add by clicking the “Test ON” or “Test Off” button
Section 3 Add customize device/scene
Let say I have other device can be trigger using HTTP request, I can create from “Add/Edit” tab
Name: Kitchen Light
On Items:
Type-> HTTP Device
Target Item: http://
Off Items:
Type-> HTTP Device
Target Item: http://
P/S: Once done click “Add” to confirm add “Off” action
Section 4 Voice Assistant with Amazon Echo
Share this:
Like this:
Related
20 Comments
You are welcome John, glad my sharing helped. ^^
I just Googled my question and found your answer was posted yesterday. It’s exactly what I was looking for. Thank you for your presentation.
Most welcome John.
I ran into the first problem. With the latest June 2017 Jessie, oracle-java8-jdk is already installed. However, “update-alternatives –config java” fails with the error message “update-alternatives: error: unknown argument `–config’”
Since I didn’t get that far, I hope that “select the JDK 8 version (/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java)” becomes clear when it appears. Right now, “java-version” gives all the expected results, as shown in your instructions. So, maybe Java 8 SDK is already installed correctly.
Thinking that Java 8 SDK might be installed correctly, I tried continuing, but the next problem is trying to run “systemctl start habridge.” I get the error “Failed to start habridge.service: Unit habridge.service failed to load: Invalid argument. See system logs and ‘systemctl status habridge.service’ for details.” I tried rebooting, but again it failed, trying it both as sudo and user.
Entering “systemctl status habridge.service” gives:
habridge.service – HA Bridge
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
And, of course, “dead” likely explains why http://you-habridge-ip can’t be found, unless I am so brain dead to not realize you mean the Rasperry Pi’s URL and port 80, (192.168.1.14:80) which also fails, due to being dead.
I used cut and paste for all the commands, so it’s not a matter of my usual misspellings.
Also, it is really OK to install everything using “sudo su?” I know that’s easier than typing sudo so much. But I am merely a user of Linux, and not an expert, and I’ve seen warnings in the past saying installing some programs, directories, files & folders as SU can cause problems when you try to use them as a regular user.
Thanks for any assistance you might be able to provide.
Hi John, have you run this command ?
sudo systemctl enable /home/pi/habridge/habridge.service
is okay not do sudo su, what you need to do is every command you run, in front type sudo. let me know if this help
I was able to install and start HA Bridge. But, as seems to always be the case, no one set of instructions gives a working version. Bits of each one I find are necessary to finally get it working.
I wondered about a referenced data file, which didn’t exist, and BarryHampants says we should create one. “sudo mkdir data” in the folder habridge. This is where the file habridge.config gets written to.
The bwssystems GitHub page is where I found most of the needed instructions.
It says to install ha-bridge-4.5.6 and we have already installed 4.3.1. Rather than installing another version (which I will probably do later anyhow), I stayed with 4.3.1, just to see if I could get anything working.
I followed all the instructions under “Automation on Linux Systems” other than downloading 4.5.6
In the “Basic script setup to run the bridge on a pi” section, I followed those instructions, other than changing 4.5.6 to 4.3.1, and everything worked. My HA-Bridge web page popped right up.
Minor: Your instructions include “sudo systemctl enable /home/pi/habridge/habridge.service” but, since we are already in su mode, sudo is not needed.
Minor: There is a typo in your instructions. “update-alternatives -config java” should be “update-alternatives –config java”. Barry also mentions that Java has to be installed only if it doesn’t already exist, and it exists on the latest June 2017 Jessie.
There is another error in your instructions. “http://you-habridge-ip” should be “http://[your-ip-address]:80” Also :80 is not needed, as that is the default port for web pages. The browsers I use just strip it out, and testing showed it isn’t necessary.
Thanks for your help so far, and now I will go through the rest of the instructions.
As the professor in my first Electrical Engineering class said, “If it doesn’t work the first time, you are indeed fortunate. That’s because now you will learn more about it than you could any other way.”
I see the system changed a typo. “dash-config java” should be “dash-dash-config java.”