Help with AC project

I've done something somewhat similar. The tactic I used was to name each device and send strings. So, "device1,on,10" would mean device1 turn on for 10 seconds or something similar. All the devices listen and when they see their name, they would do whatever followed.

They send back status periodically as a similar string, "device1,on" would mean device1 is on right now. Then you can expand it to several items in the list and more complex parsing to get information around the house. My swimming pool sends something on the order of "Pool,m high,l off,f off,T 80,t 80" and that would mean the pool motor is on high, the light is off, the fountain is off, water temperature is 80F and the air temperature is 80F. This message gets sent every couple of minutes by the pool controller and received by a device that controls the entire house. To change something on the pool, I just send a string like "pool,motorhigh"

So, I use tactics like naming each device and having it respond to its name as well as say its name in each update it sends. I use comma separated fields to make it easy to parse out data using strtok() and simple state machine code to record and do things with it. In the past I wrote all the code to decode the XBee data stream in series 2 API mode 1 using broadcast. I don't recommend broadcast anymore because when your network grows past some critical point you overload it. Broadcast can clog up a network if you have a lot of devices (I had 7 when it started causing problems).

I'm slowly changing my devices to use the arduino XBee library. Recently it was updated to use software serial and alternate ports on the mega2560, so I can plug into a particular device and watch what is going on when some problem comes up; I don't have to tie up the serial port just to use the library. The library has a learning curve all its own and currently requires you to use API mode 2 which causes some minor complications when you try to read a packet off the air with a sniffer of some kind. However, it's nice to use library routines to get the address of the sending XBee instead of having to write the code for each device. I may modify the library to allow API mode 1 at some point for my own network.