MQTT failing to connect rc-2

2,295 views
Skip to first unread message

Bourne ToRide

unread,
May 25, 2022, 10:22:05 AM5/25/22
to TasmotaUsers
This error must have been seen 100's of times but I have found no answer
00:47:27.122 MQT: Attempting connection...
00:47:27.139 MQT: Connect failed to 192.168.1.1:1883, rc -2. Retry in 120 sec

Currently running MQTT on my router running openWRT V21.02 (BT HomeHub5) 

There is no network problem because it talks to my devices (x2)

AP1 SSId (RSSI)
TALKTALK661724 (100%, -45 dBm) 11n
Hostname
BBQ32-4876
MAC Address
7C:DF:A1:86:93:0C
IP Address (wifi)
192.168.1.161
Gateway
192.168.1.1
Subnet Mask
255.255.255.0
DNS Server1
192.168.1.1
DNS Server2
0.0.0.0

 
HTTP API
Enabled

 
MQTT Host
192.168.1.1
MQTT Port
1883
MQTT TLS
Disabled
MQTT User
DVES_USER
MQTT Client
DVES_86930C
MQTT Topic
BBQ32
MQTT Group Topic 1
cmnd/tasmotas/
MQTT Full Topic
cmnd/BBQ32/
MQTT Fallback Topic
cmnd/DVES_86930C_fb/
MQTT No Retain
Disabled

MQTT worked several years ago when I had V8.5 but now I am running ESP-C3 thats not an option, I am working towards installing HA on a laptop but need to get MQTT working first

Philip Knowles

unread,
May 25, 2022, 11:16:29 AM5/25/22
to Bourne ToRide, TasmotaUsers

Are the Client and Topic different?

 

Regards

 

Phil K

 

Sent from Mail for Windows

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/cece0802-7aa3-4e06-85c9-88384ff02c87n%40googlegroups.com.

 

Philip Knowles

unread,
May 25, 2022, 11:26:40 AM5/25/22
to Bourne ToRide, TasmotaUsers

Sorry found the details further down.

Error code rc-2 is caused by a network error between the device and MQTT broker. It could be a password error, 2 clients with the same name or a timing error

 

Sent from Mail for Windows

 

From: 'Bourne ToRide' via TasmotaUsers
Sent: 25 May 2022 15:22
To: TasmotaUsers
Subject: MQTT failing to connect rc-2

 

This error must have been seen 100's of times but I have found no answer

--

Mark Abraham

unread,
Jun 23, 2022, 11:28:42 AM6/23/22
to TasmotaUsers
I have the same issue. I have two s26 plugs. One on 8.5.1 and the other on 12.0.2

I can't get either of them to connect to mosquitto and have been pulling my hair out trying to work out why. The first has rc 2 and the other has rc 5.

I,ve put the same password that is in the node red node so should work. Tasmota password field changes it to 4 characters when its saved which I thought odd. 

Did you find a solution?

Thanks, mark

Philip Knowles

unread,
Jun 23, 2022, 11:36:22 AM6/23/22
to Mark Abraham, TasmotaUsers

Is it rc -5 or rc 5 there’s a difference (same for 2)

 

Code

Constant name

Description

-5

MQTT_DNS_DISCONNECTED

the DNS server cannot be reached or name cannot be resolved

-4

MQTT_CONNECTION_TIMEOUT

the server didn't respond within the keepalive time

-3

MQTT_CONNECTION_LOST

the network connection was broken

-2

MQTT_CONNECT_FAILED

the network connection failed

-1

MQTT_DISCONNECTED

the client is disconnected cleanly

0

MQTT_CONNECTED

the client is connected

1

MQTT_CONNECT_BAD_PROTOCOL

the server doesn't support the requested version of MQTT

2

MQTT_CONNECT_BAD_CLIENT_ID

the server rejected the client identifier

3

MQTT_CONNECT_UNAVAILABLE

the server was unable to accept the connection

4

MQTT_CONNECT_BAD_CREDENTIALS

the username/password were rejected

5

MQTT_CONNECT_UNAUTHORIZED

the client was not authorized to connect

 

 

Sent from Mail for Windows

 

Mark Abraham

unread,
Jun 23, 2022, 11:44:56 AM6/23/22
to TasmotaUsers
Ah sorry its rc -5 and rc -2.

Mark Abraham

unread,
Jun 23, 2022, 11:53:03 AM6/23/22
to TasmotaUsers
Okay thanks. So I'm guessing rc -2 and rc-5 means that mosquitto isn't accepting outside connections from the same lan? 

Bourne ToRide

