fix(mqtt): log a failed client start instead of reporting success

connect() logged "MQTT client started." unconditionally, so a failing
esp_mqtt_client_start() looked identical to a successful one. That is the one
state a later reconnect() cannot recover from, which made it the worst possible
line to be wrong.
This commit is contained in:
agessaman committed 2026-08-14 09:53:38 -07:00
1 parent 6ffadd6e72
commit f64852e223
1 file changed
+6 -1
@@ -438,8 +438,13 @@ void PsychicMqttClient::connect()
if (start_result == ESP_OK)
{
_started = true;
ESP_LOGI(TAG, "MQTT client started.");
}
else
{
// Reporting success here hides the one state reconnect() cannot recover from.
ESP_LOGE(TAG, "MQTT client failed to start: %s", esp_err_to_name(start_result));
}
ESP_LOGI(TAG, "MQTT client started.");
}
void PsychicMqttClient::reconnect()