Trouble getting my tasmota to connect to my mosquitto mqtt broker

Hey Everyone,

I am new to mqtt and Tasmota. I have been having issues with getting the tasmota to connect to the broker, I have checked the broker isworking by using mqttx to connect to it. I keep getting this error in the tasmota console:

“16:16:50.785 MQT: Connect failed to 127.0.0.1:1883, rc -2. Retry in 110 sec”

I am using the same IP that I use on mqttx, in my tasmota. I have also allowed the broker to listen to everything by adding “Listeners 1883 0.0.0.0” in my conf file.

If anyone has any suggestion on why this isnt working that would be massively appreciated.

Thanks,
Reece.

Are you using the ip 127.0.0.1 ?

If so this is wrong. You need the IP of your broker.

1 Like

is your broker running on your Tasmota device ? That is what 127.0.0.1 means.

So I have one network connection and my tasmota and broker are on my personal machine. when using mqttx I was only able to connect using the 127.0.0.1 ip. How do I find the IP of my broker?

Tasmota is normally flashed on a ESP8266 or ESP32. How did you install that on your personal machine ?

1 Like

Sorry slight confusion I have tasmota on a ESP8266 which is connected to my personal machine.

If it helps I am also getting this error pop up on he tasmota console after a while:

“16:43:28.008 RSL: tele/tasmota_D6FD7E/STATE = {“Time”:“2024-03-14T16:43:28”,“Uptime”:“0T00:05:06”,“UptimeSec”:306,“Heap”:28,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:0,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“Clients_Moli”,“BSSId”:”,“Channel”:6,“RSSI”:32,“Signal”:-84,“LinkCount”:1,“Downtime”:“0T00:00:04”}}"

So, I don’t know what your personal machine runs, but if it is Windows, run

ipconfig

afbeelding

if linux,

ip a

afbeelding

Don’t know about MacOS

That is the normal Tasmota 5minutes status-update

image

If you installed the broker as an addon to HA. Look in settings - system - network, and at the bottom of that page you should find you ip in the network adapter section.

It will have the same ip as your HA.

That looks like the docker network, not the real IP. Docker uses 172.17.x.x. Commonly used internal networks are 10.x.x.x or 192.168.x.x

I havent installed it for HA. Also I forgot to mention I meant my personal computer at work so I will be connected to work networks.

This is a work project that doesnt involve HA. The network I have active is a network that shouldnt have anything blocked so I know it’s not related to ports needing to be opened.

Ok so how have you installed the broker?

Whatever the IP is of the machine it is running on be it windows, docker container or VM that will be the ip of your broker.

No, but you still need to add the correct broker ip to Tasmota

Looks like a windows machine. Normally, your main ip address is under Ethernet adapter Ethernet: (without number)

afbeelding

I have installed mosquitto from the web and run it in cmd on my work pc.

I have changed the ip in tasmota to my supposed broker ip but I still get this error message:

“16:58:55.052 MQT: Connect failed to 172.17.9.174:1883, rc -2. Retry in 40 sec”

That is the IP under my eternet network details, which is the same as the ip in ipconfig

I know already what the problem is : turn off Windows firewall.

My firewalls are already off