Trying to setup MQTT for Tasmota "Connect failed"

First time HA user moving over from SmartThings. Trying to get my Tasmota devices working.

I am using HAOS 10.5 installed as a Synology NAS virtual machine.

I installed the Mosquitto Broker add-on. Here is the configuration:

logins:
  - username: mqtt_user
    password: right
require_certificate: false
certfile: fullchain.pem
keyfile: privkey.pem
customize:
  active: false
  folder: mosquitto

I am using Tasmota firmware 11.1.0

Here is the Tasmota Settings:

Here is the Tasmota Console output:

04:09:24.924 MQT: Attempting connection…
04:09:25.183 MQT: Connect failed to http://192.168.0.189:1883, rc -2. Retry in 20 sec

Change this:

logins:
  - username: mqtt_user
    password: right

to this:

logins: []

Go to Settings > People > Users
Create a new User account for use by your Tasmota devices.

In my case, the account is used exclusively by my Tasmota devices. I have another User account for use by other MQTT entities as well as a general purpose account I use for debugging via an MQTT client.

@123 Thank you for the suggestion.

I seem to be getting the same error.

Mosquitto Add-in Config:

logins: []
require_certificate: false
certfile: fullchain.pem
keyfile: privkey.pem
customize:
  active: false
  folder: mosquitto

User setup:

Tasmota Output:

05:02:24.178 MQT: Attempting connection…
05:02:24.595 MQT: Connect failed to http://192.168.0.189:1883, rc -2. Retry in 20 sec
05:02:45.184 MQT: Attempting connection…
05:02:45.449 MQT: Connect failed to http://192.168.0.189:1883, rc -2. Retry in 30 sec

Is there some test I can do without Tasmota so that I can isolate whether it is a Tasmota problem verses a broker problem? Or maybe there is some issue with my NAS?

Yes. Use a client like MQTT Explorer. If you can’t login with it using the account you created then you know the problem isn’t limited to the Tasmota devices.

Thank you again. I will try it.

The screenshot you posted for “User Setup” looks different from mine:

I’m using version 2023.11. Are you using version 2023.12?

Trying to understand why your screen, to create a new User, doesn’t look like mine.

That was the edit user screen not the new user screen

Here is the Mosquitto Add-in Log:

2023-12-10 20:26:13: Client <unknown> disconnected due to protocol error.
2023-12-10 20:26:14: New connection from 192.168.0.161:62169 on port 1883.
2023-12-10 20:26:14: Client <unknown> disconnected due to protocol error.
2023-12-10 20:28:01: New connection from 192.168.0.161:62191 on port 1883.
2023-12-10 20:28:01: Client mqtt-explorer-3f99eb57 disconnected, not authorised.

My edit Person screen looks like that. My edit User screen looks quite different.

Can you confirm you created a User account and not a Person account?

I didn’t know there was a difference. I will look into this.

The menu path is this:

 Settings > People > Users > Add User

Not this:

Settings > People > Add Person

I apparently there is an “advanced mode” that i had turned off. I am about to test it again.

BAM!

THANK YOU @123 !!

I will try to get Tasmota working next

Tasmota is still failing to connect. Also i am not seeing any traffic at all in the Add-on log.

I hit the max number of replies for a new user, so i guess i will just have to keep editing this post.

I am tempted to reset the Tasmota config and start over.

In 52 minutes it will let me post again and I will explain how i fixed it (spoiler: it was the http://)

Using MQTT Explorer, you have confirmed the User account you created and the MQTT Broker are functional. That’s progress.

If the Tasmota device fails to connect to the broker, to the extent the broker’s log doesn’t even have a record of the attempt, then it makes me wonder if there’s a network issue.

Confirm the Tasmota device is connected to your network (ping it).

Let’s pick this up tomorrow (when you can post again) because multiple replies within a single post isn’t practical (plus it’s past midnight here).

1 Like

It occurred to me this morning that if the Tasmota device has a network connection problem, you wouldn’t have been able to get to its web page but your screenshot above is evidence that you did. So maybe it’s not a network issue (unless, perhaps, you have the Home Assistant server and your Tasmota device on separate VLANs).

Reset the Tasmota device and re-configure it. Then observe what it reports in its console.

1 Like

I went and tried a different Tasmota device and it worked.

Then when I compared the settings on the two I found the problem:

The http:// was my careless mistake when i pasted it from my browser.

Thank you for helping me through this. When you are just starting out on a new platform with no prior experience its hard to know what part of the system to focus on when you are questioning everything. Having someone with more experience is so helpful. I will send some coffees your way.

1 Like

image

1 Like