When sending multiple X10 commands, does the X10 library buffer these or should a delay be implemented as not to over run the X10 modem?
I'm using the following in my application that specifies a house code ("C") and the unit number (1), and then the action (turn ON). I'm also tracking the state of the module with a flag such that I don't repeat sending X10 command every loop through the program.
// X10 Code
// Bathroom Heater Control, House code C, appliance module 1
// Turn heater ON at 5 AM if it's already OFF
if((hour() == 5) && (X10_C1 == false)){
myHouse.write(C, UNIT_1,repeatTimes);
myHouse.write(C, ON,repeatTimes);
X10_C1 = true;
Serial.println("Bathroom Heater ON");
}
I see the following in the X10_blink example and I'm not clear on its usage. Since it doesn't specify a module number does this send an ALL Lights on command to all house code "A" modules?
I don't think the X10 lib buffers commands (however each command is sent on the powerline 3 times anyway.) It looks like your state array is an effective way to prevent multiple sends for timed events though.
X10_blink example and I'm not clear on its usage
I didn't look at the whole example, but you should know that it actually takes 2 commands to do something. The first sets the House and Unit code and the second repeats the House code and sends the command (i.e. ON/OFF, etc.). Once the first command is sent, the Unit code is "remembered" and used for any commands that follow. So you can send the first command and then as many of the second commands as you wish and they will act on the Unit from the first command. :-?
BTW, if your serious about going further you should consider using the X10 libs from ThomasM . . . http://load-8-1.blogspot.com/2010_06_01_archive.html
You can send and receive, commands are buffered, and repeats identified. It also handles X10 RF reads.
To answer your second post, personally I think a status table belongs in the application rather than the lib. There are too many options to dictate one.
I also have a blog with several X10 projects here.