Altsteon with X10

Hi all!

Sorry for my disappearance for a while. Working for a start-up company has its down sides. :wink:

Aaron has been asking me to add X10 support to Altsteon, and I agreed to do it if he would work on the LUA code. (I don’t own any X10 devices and have not worked with them in over a decade.) So, I just posted a new dev version to . (As usual, I don’t recommend using this for day-to-day work. I am aware that it has at least one memory related issue, which is why it is a dev version. :wink: – Also, I know people hate ads, but I put a couple on the Altsteon page in hopes that it will help me cover some of my costs. (Hosting, buying new Insteon devices when they come out, etc.)

Using the altsteon_cli, you can feed a simple command in to the daemon to run X10 scenes. However, from what I can tell, X10 is a little bit of a strange beast in how it signals. (I direct you to the Wikipedia page for more info.)

Basically, X10 commands appear to have two parts. The first command specifies which device to trigger, the second one tells it what to trigger. I wrapped these two types of commands in to a single Altsteon command, but you still need to send the command twice to get anything to happen.

So, if you want to turn on a light with device B2, you would use these commands :

plm send_x10 B 2 0 plm send_x10 B 0 3

You will note that there are three parameters to the command. However, the actual X10 command only uses two parameters. So, ether the 2nd or 3rd parameter MUST be 0. (Or you will get an error back.) Under the hood, the Insteon device is using a high bit in the command byte as the way to identify if it is a unit code or a command code. Rather than trying to explain how to use that, I figured I would just have two parameters, and require that one of them be a 0.

The details of the commands are as follows (this is in the documentation too) :

- plm send_x10 <A-P> <0-16> <0-16> -- Send an X10 command from the PLM.  <A-P> specifies the house code that you
			want to send to.  The first <0-16> is the unit code you want to send to.  The second <0-16>
			is the command you want to send.   You can *ONLY* have either the unit code or command code
			be a non-zero value.  If both are non-zero, you will get an error.

		Commands are :
			-- 0 - None
			-- 1 - All lights off
			-- 2 - Status = Off (Should never be used.)
			-- 3 - On
			-- 4 - Preset Dim
			-- 5 - All lights on
			-- 6 - Hail ACK
			-- 7 - Bright
			-- 8 - Status = On (Should never be used.)
			-- 9 - Extended Code
			-- 10 - Status Request
			-- 11 - Off
			-- 12 - Preset Dim
			-- 13 - All units off
			-- 14 - Hail request
			-- 15 - Dim
			-- 16 - Extended data (analog)

(Yes, there are two preset dim commands. I thought this was weird too until I found some documentation on X10 that indicated that the Dim command is represented by 3 bits, the last of which is a “don’t care”, which means two values will trigger it. It doesn’t matter which one you choose to use.) Please don’t ask me what each of the commands does. The information I have here is culled from the Insteon documentation, which doesn’t tend to be very verbose.

The response code you will get when an X10 command comes in is 0032, followed by the hop count, house code, unit code, and command code. Like the commands above, the response code will be 0 for either the unit code or command code. At least two responses need to be heard to form a complete response. (The first one should have the unit code populated, the second should have the command code populated.)

Like the command, the house code in the response will be a letter. However, the value will be a hex value for the letter in ASCII. (So, A=41, B=42, … J=4A, etc.)

Please feel free to report bugs, but keep in mind that I have no X10 devices so the assistance I can provide will be minimal.

does the code support X10 RF receivers like CM19A (USB)?

Nope. The code only allows an Insteon PLM to send and receive X10 commands. I believe that the PLM does not speak X10 over RF either, so you would need a bridge. If you want to use something like the CM19A, you probably need to look at something like the MOCHAD plugin.