HiveMQ

Sending MQTT messages by Arduino

I have a program sending MQTT messages to Cloud.MQTT. now I want to change it to send these messages to HiveMQ but get no connection. My access data are as follows:

// MQTT (CloudMQTT)
const char* BROKER = “ade64e41caa64820a8546270f1a7fdbc.s1.eu.hivemq.cloud”;
uint16_t BRPORT = 1883;
const char* BRUSER = “ckuehnel”;
const char* BRPWD = “Cksz0801”;
const char* CLIENTID = “ESPNOW”;

The connection is built by

void mqttconnect() {
/* Loop until reconnected */
while (!client.connected()) {
Serial.print(“MQTT connecting …”);

/* connect now */
if (client.connect(CLIENTID, BRUSER, BRPWD)) {
  Serial.println("connected");
} else {
  Serial.print("failed, status code =");
  Serial.print(client.state());
  Serial.println("   try again in 5 seconds");
  /* Wait 5 seconds before retrying */
  delay(5000);
}

}
}

Is there anything that I do not see?

Hi Claus,

Thanks for your interest in exploring HiveMQ Cloud! What I can see is that the port should be 8883.

Please let me know if that helped,
Thank you

Dasha from HiveMQ

P.S.: for a quick test I suggest using our MQTT-CLI tool, that could be quickly installed and run from a desktop.

1 Like