Skip to content

Commit

Permalink
refactor(MQTT): refactor connect
Browse files Browse the repository at this point in the history
  • Loading branch information
becem-gharbi committed Jun 21, 2024
1 parent a55eb1d commit 67f8872
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/MQTT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ namespace ESPAdmin
const String username = Store::get(STORE_MQTT_USERNAME);
const String password = Store::get(STORE_MQTT_PASSWORD);

if (uriWS.length() == 0 || username.length() == 0 || password.length() == 0)
{
_logger.error("invalid MQTT configuration");
return;
}

const char lwtMessage[] = R"({"status":"disconnected"})";

String lwtTopic = "device/" + String(Store::options.deviceId) + "/report/status";
Expand Down

0 comments on commit 67f8872

Please sign in to comment.