From d6b84bae70035b68800d2ae068835d3a7a8882d3 Mon Sep 17 00:00:00 2001 From: Dirk Jahnke Date: Tue, 2 Feb 2021 15:49:15 +0100 Subject: [PATCH] Change mqtt client name --- src/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1d8eefe..e925549 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,6 +37,7 @@ byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xEA }; IPAddress ip(192, 168, 89, 205); IPAddress mqttServerIP(192, 168, 89, 95); + const char *mqttUser = "default"; const char *mqttPassword = "12345678"; @@ -204,19 +205,19 @@ void reconnect() { while (!mqttClient.connected()) { Serial.print(F("Attempting MQTT connection...")); // Attempt to connect - if (mqttClient.connect("doorBellGateway", mqttUser, mqttPassword, lwtTopic, lwtQos, lwtRetain, lwtMessage)) { + if (mqttClient.connect("doorBellGW", mqttUser, mqttPassword, lwtTopic, lwtQos, lwtRetain, lwtMessage)) { Serial.println(F("connected")); // Once connected, publish an announcement... mqttClient.publish_P(lwtTopic, onlineMessage, lwtRetain); // mqttClient.publish("hello","hello world"); // ... and resubscribe Serial.println(F("MQTT subscribe doorbell")); - if (!mqttClient.subscribe("doorbell")) { + if (!mqttClient.subscribe("doorBellGW", 1)) { Serial.println(F("ERROR: Failed to subscribe")); } for (unsigned int i=0; i