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.
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.