Can't connect to mqtt

Hi from tomorrow evening I have such problem. On this hardware Blynk works and connects fine. What can be wrong?

[1012] Initializing modem
[1023] Waiting for network
[1027] Connecting to GPRS
[8114] Connected to GPRS
[8119] IP: 10.72.72.102
[8119] Connecting to mqtt.mydevices.com:1883
[39984] MQTT connect failed, error -1

can you try adding a new device to your cayenne dashboard and use the new MQTT client id in the code.

same problem with new device

which device are you using? and can you share the code you are using?

Mapple mini

/*
This example shows how to connect to Cayenne using a GSM device and send/receive sample data.

The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:
1. Install the TinyGSM library (https://github.com/vshymanskyy/TinyGSM) from the Arduino Library Manager.
2. Set the Cayenne authentication info to match the authentication info from the Dashboard.
3. Uncomment the correct GSM modem type and set the GSM connection info, if needed.
4. Compile and upload the sketch.
5. A temporary widget will be automatically generated in the Cayenne Dashboard. To make the widget permanent click the plus sign on the widget.
*/

//#define CAYENNE_DEBUG       // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space

// Uncomment your modem type:
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590
// #define TINY_GSM_MODEM_ESP8266
// #define TINY_GSM_MODEM_XBEE

#include <CayenneMQTTGSM.h>
#include <OneWireSTM.h>
#include <EEPROM.h>

// This sketch uses a software serial connection.
//#include <SoftwareSerial.h>
//SoftwareSerial gsmSerial(2, 3); // RX, TX
// If you are using a device that supports a hardware serial (Mega, Leonardo, etc.) and prefer to use
// that you can comment out the above lines and uncomment the one below.
#define gsmSerial Serial1

//ST_CP 74HC595
#define latchPin PC14
//SH_CP 74HC595
#define clockPin PC15
//DS 74HC595
#define dataPin PC13



// GSM connection info.
char apn[] = "internet"; // Access point name. Leave empty if it is not needed.
char gprsLogin[] = ""; // GPRS username. Leave empty if it is not needed.
char gprsPassword[] = ""; // GPRS password. Leave empty if it is not needed.
char pin[] = ""; // SIM pin number. Leave empty if it is not needed.

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "";
char password[] = "";
char clientID[] = "";

unsigned long lastMillis=0;
OneWire  ds(PA0);  //  (a 4.7K resistor is necessary)
byte dsAdr[6]={0,0,0,0,0,0};
unsigned char dsAdrIndx=0;

uint16 dataWrite = 0xAA;
uint16 dataRead = 0xAA;
uint16 addressWrite = 0x10;

uint16 temp=0;

struct secureSwitchData
{
  unsigned char pre=0xAA;
  unsigned char state=0;
  int voltage[3];
  int current[3];
  float temperature[3][6];
  int relays[3][3] = {{0, 0, 0},{0, 0, 0},{0, 0, 0}};
};

secureSwitchData sSD;

void setup() {
	Serial.begin(9600);
	// Auto-detect the GSM serial baud rate. You can manually set it instead if you want to save a bit of space.
	TinyGsmAutoBaud(gsmSerial);
	Cayenne.begin(username, password, clientID, gsmSerial, apn, gprsLogin, gprsPassword, pin);

  STR();

  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);

  
  Cayenne.virtualWrite(5, sSD.relays[0][0]&(1<<0));
  delay(500);
  Cayenne.virtualWrite(6, sSD.relays[0][0]&(1<<1));
  delay(500);
  Cayenne.virtualWrite(7, sSD.relays[0][0]&(1<<2));
  delay(500);
  Cayenne.virtualWrite(8, sSD.relays[0][0]&(1<<3));
  delay(500);
  Cayenne.virtualWrite(9, sSD.relays[0][0]&(1<<4));
  delay(500);
  
  Cayenne.virtualWrite(15, sSD.relays[0][1]&(1<<0));
  delay(500);
  Cayenne.virtualWrite(16, sSD.relays[0][1]&(1<<1));
  delay(500);
  Cayenne.virtualWrite(17, sSD.relays[0][1]&(1<<2));
  delay(500);
  Cayenne.virtualWrite(18, sSD.relays[0][1]&(1<<3));
  delay(500);
  Cayenne.virtualWrite(19, sSD.relays[0][1]&(1<<4));
  delay(500);

  Cayenne.virtualWrite(25, sSD.relays[0][2]&(1<<0));
  delay(500);
  Cayenne.virtualWrite(26, sSD.relays[0][2]&(1<<1));
  delay(500);
  Cayenne.virtualWrite(27, sSD.relays[0][2]&(1<<2));
  delay(500);
  Cayenne.virtualWrite(28, sSD.relays[0][2]&(1<<3));
  delay(500);
  Cayenne.virtualWrite(29, sSD.relays[0][2]&(1<<4));
  delay(500);

  PUSH_SHIFT_REGS (sSD.relays[0][0]|(sSD.relays[0][1]<<5)|(sSD.relays[0][2]<<10));
  
  Serial.println("sSD.relays start");
  Serial.println(sSD.relays[0][0],BIN);
  Serial.println(sSD.relays[0][1],BIN);
  Serial.println(sSD.relays[0][2],BIN);
}
char username[] = "";
char password[] = "";
char clientID[] = ""; I deleted this values

https://www.sparkfun.com/products/retired/11280 is it this product?

yes

does it contain GSM?

No damn it’s waiting for when Elon Musk make a free satelite ineternet over the world… Can you stop to ask stupid question with obvious
answers ??.. Device is workable, it still work with Blynk but in Cayenne I get this errors over two past days

Maybe ask Elon Musk only then if you cannot answer to the question i ask. As, in the link i shared above there is mention of GSM (maybe i missing something). it is just an 32-bit ARM development board.

But in code (if you actualy read ) you can see:
// Uncomment your modem type:
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590
// #define TINY_GSM_MODEM_ESP8266
// #define TINY_GSM_MODEM_XBEE

Upload this code https://github.com/vshymanskyy/TinyGSM/blob/master/examples/MqttClient/MqttClient.ino and see if you get connected to MQTT broker.

What does “MQTT connect failed, error -1” realy means? I can’t find any error code descriptions.

here you can find https://www.hivemq.com/blog/mqtt-essentials-part-3-client-broker-connection-establishment/

So if “1 Connection refused, unacceptable protocol version” may be you updated protocol couple days ago?

there were no recent update. Did the tiny gsm code worked?

I will try soon

Why you gave me a third-party connected sketch const “char* broker = “broker.hivemq.com”;” now I need to register at that sevice too?

that is because cayenne GSM code and wanted to confirm whether it is not an issue with the library itself or the device.