adafruit / Adafruit_CircuitPython_AzureIoT

Access to Microsoft Azure IoT device, messaging, and job services from CircuitPython!
MIT License
20 stars 15 forks source link

Tracking dependency changes for ESP32-S2 and CP7 #21

Closed askpatrickw closed 2 years ago

askpatrickw commented 4 years ago

I've been trying out each of the underling dependencies for Adafruit_CircuitPython_AzureIoT on ESP32-S2 builds on a FeatherS2 and here are the known issues so far in dependencies.

This isn't a complete list but once these are closed or have workarounds or code in branches I'll keep trying.

I'm no longer sure this is needed

I see NTP in the samples, but not where any time or rtc is being used in the library so maybe it is not needed.

brentru commented 3 years ago

@askpatrickw Since UDP support has been merged in, are we waiting for the CircuitPython_NTP library to be updated?

Possibly @jimbobbennett could shine some light on the requirement for NTP in Azure IOT.

askpatrickw commented 3 years ago

Actually, now I can see where the current time is being used. @jimbobbennett please correct if I'm wrong.

To use this library, you will need to create an ESP32_SPI WifiManager, connected to WiFi. You will also need to set the current time, as this is used to generate time-based authentication keys. One way to do this is via the Adafruit CircuitPython NTP library ..

https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT/blob/master/adafruit_azureiot/iotcentral_device.py#L130 uses is to set the token_expiry token_expiry = int(time.time() + self._token_expires)

So the library doesn't need NTP but all the examples use it.

askpatrickw commented 3 years ago

I pushed a PR to Tannewt to complete the NTP work he started. not 100% necessary for azure iot library, but the examples will work with it. https://github.com/tannewt/Adafruit_CircuitPython_NTP/pull/1

jimbobbennett commented 3 years ago

The NTP library is only used in the examples to set the time as that is needed when generating the keys to authenticate with IoT Hub.

bluejazzCHN commented 3 years ago

Actually, now I can see where the current time is being used. @jimbobbennett please correct if I'm wrong.

To use this library, you will need to create an ESP32_SPI WifiManager, connected to WiFi. You will also need to set the current time, as this is used to generate time-based authentication keys. One way to do this is via the Adafruit CircuitPython NTP library ..

https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT/blob/master/adafruit_azureiot/iotcentral_device.py#L130 uses is to set the token_expiry token_expiry = int(time.time() + self._token_expires)

So the library doesn't need NTP but all the examples use it.

yes the library doesn't need NTP directly, just require time to get current time. but in order to keep current time accurately so call ntp.set_time().

brentru commented 3 years ago

@askpatrickw MiniMQTT is now compatible with CP6 and ESP32-S2 sockets. Are you going to create a PR to update this library to reflect the new API?

askpatrickw commented 3 years ago

@brentru woot!!

I may not get to it this week, but 100% Yes I will give it a go!

slyons commented 3 years ago

This seems to be an issue still. Any chance someone could take a peek at this again?

askpatrickw commented 2 years ago

@slyons, @jimbobbennett I have a PR in progress on this. https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT/pull/37

Lots of samples to test, but for ESP32S2 boards (native_networking) IoT Hub and IoT Central simple samples worked.