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

Azure SDK-for-C, IoT Central Device Connecting OK, not sending telemetry #2816

Open
daveRobert1441 opened this issue May 3, 2024 · 4 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

@daveRobert1441
Copy link

Query/Question
I'm using an ESP32 to connect to my IOT Central Application. The device connects and registers through DPS, it is automatically added to the correct template. However the LOG stalls after this point (see below), nothing is published. I've edited the ESP32 example to use my telemetry properties.

Full log output:
1970/1/1 00:00:02 [INFO] WiFi connected, IP address: 192.168.**.64
1970/1/1 00:00:02 [INFO] Setting time using SNTP
......
2024/5/3 18:30:50 [INFO] Time initialized!
2024/5/3 18:30:50 [INFO] Telemetry frequency set to once every 10 seconds.
2024/5/3 18:30:50 [INFO] Azure IoT client initialized (state=2)
2024/5/3 18:30:50 [INFO] MQTT client target uri set to 'mqtts://global.azure-devices-provisioning.net'
2024/5/3 18:30:50 [INFO] MQTT client connecting.
2024/5/3 18:30:51 [INFO] MQTT client connected (session_present=0).
2024/5/3 18:30:51 [INFO] MQTT client subscribing to '$dps/registrations/res/#'
2024/5/3 18:30:51 [INFO] MQTT topic subscribed (message id=51357).
2024/5/3 18:30:51 [INFO] MQTT client publishing to '$dps/registrations/PUT/iotdps-register/?$rid=1'
2024/5/3 18:30:52 [INFO] MQTT message received.
2024/5/3 18:30:52 [INFO] MQTT client publishing to '$dps/registrations/GET/iotdps-get-operationstatus/?$rid=1&operationId=4.4c1b5bdabbfbb01b.f01df5a6-bb3d-4b76-8b2d-e2f1ecd2922a'
2024/5/3 18:30:52 [INFO] MQTT message received.
2024/5/3 18:30:55 [INFO] MQTT client publishing to '$dps/registrations/GET/iotdps-get-operationstatus/?$rid=1&operationId=4.4c1b5bdabbfbb01b.f01df5a6-bb3d-4b76-8b2d-e2f1ecd2922a'
2024/5/3 18:30:55 [INFO] MQTT message received.
2024/5/3 18:30:55 [INFO] MQTT client being disconnected.
2024/5/3 18:30:55 [INFO] MQTT client target uri set to 'mqtts://iotc-2696ce99-6da9-499a-88b8-879dbdec3bf1.azure-devices.net'
2024/5/3 18:30:55 [INFO] MQTT client connecting.
2024/5/3 18:30:56 [INFO] MQTT client connected (session_present=0).
2024/5/3 18:30:56 [INFO] MQTT client subscribing to '$iothub/methods/POST/#'
2024/5/3 18:30:56 [INFO] MQTT topic subscribed (message id=56104).
2024/5/3 18:30:56 [INFO] MQTT client subscribing to '$iothub/twin/res/#'
2024/5/3 18:30:56 [INFO] MQTT topic subscribed (message id=62637).

No telemetry sent.

Why is this not a Bug or a feature Request?
I don't think this is a bug, perhaps something I'm overlooking.

Setup (please complete the following information if applicable):

  • OS: Windows 11
  • IDE: Arduino
  • Version of the Library used: Azure SDK for c v1.1.6
@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 3, 2024
@vaavva
Copy link
Member

vaavva commented May 6, 2024

Hello @daveRobert1441! Are you running into this issue still if you don't modify the example to use your telemetry properties?
And to confirm, is your code based off of this sample? https://github.com/Azure/azure-sdk-for-c-arduino/tree/main/examples/Azure_IoT_Central_ESP32

@daveRobert1441
Copy link
Author

Hi @vaavva, I was able to get it working by commenting out this function:
//(void)azure_pnp_send_device_info(&azure_iot, properties_request_id++);
I think it hit the EXIT_IF_TRUE statement and stalled execution...?

@vaavva
Copy link
Member

vaavva commented May 6, 2024

Interesting - I'm surprised the log for the error isn't showing up, plus the result for that function doesn't look like it stalls execution (https://github.com/Azure/azure-sdk-for-c-arduino/blob/main/examples/Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino#L435). It would keep telemetry from being sent until the next iteration of the loop, but that should still happen within 10-20 seconds at maximum. A precondition failing could look like this since there wouldn't be an error printed and execution would halt so you can connect a debugger - perhaps this within send device info is the culprit https://github.com/Azure/azure-sdk-for-c-arduino/blob/main/examples/Azure_IoT_Central_ESP32/AzureIoT.cpp#L609, but I'm not sure why the message span wouldn't be at least size 1.

@daveRobert1441
Copy link
Author

Thanks for the info, I'll look into your suggestions.

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

2 participants