-
Notifications
You must be signed in to change notification settings - Fork 13
Updating to latest requests and miniMQTT #31
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
Conversation
@askpatrickw Reviewing over this PR, it does not look like it'll work with SSL and native sockets (ESP32-S2). Are you planning to add that as part of #21? |
@jimbobbennett You may want to comment on the readme that IoT Central functionality is not working at this time to avoid support issues. |
Not until we figure out IoT Central |
I don't thing the IoT Central issue is a change on our side. I've rolled back to last years code and it connects fine (CP 5.3, libraries from the June 11th 2020 release, latest code from this repo before this PR), so it implies it's a change in either CircuitPython or one of the MQTT libraries that is causing the issue. I'm going to try a few more versions out to see if I can find where things broke. |
Update - using the latest CircuitPython 6.2.0 and libraries from August, it works - so it's a library issue, not a CP issue. I'm still trying to find out which version introduces the break, but it's hard as I get random errors with different versions of the library bundle. Some will give OSError: 23, others an invalid broker error. |
Right - got somewhere. It seems the issue is using requests to call the DPS to get the hostname for the underlying IoT Hub used by IoT Central, then using MQTT to connect. There was a change in the ESP32SPI libs to only allow one socket connection at a time, and I think this might be the problem: https://git.1-hub.cnadafruit/Adafruit_CircuitPython_ESP32SPI/releases/tag/3.5.3 If I comment out the call to the DPS and set the hostname manually, everything works. @tannewt, @brentru - any ideas what is the correct thing to do here? Is there a way to disconnect the socket used by requests so that the code can use MQTT? |
Another option is to connect to the DPS over MQTT - https://docs.microsoft.com/en-us/azure/iot-dps/iot-dps-mqtt-support |
Option 2 done - the device registration now uses MQTT instead of HTTPS and this now works. @brentru - can you review now please! |
Thank you @jimbobbennett ! I also opened an issue in EPS32SPI about the single TLS connection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor changes/questions @jimbobbennett
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR.
Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_ADXL34x to 1.11.8 from 1.11.7: > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#29 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_APDS9960 to 2.2.7 from 2.2.6: > Merge pull request adafruit/Adafruit_CircuitPython_APDS9960#29 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_AS726x to 2.0.5 from 2.0.4: > Merge pull request adafruit/Adafruit_CircuitPython_AS726x#16 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_BNO055 to 5.3.1 from 5.3.0: > Merge pull request adafruit/Adafruit_CircuitPython_BNO055#81 from jposada202020/improving_docs > Merge pull request adafruit/Adafruit_CircuitPython_BNO055#80 from GuenterQ/master Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_FXAS21002C to 2.1.8 from 2.1.7: > Merge pull request adafruit/Adafruit_CircuitPython_FXAS21002C#22 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_FXOS8700 to 2.1.7 from 2.1.6: > Merge pull request adafruit/Adafruit_CircuitPython_FXOS8700#23 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_GPS to 3.9.0 from 3.8.1: > Merge pull request adafruit/Adafruit_CircuitPython_GPS#62 from lesamouraipourpre/minimum_sentence_size > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_ICM20X to 2.0.7 from 2.0.6: > Merge pull request adafruit/Adafruit_CircuitPython_ICM20X#12 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_L3GD20 to 2.3.5 from 2.3.4: > Merge pull request adafruit/Adafruit_CircuitPython_L3GD20#22 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_LIS2MDL to 2.1.9 from 2.1.8: > Merge pull request adafruit/Adafruit_CircuitPython_LIS2MDL#13 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_LIS331 to 1.0.5 from 1.0.4: > Merge pull request adafruit/Adafruit_CircuitPython_LIS331#3 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_LIS3DH to 5.1.10 from 5.1.9: > Merge pull request adafruit/Adafruit_CircuitPython_LIS3DH#68 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_LIS3MDL to 1.1.10 from 1.1.9: > Merge pull request adafruit/Adafruit_CircuitPython_LIS3MDL#16 from jposada202020/master > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_LSM303_Accel to 1.1.7 from 1.1.6: > Merge pull request adafruit/Adafruit_CircuitPython_LSM303_Accel#11 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_LSM303DLH_Mag to 1.1.8 from 1.1.7: > Merge pull request adafruit/Adafruit_CircuitPython_LSM303DLH_Mag#13 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_LSM9DS1 to 2.1.8 from 2.1.7: > Merge pull request adafruit/Adafruit_CircuitPython_LSM9DS1#29 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_MLX90393 to 2.0.6 from 2.0.5: > Merge pull request adafruit/Adafruit_CircuitPython_MLX90393#28 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_MMA8451 to 1.3.7 from 1.3.6: > Merge pull request adafruit/Adafruit_CircuitPython_MMA8451#17 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_MPU6050 to 1.1.7 from 1.1.6: > Merge pull request adafruit/Adafruit_CircuitPython_MPU6050#16 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_MSA301 to 1.2.7 from 1.2.6: > Merge pull request adafruit/Adafruit_CircuitPython_MSA301#15 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_TCS34725 to 3.3.7 from 3.3.6: > Merge pull request adafruit/Adafruit_CircuitPython_TCS34725#35 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_TLC59711 to 2.0.0 from 1.2.6: > Merge pull request adafruit/Adafruit_CircuitPython_TLC59711#17 from jposada202020/master > Merge pull request adafruit/Adafruit_CircuitPython_TLC59711#5 from s-light/multi > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_VCNL4010 to 0.10.8 from 0.10.7: > Merge pull request adafruit/Adafruit_CircuitPython_VCNL4010#18 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_VCNL4040 to 1.2.6 from 1.2.5: > Merge pull request adafruit/Adafruit_CircuitPython_VCNL4040#13 from jposada202020/improving_docs > "Increase duplicate code check threshold " Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_AzureIoT to 2.4.0 from 2.3.5: > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#31 from jimbobbennett/master Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_Bitmap_Font to 1.5.0 from 1.4.1: > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#46 from jposada202020/master > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#43 from jposada202020/raise_error_no_boundingbox > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#45 from FoamyGuy/simpletest_example Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_Display_Shapes to 2.1.0 from 2.0.8: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Shapes#37 from jposada202020/new_example_circle > Merge pull request adafruit/Adafruit_CircuitPython_Display_Shapes#36 from empirical-dan/patch-2 Updating https://git.1-hub.cnadafruit/Adafruit_CircuitPython_DisplayIO_Layout to 1.9.2 from 1.9.1: > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_Layout#36 from jposada202020/solving_parameters
Fixes #24 and works for IoT Hub. Everything is still broken for IoT Central, but I'm investigating internally what it might be.
This sets up the requests correctly, and uses the new logging API changes for the miniMQTT class. It also adds more debug logging.