  * @brief Event handler for when the connection to the MQTT broker has been
  * disconnected.
  */
-void onMQTTDisconnect() {
-  DEBUGLOG("[MQTT] Disconnected\n");
+void onMQTTDisconnect(AsyncMqttClientDisconnectReason reason) {
+  DEBUGLOG("[MQTT] Disconnected. Reason: %d\n", reason);
 
   // Notify subscribers (disconnected)
   for (uint8_t i = 0; i < _mqtt_callbacks.size(); i++) {

 *
 * @param topic the MQTT topic to which the message has been published
 * @param payload the contents/message that has been published
 * @param length size of the published message
 */
void onMQTTMessage(char *topic, char *payload, uint16_t length) {
  // Convert payload into char variable
  char message[length + 1];
  os_memcpy(message, payload, length);

 * @brief Bootstrap function for the MQTT connection
 */
void setupMQTT() {
  mqtt.onConnect(onMQTTConnect);
  mqtt.onDisconnect(onMQTTDisconnect);
  mqtt.onMessage(onMQTTMessage);
}

/**
