Skip to content

Commit

Permalink
chore: print when clearing devices
Browse files Browse the repository at this point in the history
  • Loading branch information
sondresjolyst committed Dec 18, 2024
1 parent 83ccb48 commit fdc9b7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/liz
Submodule liz updated from 71b0c4 to c399f5
14 changes: 9 additions & 5 deletions src/MQTTHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,22 +233,24 @@ bool mqttStatus()
void connectToMQTT()
{
Serial.print("Attempting to connect to MQTT broker: ");
Serial.print(MQTT_BROKER);
Serial.println(MQTT_BROKER);
printHelper.print("Attempting to connect to MQTT broker: ");
printHelper.println(MQTT_BROKER);

client.setServer(MQTT_BROKER, MQTT_PORT);
client.setBufferSize(512);
client.setCallback(mqttCallback);

while (!client.connected())
{
Serial.print(".");

liz::clearDiscoveredDevices();
printHelper.println("Clearing Discovered Devices");
if (client.connect(MQTT_HOSTNAME, MQTT_USER, MQTT_PASS))
{
Serial.println("");
Serial.println("MQTT connected");

liz::clearDiscoveredDevices();
printHelper.println("");
printHelper.println("MQTT connected");

if (strcmp(LIZ_TYPE, "sensor") == 0)
{
Expand All @@ -264,6 +266,8 @@ void connectToMQTT()
{
Serial.print("MQTT connection failed! Error code = ");
Serial.println(client.state());
printHelper.print("MQTT connection failed! Error code = ");
printHelper.println(String(client.state()));
}
}
}
Expand Down

0 comments on commit fdc9b7e

Please sign in to comment.