Issue with setting Version 5 for retention on devices

Hi everyone, I seem to be going around in circles with this one, so any help would be appreciated.
Current set up is Intel NUC running Hassio, with cc2531 stick. Have been running for a couple of months with only a few hiccups.
I’m trying to add retention times to a couple of motion sensors in my devices.yaml, and reading the documentation I can see that I have to change the MQTT configuration to include ‘version: 5’ to allow that to work.
So, I’ve made the appropriate changes, saved and restarted, but it fails to start, with the following message :

npm
 ERR! code ELIFECYCLE
npm ERR! errno 1
 npm 
ERR! zigbee2mqtt@1.14.3 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zigbee2mqtt@1.14.3 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-08-18T09_12_33_300Z-debug.log
2020-08-18T10:12:35: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
2020-08-18T10:12:35: PM2 log: App [npm:0] starting in -fork mode-
2020-08-18T10:12:35: PM2 log: App [npm:0] online
> zigbee2mqtt@1.14.3 start /zigbee2mqtt-1.14.3
> node index.js
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            READ THIS CAREFULLY
Refusing to start because configuration is not valid, found the following errors:
- MQTT retention requires protocol version 5
If you don't know how to solve this, read https://www.zigbee2mqtt.io/information/configuration.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

So, I checked the zigbee2mqtt configuration.yaml and the “version: 5” addition that I originally typed into the web based config has not been included.

Obviously, removing the retention option from the devices.yaml and then restarting the service causes no issues.

Here’s my config :

data_path: /share/zigbee2mqtt
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://core-mosquitto'
  user: intentionallyblank
  password: intentionallyblank
  version: 5
  include_device_information: true
serial:
  port: >-
    /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B00xxxxxxx-xxxx
advanced:
  pan_id: 6754
  channel: 15
  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

Has anybody seen this before? Am I making a schoolboy error?

As I am currently closely monitoring my setup, it was easy to test this. I have no problem with mqtt.version 5 and a device with retention: 900.

Interesting to see the socat option. It is not in the documented configuration.yaml.

You use the Home Assistant OS mosquitto add-on. That one does not support mqtt protocol 5.

Ok, I didn’t spot that in the documentation. Time to roll the sleeves up and get on with installing the agnostic version, thanks.

Ok, went ahead and installed the latest version of mosquitto on a rpi4, running ubuntu 20.04 server.
I rerouted all my messages to that broker, and confirmed using MQTT Explorer that everything was working. I turned off the message broker in the docker container on the Home Assistant host machine, uninstalled it, then rebooted the machine.

I then amended the zigbee2mqtt devices.yaml so one device had a retention of 2, and then edited the zigbee2mqtt configuration.mqtt section and added version: 5. Restarted zigbee2mqtt, and I’m still getting the same error.

So, a bit stumped.

Just in case anyone else ends up reading this and is stuck, you need to set the version in the config because the default protocol version is 4. See docs.

version: 5

I also had to update my mqtt broker to get that to work with 5.