AMQP to Azure IoTHub via CAT-M
Hi Pycom folks,
I'd like to use the FiPy (LTE CAT-M pycom) to upload data to Azure IoTHub. I can find bits of pieces of what's needed, but I'm unsure about how to string these together.
In order to push data to Azure IoTHub over CAT-M, a few things are needed:
- SHA256 HMAC for authentication to Azure
- TLS and NTP and network
- AMQP (I want AMQP instead HTTPS to save on data usage)
Here are the pieces I've found.
For #1 and #2, Dave Glover from Microsoft has an Azure client implementation for micropython targeted for ESP32 (awesome!). However, it uses wlan interface built into the ESP32, and he uses HTTPS instead of AMQP to publish to IoTHub.
My question is: Does it matter that socket is using wlan or LTE? Can I pretty much just replace his wlan lines with the LTE lines from the pycom example? A socket is a socket regardless, and the network library abstracts wlan and LTE for me?
//esp32 wifi interface wlan = network.WLAN(network.STA_IF) //... s = socket.socket()
Where as for the LTE connection on pycom, it looks like this
//pycom example for LTE interface lte.connect() //... s = socket.socket()
So with that, I think I can get an HTTP example to Azure IoTHub.
As for #3, converting the HTTP example to AMQP. I couldn't find any micropython AMQP libraries at all. There are some popular pure python AMQP libraries, but being new to micropython, I'm not sure what would be involved to convert python to micropython.