Use a robust asynchronous MQTT client

This commit is contained in:
2026-03-11 20:49:38 +01:00
parent 1dcd9c8f0a
commit 2620d05f49
8 changed files with 147 additions and 124 deletions

View File

@@ -1,27 +1,24 @@
#ifndef CONFIG_H_
#define CONFIG_H_
#include "FS.h"
#include "LittleFS.h"
#include <ArduinoJson.h>
typedef struct {
const char *ssid;
const char *psk;
const char *mqtt_host;
const char *mqtt_user;
const char *mqtt_password;
const char *topic;
const char *device_id;
int mqtt_port;
long sleep_time;
int connection_attempts;
const char *ssid;
const char *psk;
const char *mqtt_host;
const char *mqtt_user;
const char *mqtt_password;
const char *topic;
const char *device_id;
int mqtt_port;
unsigned long sleep_time;
} Config;
void initialize_config(Config *config, StaticJsonDocument<512> json);
void initialize_config(Config *config, JsonDocument json);
bool load_config_file(const char *file_path, Config *config);
long minutes_to_microseconds(int minutes);
long minutes_to_milliseconds(int minutes);
#endif // CONFIG_H_