 /*************************************************
        DO   NOT   EDIT   BELOW   THIS   LINE
  *************************************************/
- 
+
 // Runtime variables
 int           nightLockStart     =    22; // Hour (in 24hr time) to initiate night time lockout (10pm)
 int           nightLockEnd       =     4; // Hour (in 24hr time) to end night time lockout (4am)

      debugger.println("ARDUINO: Failed to setup MQTT");
    }
    lcdWrite("MQTT Connect", "Failure");
    while(1);
  }
  mqtt.lwt("lwt", "Offline");

  mqtt.connectedCb.attach(&mqttConnected);
  mqtt.disconnectedCb.attach(&mqttDisconnected);

/**
 * Handle movement of the door
 */
void doorMove() {
  debounceDoor();
  doorStatePrev = doorState;
  if (doorState == "closed" || doorState == "closing") {
    if (doorBottomState != 0) {
      // Door isn't closed, run motor until it is.
      digitalWrite(doorClose, HIGH);
      digitalWrite(doorOpen, LOW);
      digitalWrite(doorSpeed, HIGH);
    }
    else {
      // Door is closed, stop motor
      digitalWrite(doorClose, LOW);
      digitalWrite(doorOpen, LOW);
      digitalWrite(doorSpeed, LOW);
      doorState = "closed";
      if (doorStatePrev != doorState && wifiConnected) {
        mqtt.publish("coop/status", "door|closed", 2, 0);
      }
    }
  }
  else {
    if (doorTopState != 0) {
      // Door isn't open, run motor until it is.
      digitalWrite(doorClose, LOW);
      digitalWrite(doorOpen, HIGH);
      digitalWrite(doorSpeed, HIGH);
    }
    else {
      // Door is open, stop motor.
      digitalWrite(doorClose, LOW);
      digitalWrite(doorOpen, LOW);
      digitalWrite(doorSpeed, LOW);
      doorState = "open";
      if (doorStatePrev != doorState && wifiConnected) {
        mqtt.publish("coop/status", "door|open", 2, 0);
      }
    }
  }
}

/**
 * Read current sensor data
