This commit is contained in:
proddy
2019-01-03 19:42:58 +01:00
parent ec3d10cb3d
commit b999dd3395
7 changed files with 20 additions and 15 deletions

View File

@@ -193,7 +193,7 @@ void MyESP::mqttUnsubscribe(const char * topic) {
// MQTT Publish
void MyESP::mqttPublish(const char * topic, const char * payload) {
char s[600];
char s[MQTT_MAX_SIZE];
snprintf(s, sizeof(s), "%s%s/%s", MQTT_BASE, _app_hostname, topic);
// myDebug_P(PSTR("[MQTT] Sending pubish to %s with payload %s"), s, payload);
mqttClient.publish(s, MQTT_QOS, false, payload);

View File

@@ -42,6 +42,7 @@
#define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection
#define MQTT_RECONNECT_DELAY_STEP 5000 // Increase the reconnect delay in 5 seconds after each failed attempt
#define MQTT_RECONNECT_DELAY_MAX 120000 // Set reconnect time to 2 minutes at most
#define MQTT_MAX_SIZE 600 // max length of MQTT message
// Internal MQTT events
#define MQTT_CONNECT_EVENT 0
#define MQTT_DISCONNECT_EVENT 1