   Serial.begin(9600);    // Local Serial Communications
   mySerial.begin(9600);  // XBee Communications
 
-  strcpy(out, "Init HouseWare Hub");
+  strcpy(out, "I001");   // Startup Message
   sendMsg();
 
   pinMode(4, INPUT);    // door pin


/* Read a message from the XBee interface */
/* Specify a char array as well as the array size */
int getMsg(char* m, int bsize){
  if (mySerial.available()) {                          // XBee has data
    int p = 0;                                         // buffer pos
    while(mySerial.available()){                       // Until buffer is empty
      if(mySerial.read() == '{'){                      // Start of JSON data
        while(mySerial.peek() != '}' && p < bsize){    // until the end of JSON data
          m[p++]=mySerial.read();                      // build the 'm' buffer
        }
        m[p++]=0;                                      // null terminate the 'm' buffer
      }
    }
    return 1;    // got a vailid message
  }
  return 0;      // no valid message
}

/* Process a givin JSON message */
/* Specify the char array */
int processMsg(char* m){
  switch(m[1]){
    case 'r':            // request

    return -1;
  }
}
*/

void loop() {
  // check the door
  /*
  if(digitalRead(4) != pDoor){
    processMsg("\"req\":04");
    pDoor = !pDoor;
  }
  */
  
  // get and process messages
  getMsg();
  
  delay(DELAY);
}

