Help with MQTT and Zigbee2mqtt...?

I’ve just moved from a much older (6 months old maybe) Home Assistant version to the latest version running on a different Pi. I’ve had to reinstall everything from scratch because my old version wouldn’t automatically update. I’m trying to setup things like I had them before.

So before I was using the Hass Mosquitto MQTT add on and Zigbee2Mqtt. This time I’m finding that Zigbee2mqtt isn’t successfully connecting to the MQTT broker. I don’t use any authentication or usernames or certificates for my clients. This is the error I get from zigbee2mqtt

zigbee2mqtt:info  2020-01-23 19:50:24: Connecting to MQTT server at mqtt://core-mosquitto:1883
events.js:187
      throw er; // Unhandled 'error' event
      ^
Error: Connection refused: Not authorized
    at MqttClient._handleConnack (/zigbee2mqtt-1.8.0/node_modules/mqtt/lib/client.js:1076:15)
    at MqttClient._handlePacket (/zigbee2mqtt-1.8.0/node_modules/mqtt/lib/client.js:365:12)
    at work (/zigbee2mqtt-1.8.0/node_modules/mqtt/lib/client.js:283:12)
    at Writable.writable._write (/zigbee2mqtt-1.8.0/node_modules/mqtt/lib/client.js:294:5)
    at doWrite (/zigbee2mqtt-1.8.0/node_modules/readable-stream/lib/_stream_writable.js:428:64)
    at writeOrBuffer (/zigbee2mqtt-1.8.0/node_modules/readable-stream/lib/_stream_writable.js:417:5)
    at Writable.write (/zigbee2mqtt-1.8.0/node_modules/readable-stream/lib/_stream_writable.js:334:11)
    at Socket.ondata (_stream_readable.js:727:22)
    at Socket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
Emitted 'error' event on MqttClient instance at:
    at MqttClient._handleConnack (/zigbee2mqtt-1.8.0/node_modules/mqtt/lib/client.js:1078:10)
    at MqttClient._handlePacket (/zigbee2mqtt-1.8.0/node_modules/mqtt/lib/client.js:365:12)
    [... lines matching original stack trace ...]
    at addChunk (_stream_readable.js:309:12) {
  code: 5
}
npm
 ERR! code ELIFECYCLE

My MQTT broker is setup like this:-

{
  "logins": [],
  "anonymous": true,
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_certificate": false
}

and in the logs for the mosquitto broker I see this:-

1579809041: Socket error on client <unknown>, disconnecting.
1579809057: New connection from 172.30.33.4 on port 1883.
1579809057: Socket error on client <unknown>, disconnecting.
1579809074: New connection from 172.30.33.4 on port 1883.
1579809074: Socket error on client <unknown>, disconnecting.
1579809087: New connection from 172.30.33.4 on port 1883.
1579809087: Socket error on client <unknown>, disconnecting.
1579809101: New connection from 172.30.33.4 on port 1883.
1579809101: Socket error on client <unknown>, disconnecting.
1579809119: New connection from 172.30.33.4 on port 1883.
1579809119: Socket error on client <unknown>, disconnecting.
1579809140: New connection from 172.30.33.4 on port 1883.
[ERROR] Auth error with my_user

any ideas?!

Thank you…

EDIT SO I realised I forgot to post my zigbee2mqtt config. That looks like this

{
  "data_path": "/share/zigbee2mqtt",
  "devices": "devices.yaml",
  "groups": "groups.yaml",
  "homeassistant": true,
  "permit_join": false,
  "mqtt": {
    "base_topic": "zigbee2mqtt",
    "server": "mqtt://core-mosquitto:1883",
    "user": "",
    "password": ""
  },
  "serial": {
    "port": "/dev/ttyACM0"
  },
  "advanced": {
    "pan_id": 6754,
    "channel": 11,
    "network_key": [
      1,
      3,
      5,
      7,
      9,
      11,
      13,
      15,
      0,
      2,
      4,
      6,
      8,
      10,
      12,
      13
    ],
    "availability_blacklist": []
  },
  "ban": [],
  "whitelist": [],
  "queue": {},
  "socat": {
    "enabled": false,
    "master": "pty,raw,echo=0,link=/dev/ttyZ2M,mode=777",
    "slave": "tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5",
    "restartdelay": 1,
    "initialdelay": 1,
    "options": "-d -d",
    "log": false
  }
}

only, I’ve removed from ‘user’ and ‘password’ any characters so they’re both blank now. Now it looks

1579810319: New connection from 172.30.33.1 on port 1883.
1579810319: New client connected from 172.30.33.1 as mqttjs_9efe0cd4 (p2, c1, k60).

and it looks like zigbee2mqtt is now talking to to the built in broker…no other clients currently connecting/connected though…weird

Ah, looks like the MQTT broker errors were due to 5.1 messing up anonymous/no user connections. I tried messing about with the acl.conf and accesscontrollist files but nothing worked despite trying lots of tips, so in the end I’ve restored to mosquitto addon v2 from an old snapshot. I was running v3 so at some point I’ll restore to that. I couldn’t see any definitive answers re: how to return to a truly simple anonymous login setup, just post after post of people reporting problems.
Anyway after deleting the contents of the customize folders I’m finally back in business with no more socket errors.