Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 14f7e31

Browse files
committed
Explicitly set QoS to 1 for configuration messages so confiugrations are acknowledged
1 parent 47f2126 commit 14f7e31

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

examples/Esp32-lwmqtt/esp32-mqtt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ void mqttConnect() {
9999
delay(1000);
100100
}
101101
Serial.println("\nconnected!");
102-
mqttClient->subscribe(device->getConfigTopic());
103-
mqttClient->subscribe(device->getCommandsTopic());
102+
mqttClient->subscribe(device->getConfigTopic(), 1); // Set QoS to 1 (ack) for configuration messages
103+
mqttClient->subscribe(device->getCommandsTopic(), 0); // QoS 0 (no ack) for commands
104104
publishState("connected");
105105
}
106106

examples/Esp8266-lwmqtt/esp8266_mqtt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ void mqttConnect() {
125125
delay(1000);
126126
}
127127
Serial.println("\nconnected!");
128-
mqttClient->subscribe(device->getConfigTopic());
129-
mqttClient->subscribe(device->getCommandsTopic());
128+
mqttClient->subscribe(device->getConfigTopic(), 1); // Set QoS to 1 (ack) for configuration messages
129+
mqttClient->subscribe(device->getCommandsTopic(), 0); // QoS 0 (no ack) for commands
130130
publishState("connected");
131131
}
132132

examples/MKR1000-lwmqtt/mkr1000-mqtt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ void mqttConnect() {
9494
delay(1000);
9595
}
9696
Serial.println("\nconnected!");
97-
mqttClient->subscribe(device->getConfigTopic());
98-
mqttClient->subscribe(device->getCommandsTopic());
97+
mqttClient->subscribe(device->getConfigTopic(), 1); // Set QoS to 1 (ack) for configuration messages
98+
mqttClient->subscribe(device->getCommandsTopic(), 0); // QoS 0 (no ack) for commands
9999
publishState("connected");
100100
}
101101

0 commit comments

Comments
 (0)