Control X-10 switch with Luup code via Altsteon

@dlarrick - Thanks for the offer! I just hit send on the e-mail. Let me know if you didn’t get it.

@scravott - In addition to the link Garrett provided, the code of interest is in PlmInterface.cpp. If @dlarrick is correct and the commands are being sent too fast, or if another command getting in the middle is an issue the solution may be non-trivial. However, I am going to take @dlarrick up on his offer so once I have some hardware I should be able to get things working. (I’ll go so far as to add the necessary LUA code as well and make the X-10 support a “first class citizen”.)

A quick follow up on this. Thanks to dlarrick, I have a couple of X-10 devices now. (Thanks dlarrick!!) So, I’ll be working on getting them going over the next week or so along with the necessary XML to make the devices show up in the Vera dashboard.

Okay, that was a bit faster than I expected. The latest dev build that is now available on the Altsteon site seems to support basic X-10 stuff. I was able to turn on/off a small light using a Radio Shack lamp module. (dlarrick sent me a Magnavox module as well, which I will test in a bit. I just wanted to get this out so others could start to experiment.)

So, I believe that people that are controlling a remote device should have that functionality available. I believe there will be a little bit of work needed to get devices that expect the PLM to read state events, such as motion detectors. But, we are getting close.

Please post here and let me know if it worked for you.

I was able to turn on my pool light via x10 with the following command plm send_x10 A 1 3(on). I was unable to turn it off with plm send_x10 A 1 11(off), but I was able to turn it off with plm send_x10 A 1 1(All lights off). Maybe it is a device specific issue but at least I am getting a response and can control my light switch. We are making good progress. Thank you. I sent all the commands from the client and haven’t tried a Vera scene yet. May try that tonight.

Let me know if this intermittent behavior continues, and if possible grab a log when it happens. What you would be looking for specifically is sending the command, you will see a “PLM command success” message from the first command, then you should see the same thing after the second. If you don’t see the same thing after the second command, then we probably need to crank the timer up a little bit to compensate. If you do see the message, but the device doesn’t respond, then it is probably getting lost on the wire.

Once I had a device I did some more digging about the timing issues that were suggested. According to Wikipedia, X-10 sends data at about 20 bits per second. In order for it to recognize a new command, you have to wait for 6 0 bits to be transmitted. In theory, this means you have to wait ~1/3 of a second after sending the first message before sending the next. Unless the 0 bits are sent twice like normal X-10 commands, in which case you would need to wait ~2/3 of a second. While testing, I was getting intermittent results when using those values, so I set it to 1 second, which should be a bit more than 1/3 of a second longer that it needs in theory. However, it wouldn’t surprise me in the least to find out that the sleep() function isn’t very accurate, and may end up waiting less than a second.

That said, I don’t want to turn up the timer any more than we absolutely have to. In a perfect world, the event loop in Altsteon would have a timer component that we could use for delayed commands. However, that doesn’t exist. So, we actually sleep once we see the ACK from the first command. During this time, Altsteon doesn’t process anything else, including poll timers. So, each X-10 command will introduce 1 second of drift to the poll timers. Generally, this isn’t a problem as a few seconds of drift one way or another doesn’t make much of a difference. But, I would prefer to minimize the drift as much as possible. At some point in the future, I’ll probably introduce some timer based queuing, because it would make some things work better. But, for now, this was the quick and easy way to get X-10 working. :wink:

Also, FWIW, I have the initial work in place to have an X-10 switch show up in a “tile” in the Vera UI. I have not had a chance to find an outlet that is on the same phase as the PLM hooked to my Vera, so I have been unable to test it. I hope to find some time to do some quick testing soon and then push it in to the Altsteon distribution. I’ll let folks know once I get it tested and push it out.

I have to apologize. I made a mistake on the last post. It must have been late at night. I retested everything and I was able to successfully turn my X-10 light on and off with the proper commands. I would Love to see the UI tile when it ready. On thing that sucks is that my X-10 switch controls a pool light and when my pool pump is on, which I just installed, it doesn’t work. That’s the disadvantage of X-10. Quick question. If there is an Insteon device support request how would we arrange that. Thanks so much for the time and effort.

[quote=“scravott, post:26, topic:175792”]If there is an Insteon device support request how would we arrange that. Thanks so much for the time and effort.[/quote]I’d suggest you create a new topic in the Insteon sub-forum, unless there is another topic for the device started already.

Now that we have at least basic X-10 functionality does anyone know how to pass the code from the Vera UI to the daemon. The commands work fine in the Altsteon client but I cannot figure out the LUUP code to use in a scene to turn an X-10 switch on. FBA suggested: plmSend(“debug tag”, “plm send_x10 A 1 3”) earlier in the thread but it doesn’t work. Any ideas?

Sorry for coming into the conversation a little late, but I just got a PLM, quickly discovered how limited the built-in x10 support was, and just a week later I’m getting altsteon set up.

I installed v.08, and the daemon is up and running on the Vera, but in my brief testing x10 commands aren’t working. Even though v.08 came out in July, I’m suspecting the changes referred to in this thread didn’t get rolled into it. After installing the latest dev version (from 10/20/2013), I’m at least able to turn a light on and off, so many thanks to fba (and those that helped him troubleshoot/test).

Now, of course, I’m wondering about scravott’s last question about how to make this work from my Vera3, particularly with scenes?

Also, I’m curious if anyone has tested the Altseon x10 functionality in conjunction with heyu (which is what I’ve been using to manage my x10 stuff)? In particular, my impression is that the PLM simply doesn’t know what to do with (or maybe doesn’t even really listen for) “incoming” x10 signals, so I’m curious to see whether heyu could act as a “bridge” to detect events (like motion sensors) and send corresponding information to the altsteon daemon.

Hi All,
Spent the last couple weeks reading the forums to get up to speed on my new Veralite. Installed Altsteon and now have all my Insteon (except for some V1) and Z Wave devices working the way I want. The only missing link now is integrating some of my old X10 devices. So, not seeing a reply to the posts above, I was wondering if anyone could provide a sample of LUUP code to turn on and off an X10 device.

Thanks in advance for any help. And also thanks to the guys who made this plugin for their great work!

Unfortunately I’m at a loss for what the proper Luup code would be. I can verify that you can control an X-10 device form the altsteon_cli command line. Its just a matter of passing the commands via luup to altsteon. I have been unsuccessful and fba has been MIA for awhile.

Thanks for your reply. Yep, I’ve tried using some other sample LUUP strings as a guide but still couldn’t get any joy. In the meantime, I’ve tried using Mochad on a RPi, and so far it seems to be the best solution I’ve found to incorporate my X10 stuff. I’m using a CM19a (wireless only; readily available) while I continue to search online for a reasonably priced CM15a. But so far I’m impressed with the response and feedback in the Vera GUI.

Still would really like to see an example of LUUP code for controlling X10…