   return false;
 }
 
-bool setup_with_appkey_and_devid(const char *appkey, const char *devid) {
+bool setup_with_appkey_and_devid() {
   uint8_t buf[BUFSIZE];
-
-  if (appkey == NULL) return false;
-
-  String data("{\"a\": \"");
-  data += String(appkey);
-
-  if (devid == NULL) {
-    data += String("\", \"p\":4}");
-  } else {
-    data += String("\", \"p\":4, \"d\": \"");
-    data += String(devid);
-    data += String("\"}");
-  }
-  uint16_t len = data.length();
+  uint16_t len;
+
+  len = snprintf((char *)buf + 3, BUFSIZE - 3, "{\"a\":\"%s\",\"p\":4,\"d\":\"%s\"}", g_appkey, g_devid);
 
   buf[0] = 1;
   buf[1] = (uint8_t)((len >> 8) & 0xff);
   buf[2] = (uint8_t)(len & 0xff);
 
-  memcpy(buf + 3, data.c_str(), len);
   len += 3;
 
   buf[len] = 0;

}

void report_status() {
  String data("{\"status\":");
  data += String(g_status);
  data += String(",\"devid\":\"");
  data += String(g_devid);
  data += String("\"}");

  Serial.println(data);
  mqtt_client->publish(g_topic, data.c_str());
}

void messageReceived(String topic, String payload, char *bytes, unsigned int length) {
  StaticJsonBuffer<JSON_BUFSIZE> jsonBuffer;

  bytes[length] = 0;

  net_client.stop();
}

bool get_host_v2() {
  uint8_t buf[BUFSIZE];
  uint16_t len;

  len = snprintf((char *)buf + 3, BUFSIZE - 3, "{\"a\":\"%s\",\"n\":\"1\",\"v\":\"v1.0\",\"o\":\"1\"}", g_appkey);

  buf[0] = 1;
  buf[1] = (uint8_t)((len >> 8) & 0xff);
  buf[2] = (uint8_t)(len & 0xff);

  len += 3;

  buf[len] = 0;
