diff --git a/src/XD0MQTT.cpp b/src/XD0MQTT.cpp index 9688835..176132c 100644 --- a/src/XD0MQTT.cpp +++ b/src/XD0MQTT.cpp @@ -88,8 +88,10 @@ static esp_err_t mqtt_event_handler_cb(esp_mqtt_event_handle_t event) } bool XD0MQTT::begin(void) { - esp_mqtt_client_config_t mqtt_cfg; + static esp_mqtt_client_config_t mqtt_cfg; mqtt_cfg.uri = MQTT_BROKER_URI; +// mqtt_cfg.host = "home.xd0.de"; +// mqtt_cfg.port = 8883; mqtt_cfg.event_handle = mqtt_event_handler; mqtt_cfg.cert_pem = (const char *)rootCACertificate; mqtt_cfg.username = MQTT_USERNAME; @@ -97,6 +99,9 @@ bool XD0MQTT::begin(void) { mqtt_cfg.user_context = (void*)this; ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size()); + Serial.printf("BROKER URI: %s\n", MQTT_BROKER_URI); + Serial.printf("MQTT USERNAME: %s\n", MQTT_USERNAME); + Serial.printf("MQTT PASSWORD: %s\n", MQTT_PASSWORD); esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg); //esp_mqtt_client_register_event(client, ESP_EVENT_ANY_ID, mqtt_event_handler, client); esp_mqtt_client_start(client); diff --git a/src/main.cpp b/src/main.cpp index 9dd761f..b6d259e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -126,9 +126,9 @@ void setup() XD0OTA ota("esp32-weatherstation"); ota.update(); -/* + mqtt.begin(); -*/ + } void loop()