 
 void init_wifi()
 {
-  wifi = new WiFiConnector(ssid, pass);
+  // use flash memory ssid & smartconfig
+  wifi = new WiFiConnector();
+
+  // wifi = new WiFiConnector(ssid, password);
 
   wifi->on_connecting([&](const void* message)
   {
-    Serial.print("connecting ");
-    Serial.println ((char*)message);
+    Serial.println("connecting ");
+    // Serial.println ((char*)message);
     delay(500);
   });
 
   wifi->on_connected([&](const void* message)
   {
-    Serial.print ("WIFI CONECTED: ");
-    Serial.println ((char*)message);
+    Serial.println("WIFI CONECTED: ");
+    // Print the IP address
+    Serial.println(WiFi.localIP());
+    // Serial.println ((char*)message);
   });
 
   wifi->on_disconnected([&](const void* message)
   {
-    Serial.print ("WIFI DISCONECTED: ");
-    Serial.print ("WIFI DISCONECTED: ");
-    Serial.print ("WIFI DISCONECTED: ");
-    Serial.println ((char*)message);
+    Serial.println("WIFI DISCONECTED.");
+    // Serial.println ((char*)message);
+  });
+
+  wifi->on_smartconfig_enter([&](const void* message)
+  {
+    Serial.println("ENTER SMARTCONFIG.");
+  });
+
+  wifi->on_smartconfig_done([&](const void* message)
+  {
+    Serial.println("SMARTCONFIG DONE.");
+  });
+
+  wifi->on_smartconfig_doing([&](const void* message)
+  {
+    // Serial.println("CONFIGURING WIFI..");
+    // delay(500);
   });
 
   wifi->connect();
 
 }
-
 void init_mqtt()
 {
 
-  mqtt = new MqttConnector("mqtt.tespa.io");
+  mqtt = new MqttConnector("iot.eclipse.org");
+  mqtt->prepare_configuration([&](MqttConnector::Config * config) -> void {
+    // do nothing.
+    Serial.print("HOST: ");
+    Serial.print(config->mqttHost);
 
-  mqtt->prepare_configuration([&](MqttConnector::Config * config) -> void {
+    Serial.print(" PORT: ");
+    Serial.println(config->mqttPort);
 
+    Serial.print("__PUBLICATION TOPIC -> ");
+    Serial.println(config->topicPub);
+    Serial.print("__SUBSCRIPTION TOPIC -> ");
+    Serial.println(config->topicSub);    
   });
-
-  mqtt->prepare_configuration(NULL);
 
   mqtt->prepare_data([&](JsonObject * root) -> void {
     JsonObject& data = root->at("d");
-    // data["myName"] = "0x001";
+    data["myName"] = "NAzT";
     data["adc"] = analogRead(A0);
-    data["sdk"] = system_get_sdk_version();
-  }, 1500);
+    data["tag"] = "paris";
+    data["zone"] = "1";
+  }, 5000);
 
 
-  mqtt->prepare_subscribe(NULL);
   mqtt->prepare_subscribe([&](MQTT::Subscribe * sub) -> void {
-    // (sub)->add_topic("HELLO");
   });
 
 
   mqtt->after_prepare_data([&](JsonObject * root) -> void {
     JsonObject& data = root->at("d");
-    //delete data["version"];
+
+    // Serial.println("DATA: ");
+    // data.printTo(Serial);
+    // Serial.println();
+    // Serial.println();
+    // Serial.println();
+
+    data.remove("version");
+    data.remove("flash_id");
+    data.remove("flash_size");
+    data.remove("chip_id");
+    data.remove("sdk");
+    data.remove("counter");
   });
 
   mqtt->on_message([&](const MQTT::Publish & pub) -> void {

  });

  mqtt->on_connecting([&](int count, bool * flag) {
    Serial.print("CONNECTION: ");
    Serial.println(count);
  });

  mqtt->connect();


#include <pt.h>

MqttConnector *mqtt;
WiFiConnector *wifi;

void init_hardware()
{
  Serial.begin(9600);
  delay(10);
  Serial.println();
  Serial.println("BEGIN");
