Using Asterisk and X10


I was wondering if it is possable to control X10 devices with Asterisk. Someone I know has his weekend house with an X10 controlable termostat so he can call in and turn the heat up or down. But it beeps after a few rings and would like to replace it. So I would like to have Asterisk go into voicemail and if he dials a certain number it will alow him to control the X10 termostat. I have a serial X10 ActiveHome interface that I would like to use if possable. Thanks,


sure. Just load your favorite x10 package on the system that will be controlling it (or use AGI scripts to do it remote) and go for it. Here’s a generic example using the heyu package:

exten => _980X,1,System(/usr/local/bin/heyu turn e${EXTEN:3:3} off)
exten => _980X,n,Hangup
exten => _981X,1,System(/usr/local/bin/heyu turn e${EXTEN:3:3} on)
exten => _981X,n,Hangup

in this example, you could turn on/off unit 1-9 on house code e by dialing the respecitve calls. Of course you can get as elaborate or simple as you want including reading back info, etc. In this example it is done direct in the dialplan, you can easily drop into an AGI script and do things also.



If you want to use your existing serial X10 ActiveHome interface, I would recommend writing a Linux daemon in C that would communicate with the X10 interface directly.
Here is the protocol for the interface.
Asterisk could then communicate to the daemon using several methods, such as opening up a Ethernet port.

However, if you had an additional standalone x10 embedded serial controller with a simpler serial interface, you could send it simple text commands via AGI directly from PHP, or as p_lindheimer suggested from a Linux script or program.

PHP Example:

mode com1: BAUD=9600 PARITY=N data=8 stop=1 xon=off`;
$fp = fopen (“COM1:”, “w+”);
fputs (”ON A1 F12” );
fclose ($fp);


hmm - it might be an interesting exercise to write your own, but there are several already written that can both write to and read the X10 controllers like the CM11A (or what ever the number is) as well as the newer usb controllers. So unless you can’t get what you want, it sure seems overkill to write it from scratch



Got any links for those several open source projects that are already written??


sure :smiley:

(if I had the link handy, I’d put it here but I don’t. I used one called heyu, it was pretty straight forward. I was using a CM11A when experimenting.



Well, it wasn’t too hard to find, it’s

Actually, heyu doesn’t look too bad, assuming you’re using compatible hardware. From the documentation it looks like the heyu State Engine (optional process) receives and maintains the states of all the modules (On, off,dim level) on the line, independent of any commands you would issue from Asterisk.
It appears they have their own forum,

Hey, I was wondering, how did you handled dimming?
It would be nice to be able to dim for long as you held a key down.


I just played around with it a bit and set it up so that I could turn on and off lights while I was away. (with either cron jobs or by phone - to freek out the house sitter…)

I’m not sure you could or would want to have it keep dimming while holding down the dtmf keys, especially given how many phones simply emit a short dtmf regardless of holding it down, or plenty of ip phones which will simply send one event. But you could easily have it send incremental dims up or down with repeated key presses, or even input a number for 00 to 99 for percent, or what ever else you choose to do. My simple example was very hard coded, you can get a lot more elaborate if you want to have fun as well as burn a bunch of time getting fancy…