Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino port version for ESP32 Compile Time setting vs. Runtime settings for IOT hub client and MQTT client #2819

Open
hcr-mit opened this issue May 11, 2024 · 0 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage 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

Comments

@hcr-mit
Copy link

hcr-mit commented May 11, 2024

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):

  • OS: ESP32
  • IDE: Arduino IDE
  • Version of the Library used is current release of Arduino port of 1.5.0-beta.1

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

  • [ x] Query Added
  • [ x] Setup information Added
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage 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 labels May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage 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
Projects
None yet
Development

No branches or pull requests

1 participant