Arduino port version for ESP32 Compile Time setting vs. Runtime settings for IOT hub client and MQTT client #2819
Labels
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-triage
Workflow: This is a new issue that needs to be triaged to the appropriate team.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Query/Question
Why does the ESP32 for Hub example work when the device id, device key and Azure IoT Hub URL are set in #define works correctly, but when set at runtime, does not connect?
Why is this not a Bug or a feature Request?
This is not a bug because the example works when ran per the instructions.
Setup (please complete the following information if applicable):
I am storing the device id, device key and Azure IoT Hub info in NVM on the ESP32S3 device. This is done during a provisioning session.
I have copied and pasted the example code that works, into a C++ class that retrieves the device and hub info and then sets the local variables at run-time before trying to execute the IoT Client and MQTT Client initializations. (no modifications to these functions).
I have set a 30 sec. delay between attempts to connect. Once the MQTT Client is started, I get the "Before Connect" event then I get the "Error" event with MQTT reporting "MQTT event MQTT_EVENT_ERRORE (39791) MQTT_CLIENT: MQTT connect failed".
The only modification from the example code was to declare the variables:
[
static const char *host;
static const char *mqtt_broker_uri;
static const char *device_id;
static const char *device_type;
]
Then run a function to set the values for these variables before initializing the clients (IoT , MQTT).
Information Checklist
Please make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
The text was updated successfully, but these errors were encountered: