   sendmqttMsg(reporting_topic, payload, true);
 }
 
+void ICACHE_RAM_ATTR sendUpdate()
+{
+  DynamicJsonBuffer jsonBuffer;
+  JsonObject& root = jsonBuffer.createObject();
+  if (bRelayState)
+  {   
+     root["cmd"] = "on";
+  }
+  else
+  {
+     root["cmd"] = "off";
+  }
+  String json;
+  root.printTo(json);
+
+  sendmqttMsg(subscribe_topic, json, true);
+}
+
 void ICACHE_RAM_ATTR parseMqttMsg(String receivedpayload, String receivedtopic)
 {
   char json[] = "{\"cmd\":\"off\"}";

  ArduinoOTA.setPassword(OTA_PASSWORD);
  ArduinoOTA.onStart([]() 
  { 
     ticker.attach(0.1, tick); 
  });
  ArduinoOTA.onEnd([]() { });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { });

    Serial.println(WIFI_SSID);

    //wifi_set_phy_mode(PHY_MODE_11N);
    //WiFi.setOutputPower(18);
    WiFi.mode(WIFI_STA);
    WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
    WiFi.hostname("esp-bedroomlight");
