Reputation: 161
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:
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!
Upvotes: 0
Views: 569
Reputation: 161
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:
client = MQTTClient(client_id=hexlify(MQTT_CLIENT_ID), server=MQTT_BROKER_IP, user=MQTT_USER, password=MQTT_PWD)
Apparently mosquitto broker understand this but not the Watson IBM broker. Changing to:
client = MQTTClient(client_id=MQTT_CLIENT_ID, server=MQTT_BROKER_IP, user=MQTT_USER, password=MQTT_PWD)
solves the issue. For watson the variables format is as follows:
Pay attention to the topic/message formats as well.
Best!
Upvotes: 3