SIM7000-LTE-Shield
SIM7000-LTE-Shield copied to clipboard
How to connect to Azure IoT Hub by MQTT with SIM7000E?
Hello.
I would like to connect to Azure IoT Hub using SIm7000E. I found this: https://github.com/botletics/SIM7000-LTE-Shield/blob/master/SIM7000%20Documentation/AT%20Command%20Logs/SIM7000_SSL_Log_3_Azure.txt but it seems that this is not MQTT connection? I also found this doc: https://www.waveshare.com/w/upload/d/d0/SIM7000_Series_MQTT_Application_Note_V1.00.pdf but I also cannot connect. Azure logs not showing any (neither successful neither failed) connection to MQTT. I would like to connect via username and password. In my opinion this set of commands should be sufficient to connect:
AT+CREG? //wait until home or roaming
AT+CNACT=1,"APN_NAME"
AT+SMCONF="URL","MY_IOT_HUB_NAME.azure-devices.net","8883"
AT+SMCONF="CLIENTID","MY_DEVICE_NAME"
AT+SMCONF="USERNAME","MY_IOT_HUB_NAME.azure-devices.net/MY_DEVICE_NAME/?api-version=2018-06-30"
AT+SMCONF="PASSWORD","SharedAccessSignature sr=MY_IOT_HUB_NAME.azure-devices.net%2Fdevices%2FMY_DEVICE_NAME&sig=VALID_TOKEN&se=1592477238"
AT+SMCONN
AT+SMPUB="devices/MY_DEVICE_NAME/messages/events/",12,1,0
12_SING_LENGHT_MESSAGE
But every time I'm sending:
AT+SMPUB="devices/MY_DEVICE_NAME/messages/events/",12,1,0
12_SING_LENGHT_MESSAGE
I got:
+CME ERROR: operation not allowed
How can I debug this?
If you want you could try this pull request which supposedly works with MQTTS.