fix: use unique client ID for MQTT connection to avoid conflicts
This commit is contained in:
parent
dd7ba3bf5d
commit
af23b07df1
@ -553,7 +553,8 @@ void reconnect() {
|
|||||||
oledShowTopRow();
|
oledShowTopRow();
|
||||||
|
|
||||||
// Attempt to connect
|
// Attempt to connect
|
||||||
if (client.connect(bambu_serialnr, bambu_username, bambu_accesscode)) {
|
String clientId = String(bambu_serialnr) + "_" + String(random(0, 100));
|
||||||
|
if (client.connect(clientId.c_str(), bambu_username, bambu_accesscode)) {
|
||||||
Serial.println("MQTT re/connected");
|
Serial.println("MQTT re/connected");
|
||||||
|
|
||||||
client.subscribe(report_topic.c_str());
|
client.subscribe(report_topic.c_str());
|
||||||
@ -619,7 +620,8 @@ bool setupMqtt() {
|
|||||||
|
|
||||||
// Verbinden mit dem MQTT-Server
|
// Verbinden mit dem MQTT-Server
|
||||||
bool connected = true;
|
bool connected = true;
|
||||||
if (client.connect(bambu_serialnr, bambu_username, bambu_accesscode))
|
String clientId = String(bambu_serialnr) + "_" + String(random(0, 100));
|
||||||
|
if (client.connect(clientId.c_str(), bambu_username, bambu_accesscode))
|
||||||
{
|
{
|
||||||
client.setCallback(mqtt_callback);
|
client.setCallback(mqtt_callback);
|
||||||
client.setBufferSize(5120);
|
client.setBufferSize(5120);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user