Skip to content

Commit ab809a0

Browse files
committed
Use fixed MQTT ID
This is the correct fix instead of the randomness introducted in f1d44fb. The "Clean Session" flag tells the MQTT server that we are a new client and don't wish to inherit any state. This is an explicit statement of intention, and more clearly communicates what we expect to happen to any stale dataflows.
1 parent d280122 commit ab809a0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

gizmo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,8 @@ void netStateMQTTConnect() {
565565
}
566566

567567
mqtt.setConnectionTimeout(1000);
568+
mqtt.setCleanSession(true);
569+
mqtt.setId(cfg.hostname);
568570
Serial.println("GIZMO_MQTT_TARGET " + cfg.mqttBroker);
569571
if (!mqtt.connect(mqttIP)) {
570572
logMQTTError();

0 commit comments

Comments
 (0)