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

Add support for IoT Central over MQTT #7

Closed
jimbobbennett opened this issue Feb 26, 2020 · 8 comments
Closed

Add support for IoT Central over MQTT #7

jimbobbennett opened this issue Feb 26, 2020 · 8 comments

Comments

@jimbobbennett
Copy link
Collaborator

This library supports Azure IoT Hub over HTTP. Whilst this is great, it would be better if it:

  • Used MQTT instead of HTTP to avoid polling for cloud to device messages/direct methods
  • Exposed an IoT Central (the SaaS platform that sits on top of IoT Hub) interface as well as/in addition to IoT Hub to give a simplified API to access IoT Central

I've taken an unofficial IoT Central Python API that supports MicroPython that uses MQTT and exposes an IoT Central API and got it working with CircuitPython:

https://github.com/jimbobbennett/iotc_circuitpython

Video here of commands working from IoT Central:

https://twitter.com/jimbobbennett/status/1232475136655163393?s=20

Would you be interested in working with me to incorporate this into this library?

@brentru
Copy link
Member

brentru commented Feb 26, 2020

I'd be happy to assist merging your work with the IoT Central API into this library. It'd look something like this:

You may want to incorporate it simply by adding a MQTT class to the library. We've done this in Adafruit IO CircuitPython:
https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO/blob/master/adafruit_io/adafruit_io.py#L52

and in the Google Cloud IoT Core library:
https://github.com/adafruit/Adafruit_CircuitPython_GC_IOT_Core/blob/master/adafruit_gc_iot_core.py#L54

We'd also want to add an additional example within https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT/tree/master/examples


Also - I noticed there are some .py dependencies you've added to IOTC_CircuitPython - such as HMAC. If you need the whole .py file, we may want to create new libraries such as CircuitPython_HMAC first, instead of adding them into this library. We have a guide on this process here: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library

@ladyada
Copy link
Member

ladyada commented Feb 26, 2020

@jimbobbennett sounds awesome :)

@jimbobbennett
Copy link
Collaborator Author

@brentru - I've started creating libraries for HMAC and base64 encoding. Should these be Adafruit libraries hosted here, or should I create them in my personal repo and add them to the community bundle.

I feel like they should be here if this library will depend on them.

Base64: github.com/jimbobbennett/Adafruit_CircuitPython_Base64
HMAC: github.com/jimbobbennett/Adafruit_CircuitPython_HMAC

Thoughts?

@brentru
Copy link
Member

brentru commented Mar 12, 2020

@jimbobbennett

I'm about to break MiniMQTT (please see: adafruit/Adafruit_CircuitPython_MiniMQTT#21), it'll allow us to have more network interface flexibility in the future. Please make sure your code matches!

Should these be Adafruit libraries hosted here, or should I create them in my personal repo and add them to the community bundle.

Thanks for making these - yes, they should be added to the community bundle. Make sure this library's requirements.txt references them properly.

@jimbobbennett
Copy link
Collaborator Author

Thanks @brentru. Once those changes are in I'll ensure our code matches them.

I'll add those to the community bundle next week. Whats the rules on naming, I assume I shouldn't have Adafruit anywhere in the name as they are community bundles?

@jimbobbennett
Copy link
Collaborator Author

I've created the base64 and HMAC libraries and raised a PR to add them to the community bundle.

adafruit/CircuitPython_Community_Bundle#34

@jimbobbennett
Copy link
Collaborator Author

@brentru - I've updated my code to use the breaking change version of MiniMQTT and hit a bug in that library.

Issue raised here

@brentru
Copy link
Member

brentru commented Apr 30, 2020

Added in release 2.0.0

@brentru brentru closed this as completed Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants