Compare commits
1 Commits
master
...
80ea2dcec8
| Author | SHA1 | Date | |
|---|---|---|---|
|
80ea2dcec8
|
@@ -20,8 +20,6 @@ void connect_mqtt();
|
|||||||
|
|
||||||
void wlan_connection_handler(WiFiEvent_t event);
|
void wlan_connection_handler(WiFiEvent_t event);
|
||||||
|
|
||||||
void on_mqtt_connection(bool session);
|
|
||||||
|
|
||||||
void on_mqtt_disconnection(AsyncMqttClientDisconnectReason reason);
|
void on_mqtt_disconnection(AsyncMqttClientDisconnectReason reason);
|
||||||
|
|
||||||
size_t construct_json(float *data, char *buffer, int buffer_size);
|
size_t construct_json(float *data, char *buffer, int buffer_size);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
void initialize_wlan() { WiFi.onEvent(wlan_connection_handler); }
|
void initialize_wlan() { WiFi.onEvent(wlan_connection_handler); }
|
||||||
|
|
||||||
void initialize_mqtt() {
|
void initialize_mqtt() {
|
||||||
mqtt_client.onConnect(on_mqtt_connection);
|
|
||||||
mqtt_client.onDisconnect(on_mqtt_disconnection);
|
mqtt_client.onDisconnect(on_mqtt_disconnection);
|
||||||
mqtt_client.setServer(config->mqtt_host, config->mqtt_port);
|
mqtt_client.setServer(config->mqtt_host, config->mqtt_port);
|
||||||
mqtt_client.setCredentials(config->mqtt_user, config->mqtt_password);
|
mqtt_client.setCredentials(config->mqtt_user, config->mqtt_password);
|
||||||
@@ -32,11 +31,6 @@ void wlan_connection_handler(WiFiEvent_t event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_mqtt_connection(bool session) {
|
|
||||||
Serial.println("MQTT connected");
|
|
||||||
mqtt_client.subscribe(config->topic, 2);
|
|
||||||
};
|
|
||||||
|
|
||||||
void on_mqtt_disconnection(AsyncMqttClientDisconnectReason reason) {
|
void on_mqtt_disconnection(AsyncMqttClientDisconnectReason reason) {
|
||||||
Serial.println("MQTT disconnected");
|
Serial.println("MQTT disconnected");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user