 
 void replyStatus() {
   DEBUG_PRINTLN("ask for client status");
-  if(strcmp(deviceId, deviceLamp) == 0) {
+  if(strcmp(deviceId, deviceLamp) == 0 || strcmp(deviceId, deviceFan) == 0) {
     int status = digitalRead(controlledPin);
     if (status == 0) {
-      sendXBeePacketFromRaw(&XBee, deviceId, "A", "BRI", "OFF");
+      sendXBeePacketFromRaw(&XBee, deviceId, "A", "POW", "OFF");
     } else {
-      sendXBeePacketFromRaw(&XBee, deviceId, "A", "BRI", " ON");
-    }
-  } else if(strcmp(deviceId, deviceTV) == 0) {
+      sendXBeePacketFromRaw(&XBee, deviceId, "A", "POW", " ON");
+    }
+  } else if(strcmp(deviceId, deviceTV) == 0 || strcmp(deviceId, deviceMusic) == 0) {
     //send a read status cmd to the laptop and wait for reply
     //curently only volume is needed
     Serial.print(deviceId);

  Serial.println(deviceId);  
}

void lampClient(struct XBeePacket p) {
  DEBUG_PRINTLN("command issued");
  if (strcmp(p.func, "R") == 0 && strcmp(p.var, "BRI") == 0 ) {
    // read the current status and reply
    int status = digitalRead(controlledPin);
    if (status == 0) {
      sendXBeePacketFromRaw(&XBee, deviceId, "A", "BRI", "OFF");
    } else {
      sendXBeePacketFromRaw(&XBee, deviceId, "A", "BRI", " ON");
    }
  }
  else if (strcmp(p.func, "C") == 0 && strcmp(p.var, "BRI") == 0 && strcmp(p.data, " ON") == 0) {
    DEBUG_PRINTLN("turned on");
    digitalWrite(controlledPin, HIGH);
    sendXBeePacketFromRaw(&XBee, deviceId, "A", "BRI", " ON");
  }
  else if (strcmp(p.func, "C") == 0 && strcmp(p.var, "BRI") == 0 && strcmp(p.data, "OFF") == 0) {
    DEBUG_PRINTLN("turned off");
    digitalWrite(controlledPin, LOW);
    sendXBeePacketFromRaw(&XBee, deviceId, "A", "BRI", "OFF");
  }
  else {
    // error message

        laptopBridging(p);
      } else if(strcmp(deviceId, deviceLamp) == 0
        || strcmp(deviceId, deviceFan) == 0) {
        powerClient(p);

      }
    }
