     door_closed();
     raised = false;
   }
+  // Let the MQTT client do some work
+  mqttClient.loop();
+
+  // Let the ESP Wifi do some work?
   yield();
 }
 

  }
}

void door_opened() {
  Serial.println("Cat door opened");
}

void door_closed() {
  Serial.println("Cat door closed.");
}

void setup() {
  for (uint16_t i = 0; i < NB_PROXIM_SAMPLES; i++) {
    proxim_samples[i] = proxim_nominal;
  }

    Serial.println("Connected to Proximity Sensor.");
  }

  // Network
  setup_wifi();
  mqttClient.setServer(MQTT_SERVER, MQTT_PORT);

  // Schedulers
  tickerHeartbeat.attach(10, heartbeat);
  tickerUpdate.attach_ms(100, update);

