 unsigned long door2_lastSwitchTime = 0;
 int debounceTime = 2000;
 
+String availabilityBase = MQTT_CLIENTID;
+String availabilitySuffix = "/availability";
+String availabilityTopicStr = availabilityBase + availabilitySuffix;
+const char* availabilityTopic = availabilityTopicStr.c_str();
+const char* birthMessage = "online";
+const char* lwtMessage = "offline";
+
 WiFiClient espClient;
 PubSubClient client(espClient);
 

  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (client.connect(mqtt_clientId, mqtt_username, mqtt_password)) {
      Serial.println("Connected!");

      // Subscribe to the action topics to listen for action messages
      Serial.print("Subscribing to ");

    Serial.print("Publishing on-demand status update for ");
    Serial.print(door1_alias);
    Serial.println("!");
    publish_birth_message();
    publish_door1_status();
  }
  else if (requestedDoor == mqtt_door2_action_topic && requestedAction == "OPEN") {
