Electric imp to Azure IoT hub fail to connect

While doing the Azure IoT example (https://github.com/electricimp/AzureIoTHub/tree/master/examples)
and running the sample program this is what the log window is showing:

|2018-12-18 20:41:15 -07:00|[Status]|Agent restarted: after delay.|
|2018-12-18 20:41:15 -07:00|[Agent]|ERROR: the index ‘mqtt’ does not exist|
|2018-12-18 20:41:15 -07:00|[Agent]|ERROR: in constructor …zureiothub.agent.lib.nut#4.0.0:721|
|2018-12-18 20:41:15 -07:00|[Agent]|ERROR: from constructor agent_code:40|
|2018-12-18 20:41:15 -07:00|[Agent]|ERROR: from main agent_code:110|

Does anybody help me to pinpoint where is the issue??
I have being reading about this subject and the only thing that I found is something
similar related to the AMQP issue, same issue related to Azure lib nut 4.0.0 ??

Any help will be appreciated !

As stated in the library documentation but not in the repo (sorry! we’ll fix this), you need to contact us to get MQTT enabled for your device. Just visit this site to sign up.

Thanks Smitty for your prompt response,
It might be nice if you put a note on the example (GITHUB & ELECTRIC IMP WEB)
stating exactly what you are telling me here.
this will end the frustrations from a lot of guys trying to follow the Azure IoT example.
On the other is there any point of contact to provide me with guidelines so I can continue with
my prototype ?
PD: by the way I already sign in into the Azure IoT electric Imp site.

Is it possible to get access to the MQTT library without using Azure at all? (I have no interest, no need and no desire to use Azure services. I already have my own MQTT broker.)

You can use MQTT without Azure — it is implemented not as a library but in the imp API — however you’ll still need to sign up (see my previous message) so we can match your device’s agent to the MQTT development server.

Sign up with Azure or signup with an impcentral dev account (which I already have?)

Your impcentral login is what the form here requires: https://connect.electricimp.com/azure-mqtt-integration-signup

Thanks! (already submitted and replied to the email to get some device id’s enlisted)

Could you share some details about what broker you’re using? We might want to add it to our test environment.

I am using a clustered HA configured rabbitmq with the mqtt plugin. I have put the mqtt traffic in to its own vhost. It is externally visible via a set of haproxy reverse proxies with various firewall and auth rules to provide safety and throttling in case of bad actors.

One problem is that internally it uses its own CA for ssl (I was not able to get haproxy to provide SSL termination for a tcp connection (vs a http connection) so there might be an issue with an unknown CA being used for the SSL connection.

I do have a bunch of other services on various different cloud providers with stable MQTT sessions to this broker (but in all those cases I am able to provide the CA to trust so SSL validates fine.)

It is MQT3.1.1 compliant according to their documentation at least.


After some helpful debugging I got the mqtt class to work (with my ssl mqtt broker talking through a ssl termination haproxy)… but when I went back to it today to finish up the receiving end of the messages being posted it can no longer connect.

Checked all the problems that were fixed before and they are still fixed… and it is even worse in that this specific agent can no longer make web requests out to my web server either. It is like something between the agent and making calls outside have failed (although calls to the https service that the agent is offering still work)

Very puzzling.

The imp itself can talk to the agent code… and other agents I have can make HTTPS POST calls to the same web service that this agent can not.

The error code attempting to connect to the mqtt broker is just ‘-1’:
ERROR: Failed to connect to ssl://rabbitmq.apricot.com:8883 Result code: -1

and the error code from the HTTPS POST is “7” … if I log a jsonencode of the responsetable in the async callback for the HTTPS POST this is what it has:
2019-01-09 18:18:06 -08:00 [Agent] web page error response: { “headers”: { }, “rawheaders”: [ ], “statuscode”: 7, “body”: “” }


Yes we were having some outbound network connectivity issues yesterday which affected http and mqtt, They should now be resolved.



Ah, cool. it is all working again I see. B-)