Compare commits

..

1 Commits

Author SHA1 Message Date
224b4f9ab0 Remove redundant MQTT subscribe 2026-03-23 18:58:29 +01:00
2 changed files with 5 additions and 0 deletions

View File

@@ -20,6 +20,8 @@ void connect_mqtt();
void wlan_connection_handler(WiFiEvent_t event);
void on_mqtt_connection(bool session);
void on_mqtt_disconnection(AsyncMqttClientDisconnectReason reason);
size_t construct_json(float *data, char *buffer, int buffer_size);

View File

@@ -3,6 +3,7 @@
void initialize_wlan() { WiFi.onEvent(wlan_connection_handler); }
void initialize_mqtt() {
mqtt_client.onConnect(on_mqtt_connection);
mqtt_client.onDisconnect(on_mqtt_disconnection);
mqtt_client.setServer(config->mqtt_host, config->mqtt_port);
mqtt_client.setCredentials(config->mqtt_user, config->mqtt_password);
@@ -31,6 +32,8 @@ void wlan_connection_handler(WiFiEvent_t event) {
}
}
void on_mqtt_connection(bool session) { Serial.println("MQTT connected"); };
void on_mqtt_disconnection(AsyncMqttClientDisconnectReason reason) {
Serial.println("MQTT disconnected");