unread,
Jul 19, 2022, 4:46:14 PM7/19/22
to TasmotaUsers
only fails when I put ip address in host field of MQTT , then rc -2.    
MQTT  installed on my OpenWRT router, tried all sorts to prevent outside connections from same LAN being dropped, even tried a firewall rule to send all port 1883 traffic to 192.168.1.1


Philip Knowles

unread,
Jul 19, 2022, 5:08:43 PM7/19/22
to Bourne ToRide, TasmotaUsers

Can you share a screenshot of the MQTT configuration page?

Bourne ToRide

unread,
Jul 20, 2022, 1:06:34 PM7/20/22
to TasmotaUsers
 17:03:25.804 MQT: Attempting connection...
17:03:25.820 MQT: Connect failed to 192.168.1.1:1883, rc -2. Retry in 120 sec

Bourne ToRide

unread,
Jul 20, 2022, 1:40:39 PM7/20/22
to TasmotaUsers
Just changed ip address to   test.mosquitto.org  and that worked so it is a MQTT server problem


On Tuesday, 19 July 2022 at 22:08:43 UTC+1 knowles...@gmail.com wrote:

Philip Knowles

unread,
Jul 20, 2022, 1:46:24 PM7/20/22
to Bourne ToRide, TasmotaUsers

I meant the configuration page with the addresses and topics etc

billy jack newman

unread,
Jul 20, 2022, 2:01:53 PM7/20/22
to Bourne ToRide, TasmotaUsers
Your ip address ending in 1.1 is generally your router ip, make sure you have correct ip address for the device that had mqtt server installed on

Philip Knowles

unread,
Jul 20, 2022, 5:12:00 PM7/20/22
to billy jack newman, Bourne ToRide, TasmotaUsers

OP said was installed on his openWRT modem

 

Sent from Mail for Windows

 

billy jack newman

unread,
Jul 21, 2022, 12:13:13 AM7/21/22
to Philip Knowles, Bourne ToRide, TasmotaUsers
Oh, I missed that sorry 

Marcos HIDO

unread,
Aug 28, 2022, 6:03:19 AM8/28/22
to TasmotaUsers
Hi, I have tha same scenario. Openwrt as router, Mosquitto broker inside router in IP ..1.  Hi have more than 40 tasmoted devices, and several giving me this same error.rc-2 with continous disconnections.  There are some news ?

Marcos HIDO

unread,
Aug 28, 2022, 6:09:37 AM8/28/22
to TasmotaUsers
I can provide some more information.
If I connect some devecie to the broker in Hassio, (IP....121)  the devices atill  giving the same problem of disconnection rc -2
In log mosquitto Hassio, I receive this msgs as spam hundred times... " error: received null username, clientid or topic, or access is equal or less than 0 for acl check", devices connect to the server mqtt, but each 2 or 5 minutes they disconnect and again rc -2 and connection tries

Philip Knowles

unread,
Aug 28, 2022, 8:31:42 AM8/28/22
to Marcos HIDO, TasmotaUsers

Check the maximum number of devices – many routers limit to 32 – and rc-2 is a network connection issue

 

Sent from Mail for Windows

 

Marcos HIDO

unread,
Aug 28, 2022, 12:47:46 PM8/28/22
to TasmotaUsers
even openwrt have too much space an recurses, as i explained i tested with broker HA and only two devices tasmota, and same error..

Philip Knowles

unread,
Aug 28, 2022, 3:23:16 PM8/28/22
to Marcos HIDO, TasmotaUsers

Without more information (such as a screenshot of the MQTT configuration page, router wifi logs, tasmota console log, the total number of devices – not just Tasmota ones - and the chipset of the modem – the ath10k-ct driver limits to 32 devices) it is impossible to guess what is causing your network connection error

 

Sent from Mail for Windows

 

To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers..@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.

--

You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.

Bourne ToRide

unread,
Oct 12, 2022, 12:10:15 PM10/12/22
to TasmotaUsers
Finally fixed my MQTT on Openwrt issues
rc-2 network connection error is not always a network error, it could be that MQTT is not running for some reason. Its pretty obvious that the network is OK because you have a working Tasmota device.
Try setting logging to syslog in your MQTT config, then Status > System Log will give you lots of useful info :- like MQTT doesn't run with  "Use this LuCI configuration page" unticked if the path to your config file is not correct
rc-5 authentication error will happen if you create a plain text password file without using the provided, Putty need to run that.

Philip Knowles

unread,
Oct 12, 2022, 2:12:07 PM10/12/22
to Bourne ToRide, TasmotaUsers

Sorry, but a network connection error doesn’t mean that the network isn’t working but that device cannot connect to the broker over the network so the broker not running, etc would come into that category. The point is that it wasn’t a Tasmota issue but a network issue.

Reply all
Reply to author
Forward
0 new messages