MQTT now sets LWT and explicitly requests a clean sesion on startup.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Fabian Schlenz 2019-06-07 06:08:52 +02:00
parent c153ce915d
commit b71faa3bcb

View File

@ -85,7 +85,7 @@ boolean mqtt_connect() {
#endif #endif
snprintf(client_id, 30, HOSTNAME, chipid); snprintf(client_id, 30, HOSTNAME, chipid);
LOG("MQTT * Connecting to MQTT server with client id "); LOGln(client_id); LOG("MQTT * Connecting to MQTT server with client id "); LOGln(client_id);
if (mqtt_client.connect(client_id, MQTT_USER, MQTT_PASS)) { if (mqtt_client.connect(client_id, MQTT_USER, MQTT_PASS, MQTT_TOPIC "status", 0, true, "OFFLINE", true)) {
LOGln("MQTT * Connected."); LOGln("MQTT * Connected.");
mqtt_client.publish(MQTT_TOPIC "status", "ONLINE"); mqtt_client.publish(MQTT_TOPIC "status", "ONLINE");
mqtt_client.subscribe(MQTT_TOPIC "+"); mqtt_client.subscribe(MQTT_TOPIC "+");