Error: MQTT_CLIENT: MQTT connect failed

nirmeshru
Posts: 13
Joined: Sat Jan 30, 2021 7:08 pm

Error: MQTT_CLIENT: MQTT connect failed

Postby nirmeshru » Mon Feb 28, 2022 6:28 am

Hi,
I am trying the switch example on the custom ESP32 board and getting the below error.

E (783471) MQTT_CLIENT: mqtt_message_receive: transport_read() error: errno=119
E (783471) esp_mqtt_glue: MQTT_EVENT_ERROR
E (783471) MQTT_CLIENT: esp_mqtt_connect: mqtt_message_receive() returned -1
E (783481) MQTT_CLIENT: MQTT connect failed
W (783491) esp_mqtt_glue: MQTT Disconnected. Will try reconnecting in a while...


actually, the switch example was working fine some time back but now it is showing this error. I tried this example on some other esp32 board but it is reporting the same issue.
I am using the esp idf 4.4 version.

any idea, how can I approach to resolve this issue?

Thanks,
Nirmesh

ESP_Piyush
Posts: 310
Joined: Wed Feb 20, 2019 7:02 am

Re: Error: MQTT_CLIENT: MQTT connect failed

Postby ESP_Piyush » Mon Feb 28, 2022 7:04 am

Can you tell us whether you used CLI based claiming for this or assisted claiming, or whether you have used both on the same board at different points of time? Are the same credentials mistakenly used elsewhere on an active device?

nirmeshru
Posts: 13
Joined: Sat Jan 30, 2021 7:08 pm

Re: Error: MQTT_CLIENT: MQTT connect failed

Postby nirmeshru » Mon Feb 28, 2022 8:39 am

I was testing Arduino-esp32 example RMakerSwitch.ino on the same ESP32 board and it works.
so after that, whenever I am using esp rainmaker switch example or my own switch code on the same ESP32 board then getting this error message.

nirmeshru
Posts: 13
Joined: Sat Jan 30, 2021 7:08 pm

Re: Error: MQTT_CLIENT: MQTT connect failed

Postby nirmeshru » Mon Feb 28, 2022 11:31 am

i erased flash and uploaded the switch example program. now it is working fine.

djorr5
Posts: 16
Joined: Fri Nov 17, 2023 4:12 am

Re: Error: MQTT_CLIENT: MQTT connect failed

Postby djorr5 » Wed Sep 04, 2024 5:11 am

ESP_Piyush wrote:
Mon Feb 28, 2022 7:04 am
Can you tell us whether you used CLI based claiming for this or assisted claiming, or whether you have used both on the same board at different points of time? Are the same credentials mistakenly used elsewhere on an active device?
Sorry to bring up an old thread but I am having a similar issue with my board and noticed your comment. I have been playing around with both types of claiming (self and assisted claiming.) And I have noticed that the connection to the rainmaker backend via MQTT is very unstable. Why did you raise this concern? Is there something that can happen if you use both types of claiming? And if I have used both types on one board is there a resolution?

FYI I remove the nodes from the dashboard when I wipe the board and I always "erase-flash flash monitor". But I keep getting getting offline/online messages in my app constantly throughout the day.

ESP_Piyush
Posts: 310
Joined: Wed Feb 20, 2019 7:02 am

Re: Error: MQTT_CLIENT: MQTT connect failed

Postby ESP_Piyush » Wed Sep 04, 2024 1:33 pm

In the original issue, the node was unable to connect, hence the question regarding claiming. If you use host driven claiming, followed by assisted claiming and then again followed by host driven claiming, it is possible that a stale certificate gets written to the device, which will never be able to connect. Switching between self/assisted claiming does not cause any issues though.

Frequent disconnects and reconnects can typically happen due to network issues wherein either the MQTT PING request or PING response failed, causing a disconnect and a reconnect.

Who is online

Users browsing this forum: No registered users and 25 guests