       }
       break;
     case OPEN:
+      break;
     case CLOSED:
+#ifdef WIRECHECK_GPIO
+      {
+	static unsigned long lastWireFail = 0;
+        if (digitalRead(WIRECHECK_GPIO) == WIRECHECK_REDLED) {
+	   lastWireFail = millis();
+	} else {
+           if (millis() - lastWireFail > 2 * DOOR_OPEN_DELAY && lastWireFail != 0) {
+		lastWireFail += 300 * 1000; // 5 minute reporting interval.
+        
+                 char msg[255];
+                 snprintf(msg, sizeof(msg), "[%s] RED led still on - despite closed door. Possible wire issue.", pname);
+                 Serial.println(msg);
+                 client.publish(log_topic, msg);
+           } 
+        }
+      }
+#endif
+      break;
     default:
       break;
   };

#define SOLENOID_ENGAGED  (HIGH)

#define AARTLED_GPIO      (16)

#define DOOR_OPEN_DELAY         (5*1000)   //  10 seconds -- how long to hold the relay engaged; in milli seconds.
#define CACHE_FALLBACK_TIMEOUT  (500)       // 0.5 second  -- how long to wait for a reply before checking the cache.

  mfrc522.PCD_WriteRegister(mfrc522.ComIrqReg, 0x7F);
}

static long lastReconnectAttempt = 0;

boolean reconnect() {
