 
   unsigned long now = millis();
 
-  if ((now - lastRelayActionmillis) >= 30000) {
+  if ((now - lastRelayActionmillis) >= BETWEEN_RELAY_ACTIVE ) {
     if ( receivedpayload == "{\"LIGHT\":1}") {
-      relaystatus = 1 ;
-    }
-    else if ( receivedpayload == "{\"LIGHT\":0}") {
-      relaystatus = 0 ;
+      relaystatus = HIGH ;
+    }
+    if ( receivedpayload == "{\"LIGHT\":0}") {
+      relaystatus = LOW ;
     }
   }
 

      }

      long now = millis();
      if (now - lastReconnectAttempt > 1000) {
        lastReconnectAttempt = now;
        if (reconnect()) {
          lastReconnectAttempt = 0;


  }

  if ((( millis() - lastRelayActionmillis) > BETWEEN_RELAY_ACTIVE ) && ( relayIsReady == LOW ) && ( relaystatus == oldrelaystatus ))
  {

    if (DEBUG_PRINT) {
      Serial.print("after BETWEEN_RELAY_ACTIVE => relaystatus => ");
      Serial.println(relaystatus);
    }

    String lightpayload = "{\"LIGHT\":";
    lightpayload += relaystatus;
