I managed to connect an ESP01 using Micropython 1.9.2 to a mosquitto broker running in my computer. I also managed to simulate a device and connect a mosquitto client from my computer to the Watson Broker. But when I try to connect the ESP directly to Watson I receive a "connection refused" message
MQTTException: 5
# Full stream answered by Watson is: b' \x02\x00\x05'
My configuration parameters are:
- WATSON_CLIENT_ID = "d:[ORG]:ESP8266:fv_esp01s_02"
- WATSON_BROKER_IP = "[ORG].messaging.internetofthings.ibmcloud.com"
- WATSON_USER = "use-token-auth"
- WATSON_PWD = b"[TOKEN]"
As I said, in Watson, I had created the defined "TLS Optional" and configured the device. I tested the connection with a mosquitto client and it worked.
Any help is more than welcomed!, Best!
I found the answer looking at the code revisions in umqtt.simple (the mqtt library for esp8266)
The answer is that in the umqtt examples there was one that uses hexlify( client_id) and I followed as standard:
Apparently mosquitto broker understand this but not the Watson IBM broker. Changing to:
solves the issue. For watson the variables format is as follows:
Pay attention to the topic/message formats as well.
Best!