Control Practically Anything with Alexa

Control Practically Anything with Alexa

Alexa is great. I'm not talking about the silly stuff you see on TV or strange skills available from Amazon. I'm talking about it's simple ability to control things in your home. Physical things.

Now, there are plenty of skills out there developed or being developed to control various things. The problem is finding the skills you want out there or having a device that simply will never be supported. This is where my favorite piece of software comes in: ha-bridge

ha-bridge is a Philips Hue Emulator. Basically, it fools your Echo device into thinking that you have a Philips Hue Hub. Echo devices usually control lights through this hub with commands like on, off, and intensity (dimmer). With the emulator software, you can bridge any other non-Philips Hue system that is controlled via http/tcp/ssh/script over your home network. This means you can immediately control things without needing a specific skill.

I use it extensively in my home to control:

Homegenie is what I use to control almost all my lights. I will probably write another blog post about it, but in a nutshell, I can send http commands to the homegenie API to control various things. Alexa -- > ha-bridge --> homegenie It works beautifully.

  • My garage

I control my garage through the Raspberry pi signaling a 5v relay. With ha-bridge, I can send a remote SSH command that open/close the garage. The speech used with Alexa is a little weird, but I basically say "activate garage door" and it will open/close. Saying open garage door or close garage door used to work, but since "real" skills were created to do this - Alexa gets confused.

  • Turning on my Arcade Machines

I have 3 MAME powered arcade machines at home. 2 powered by Windows and 1 Raspberry pi powered machine. I can use a wake-on-LAN (WOL) command to turn on the Windows machines. For the Raspberry pi machine, I use a 120v switch over the home automation network (I use Z-wave plus homegenie). To turn off the machines, I can use SSH to send a command to the Raspberry pi. For the Windows machines, I can use something like EventGhost. EventGhost allows you to set up a HTTP endpoint that can command your Windows machine to do almost anything - including shutdown. Another neat feature of ha-bridge is the intensity/dimmer command. Since you can say something like "dim lights to 50%", you can use ha-bridge to send a type of intensity command. This works well with the arcade machines as I can set their volumes using Alexa with a command like "Set blue arcade to 80%". I should probably do another blog post soon about the details on this. :)

  • Controlling my August Door Lock

Oh wow, another thing I need to blog about. Some time back, I got a great deal on a first generation August smart lock. These locks allow you to lock/unlock your door via bluetooth through an app on your phone. They also sell a wi-fi/bluetooth bridge that allows you control the lock without your phone being in bluetooth distance of the lock. I was able to make a raspberry pi bridge myself so that the lock woudln't need to communicate with August's servers in the cloud. I'll blog more details later, but the code is available here: https://github.com/leonowski/August

The only strange thing about using Alexa to control this lock is the wording. Just like my garage, you can't just say "lock" or "unlock" the door. I have to say the words "turn on the lock" or "turn off the lock" to represent locking and unlocking respectively. It can be awkward, but I say it's a security feature and not a bug. Only I would know what words to say (oh, and I guess anyone who reads this now) :p

I really can't stop gushing about ha-bridge. It really is the bees knees.

Getting Up and Running

It is a fairly simple process to get the ha-bridge server running. The only requisite is Java. Simply download the latest release from the github page and run the jar file from a CLI:

java -jar ha-bridge-5.1.0.jar

This should run the server using the default port 80. Then, visit the server at http://hostname. The interface looks like this:

2018-01-29-16_39_15-Clipboard

Click on Add/Edit to add a Device. You should get a new page where you can enter device details. Fill in the basics first.

2018-01-29-16_40_08-HA-Bridge

Then, go to the On/Dim/Off Items section.

2018-01-29-16_40_20-HA-Bridge

In the Type dropdown, you can choose from many different actions. In this example, we will fill in an HTTP device. This is where the power lies. You can run a shell script if you wanted, a raw TCP message, or even a MQTT message.

2018-01-29-16_41_25-

2018-01-29-16_41_54-HA-Bridge

I recommend a read of the documentation on the main page for all the options available.

Finally, when you're done and you save it, it should return you to the main page. At this point, you can immediately test the bridge by hitting the on/off buttons.

2018-01-29-16_42_07-HA-Bridge

Once the bridge is running, it's a simple matter of visiting https://alexa.amazon.com with your Amazon account, visiting the "Smart Home" section, clicking on "Devices", and telling Alexa to "Discover" your devices. It should discover every single device you entered into the bridge (along with any other "real" discoverable devices that the Echo supports).

2018-01-29-16_49_40-Amazon-Alexa

If you need any help, feel free to comment below.