  */
  void doorMove() {
    debounceDoor();
+   doorStatePrev = doorState;
+
    if (doorState == "closed" || doorState == "closing") {
      if (doorBottomState != 0) {
        // Door isn't closed, run motor until it is.

       digitalWrite(doorClose, LOW);
       digitalWrite(doorOpen, LOW);
       digitalWrite(doorSpeed, LOW);
     }
   }
   else {

       digitalWrite(doorClose, LOW);
       digitalWrite(doorOpen, LOW);
       digitalWrite(doorSpeed, LOW);
       doorState = "open";
       if (doorStatePrev != doorState && wifiConnected) {
         mqtt.publish("coop/status", "door|open", 2, 0);
       }
     }
   }
 }
