Azure / iot-central-micropython-client

A micropython SDK for connecting devices to Microsoft Azure IoT Central
MIT License
13 stars 9 forks source link

Migrate to mip #5

Closed sebastianneubauer closed 1 year ago

sebastianneubauer commented 1 year ago

As upip got replaced by mip it would be nice to have mip compatibility: https://github.com/orgs/micropython/discussions/9565

firedog1024 commented 1 year ago

I had to make a couple of changes in the codebase for another issue and as part of that change I have replaced the pip usage with mip. The necessary python code is pulled from this GitHub repo instead of from PyPi. It will install from the package.json file and installs the contents of the iotc folder along with umqtt library dependency. Adding the following code to your main program should perform the install.

# If your device needs wifi before running uncomment and adapt the code below as necessary
# import network
# wlan = network.WLAN(network.STA_IF)
# wlan.active(True)
# wlan.connect("SSID","password")
# while not wlan.isconnected():
#     pass
# print(wlan.isconnected())

try:
    import iotc
except:
    import mip
    mip.install('github:Azure/iot-central-micropython-client/package.json')
    import iotc