MQTT error: connect ECONNREFUSED 127.0.0.1:1883

@Fergus_Pingo I think you need to define a user and a password for Mosquitto and in the config of Zigbee2Mqtt addon, you add that user so that it can connect with the broker:

My Mosquitto config:

Corresponding config in Zigbee2MQTT (I have also shown the config of the dongle as I have exactly the same - you can find it in the Hardware section how it is called in your case):

1 Like

That log is nothing to be concerned about, just supervisor checking if the add-on is still alive. But you should not use An IP-address in the Zigbee2mqtt configuration in that case.

1 Like

Dear Rene,

Thank you for your response and screen shot. If I remember for my house install I chose different user and passwords for mqtt and mosquito, however for the work install I think I kept the same ( and I only have one listing in my password manager) So I can not directly screenshot my house config files and repeat it at work.

Now this is what my Zigbee2MQTT looks like now…


I have not changed the Serial Port to the text that shown for your dongle yet. I had a suspicion that the ttyUSB0 was the correct port where the dongle is plugged in and that is why a year ago I put that text there.

Now for the Mosquitto Config


I followed through the instructions about the Failed to save message and read the Documentation tab and there may be stuff missing - I cut and paste the recommended configuration entry below

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

Is this what mine should look like?

Thanks again, Fergus

It’s telling you that you gave it an invalid list because you didn’t specify the username and password as a list (you’re missing a -).

Try this:

- username: mqtt_user
  password: dregU

Thank you ShadowFist - looking better

Mosquitto broker I think is now going - green dot in top right of screen

However do these log files look OK?

I have restarted home assistant and am now getting the following message when I try to restart MQTT

image

Red dot in the top right of MQTT screen and these log files

Thanks again to all for assistance - Fergus

Check your Z2MQTT settings. Something tells me you only added a single / after mqtt:// , but I can’t confirm because you blacked it out. See this post above.

Also, make sure you restart the Z2MQTT addon after any changes, and double check that it’s pointing to your MQTT broker correctly (should be your HA IP address:1883, or 192.168.1.102:1883)

Thank you Shadow Fist - I have done a HA restart

Mosquitto broker seems running - green dot top right

These are the log files on Mosquitto

The New Connection and Client lines keep repeating for say 50 times then at the bottom we have

However does the green dot indicate Mosquito is running fine.

Now on to MQTT itself - this is not running. I checked for the two forward slashes as you mentioned and this looks OK. Here is the config without any redacting.

and here is the log file

thanks again for commenting on this installation - Fergus

try:

server: mqtt://core-mosquitto:8123
1 Like

Dear Francis

Yipee - I think you have done it. So many thanks.

Both Mosquitto broker and Zigbee2MQTT both seem to be running now fine - thanks Green dot in top right.

last 2 lines of log file from Zigbee2MQTT showing the following

Zigbee2MQTT:info 2024-03-20 10:25:33: MQTT publish: topic ‘zigbee2mqtt/bridge/state’, payload ‘{“state”:“online”}’
Zigbee2MQTT:info 2024-03-20 10:25:33: Zigbee2MQTT started!

Looking at the Entities the top 3 are “Disabled by - Integration” is this usual?

I have just done a full back up as well as my automated regular back up every 3 days

regs Fergus

1 Like

It is normal, but I have enabled them. (except the network map)

1 Like

Fine - got that.

Once again - many thanks - is it good practice to now edit the title of this thread to [SOLVED] MQTT error: connect ECONNREFUSED or just leave it for others to browse through?

regs Fergus

Yeah! mark it as solved. Great you got it working!