So, I had this crazy idea of using the Amazon echo to wake my computer. "Alexa, turn on desktop". I thought about it and it's pretty easy. You just need a few things:
An Amazon Echo (of course!)
Home Automation Bridge
This bridge allows you to send HTTP commands via voice commands on the Amazon Echo. It emulates a Phillips Hue so that the every device you set up on the bridge can be controlled via voice. A docker image of Home Automation Bridge is available at:
- A wake-on-lan binary that works to wake your computer up from the command line.
wakeonlan/wol/etherwake, all of these are good. There should be pre-built binaries for this all over the Internet.
- A web server running PHP
PHP has a function to execute shell commands. http://php.net/manual/en/function.exec.php
To put this all together:
Voice command --> Echo --> Home Automation Bridge --> PHP --> Shell Command
Let's start at the end. The shell command is basically the WOL command you would run from a command line. Usually, it's something like "wol xx:xx:xx:xx:xx:xx" where xx is the hardware address of the NIC.
The PHP that will execute the shell command will look something like this:
<?php error_reporting(E_ALL); exec('/usr/sbin/etherwake -b xx:xx:xx:xx:xx:xx'); ?>
In Home Automation Bridge, set up a new device manually and enter the info like this screenshot:
The "On URL" is basically the path to the php file with the shell exec command. HTTP verb is GET. That's all you need.
Finally, in the Alexa settings (http://alexa.amazon.com), got to Settings > Connected Home > Discover devices and the new device should be discovered. You can now say "Alexa, turn on the Desktop" and your PC should start up.
It doesn't have to just be WOL. Any shell command can be executed from the Echo using steps like these. In fact, I use the Echo to also open my garage (my garage is controlled via a Raspberry pi and uses PHP to manipulate a relay connected to the GPIO pins).
The Echo is truly a marvelous device and I've found it to be more reliable than the other voice control options out there.