May 1, 2016

Amazon echo for home automation using x10 and

The way this works currently is you need to be able to access a remote url inside your home.  Usually this will require the use of a dynamic dos host provider that can provide you with a hostname that points to your dynamic home address that is updated automatically by your router.  This is not exactly ideal security wise but obscure enough that you’re not likely to have some hacker turning your lights on and off just to mess with you and about the worst case scenario is they turn all your lights on while you are way turning up your electric bill.

That said here is what you need the firecracker CM17A module from x10 and modules to control.  We start by creating a web server on a local linux box with the CM17A plugged in.  You can create a virtual machine too and assign the local com port to the virtual machine.  This is the setup I have on a 5018A-FTN4 running esxi and pfsenseI installed along side it ubuntu.  I added the com port to the VM and used app-get to install bottlerocket.

Once that was setup I used the following command to test control.

br -x /dev/ttyS0 M1 ON

br -x /dev/ttyS0 M1 OFF

This toggled the module on and off again.

Next I modified permissions on /dev/ttyS0 to read write for user group and world.

chmod +666 /dev/ttyS0

Now we need a script to control the app.  Created a quick script in /var/www/html/x10control.php



                <title>x10 Home Control Page</title>




$areas=[“office”=>[“M1”, “M4”]];






    foreach($areas[$location] as $module){

        array_push($modules, $module);



    array_push($modules, $device);


$cmd=‘br -x /dev/ttyS0 ‘.implode(‘,’, $modules).‘ ‘.$_GET[‘mode’];

echo exec(escapeshellcmd($cmd));




Modify the areas array to match your layout and you can even create another key level to define the name of each device you wish to control.

Now we can test calling from the command line.

curl http://localhost/x10control.php?location=office&device=ALL&mode=OFF

curl http://localhost/x10control.php?location=office&device=ALL&mode=ON

If this works as expected M1 and M4 both turn off and on.

Now to to create our trigger.

Go to My Recipes and Create a Recipe on the next place click this and then the Amazon Alexa Channel.  You should have to link your echo at this point.  Once linked Click Say a specific phrase.


From here we want to create a trigger of what to say to kick off our ifttt.


Next click that and we want to select our Action Channel.  In the search box type maker and we want to sleep the Maker Action Channel.

Maker Action Channel

We want it to make a web request.

Web Request Action

Here we will enter our external address to access our PHP script.

Complete Action Fields

Lastly we create our Recipe

Create Recipe

Once created we can repeat with he phrase all office lights off and change the url mode argument from ON to OFF and you can now with voice control your x10 items with your amazon echo.

Leave a comment

You must be logged in to post a comment.