added MQTT QOS and Keep Alive configurable

This commit is contained in:
Paul
2019-10-13 21:03:15 +02:00
parent 1e85934b38
commit e3d06e15a3
10 changed files with 117 additions and 58 deletions

View File

@@ -80,8 +80,8 @@ extern struct rst_info resetInfo;
#define MQTT_WILL_OFFLINE_PAYLOAD "offline" // for last will & testament payload
#define MQTT_BASE_DEFAULT "home" // default MQTT prefix to topics
#define MQTT_RETAIN false
#define MQTT_KEEPALIVE 60 // 1 minute
#define MQTT_QOS 1
#define MQTT_KEEPALIVE 60 // default keepalive 1 minute
#define MQTT_QOS 1 // default qos
#define MQTT_WILL_TOPIC "status" // for last will & testament topic name
#define MQTT_MAX_TOPIC_SIZE 50 // max length of MQTT topic
#define MQTT_MAX_PAYLOAD_SIZE 700 // max size of a JSON object. See https://arduinojson.org/v6/assistant/
@@ -293,6 +293,7 @@ class MyESP {
bool fs_saveCustomConfig(JsonObject root);
bool fs_setSettingValue(char ** setting, const char * value, const char * value_default);
bool fs_setSettingValue(uint16_t * setting, const char * value, uint16_t value_default);
bool fs_setSettingValue(uint8_t * setting, const char * value, uint8_t value_default);
bool fs_setSettingValue(bool * setting, const char * value, bool value_default);
// Web
@@ -340,7 +341,7 @@ class MyESP {
uint16_t _mqtt_port;
char * _mqtt_base;
bool _mqtt_enabled;
uint32_t _mqtt_keepalive;
uint16_t _mqtt_keepalive;
uint8_t _mqtt_qos;
bool _mqtt_retain;
char * _mqtt_will_topic;