MQTT retention requires protocol version 5 (Zigbee2MQTT error)

Morning all,

Woke up to a dead zigbee network this morning. Z2M log says:

09:02:56] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start
> 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/guide/configuration
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Tried to google. Found only this old thread (Issue with setting Version 5 for retention on devices - #3 by francisp - General support - Zigbee2mqtt) in which it is stated that the HA Mosquito add-in doesn’t support version 5.

a) Is this true, even after 1.5 years, and do I therefore need to install a separate MQTT broker?
b) If not, are there any config adjustments needed?

I could not find a relevant git issue in any of the related repos, nor indeed any reference to this error on the forum and (except for the above), on the wider web.

Nothing unusual in HA log except the understandable lack of a z2m instance:

Logger: homeassistant.components.hassio
Source: components/hassio/websocket_api.py:120
Integration: Home Assistant Supervisor (documentation, issues)
First occurred: 07:30:27 (2 occurrences)
Last logged: 07:30:40

Failed to to call /addons/45df7312_zigbee2mqtt/stats - Container addon_45df7312_zigbee2mqtt is not running
Failed to to call /addons/45df7312_zigbee2mqtt/stats -

HA has been on 2022.4.7 for several days with no problems.
Mosquitto broker (6.0.2)
Zigbee2mqtt (1.25.1-1)

To my knowledge I haven’t made any sigificant config changes affecting these add-ons - but I was messing around updating HACS stuff last night. Seems unrelated…

EDIT: I did add a new TS0601 to the network last night, but it was already configured (I just re-powered the device, which had been battery-less for several months). It worked, so I don’t think this is relevant either.

Thanks in advance for any help and/or ideas!

To narrow the error down a bit: Zigbee2mqtt 1.25.1 was just released yesterday. Obviously it was automatically updated to the latest version on your HA installation.

Well, that’s news indeed. Thanks - now I know where to look and can stop “digging”. Very helpful!

Maybe just set:

  # use the 'retention' device specific configuration
  version: 5

as described here?

Hi again,

I failed to mention in my OP that I did try that in Z2M configuration.yaml - with no change to the error:

mqtt:
  base_topic: zigbee2mqtt
  user: ************
  password: ************
  version: 5

For the record: I tried to roll my instance back (using Google Drive Backups, partial restore) to the previous Z2M version (1.25.0-1). After a heart-stopping moment in which I thought I’d glarched my whole setup (config.yaml not found), I managed a stable roll-back. But the Z2M integration did not load, and the same error showed up in the logs.

There has been a change where Z2M stores the config. I read about it lately and changed my config accordingly. Unfortunately I can not recall the issue page/HA thread where I have read it.

Basically what is left within the config at the Z2M Add-On page here is:

data_path: /share/zigbee2mqtt
socat:
  enabled: false
  master: >-
    pty,raw,echo=0,link=/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: '-d -d'
  log: false
mqtt:
  server: mqtt://192.168.xxx.xxx:1883
serial:
  port: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

All other config variables go directly into /usr/share/hassio/share/zigbee2mqtt/configuration.yaml:

{
  "external_converters": [],
  "devices": [
    "devices.yaml"
  ],
  "groups": [
    "groups.yaml"
  ],
  "homeassistant": true,
  "permit_join": false,
  "mqtt": {
    "base_topic": "zigbee2mqtt",
    "server": "mqtt://192.168.xxx.xxx:1883",
    "user": "xxxxxxxxxxxxxx",
    "password": "xxxxxxxxxxxxx"
  },
  "serial": {
    "port": "/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0"
  },
  "advanced": {
    "log_level": "info",
    "pan_id": 6754,
    "channel": 11,
    "network_key": [
      1,
      3,
      5,
      7,
      9,
      11,
      13,
      15,
      0,
      2,
      4,
      6,
      8,
      10,
      12,
      13
    ],
    "availability_blocklist": [],
    "availability_passlist": [],
    "last_seen": "ISO_8601_local"
  },
  "device_options": {},
  "blocklist": [],
  "passlist": [],
  "queue": {},
  "frontend": {
    "port": 8099
  },
  "experimental": {
    "transmit_power": 10
  },
  "availability": false
}

Addendum:
Here it is, more info here:

  • Updated Zigbee2MQTT to version 1.25.0
  • :warning: Breaking changes
    • Most Zigbee2MQTT configuration is now done in Zigbee2MQTT directly
      (either via the UI or by modifying the configuration file, usually
      /config/zigbee2mqtt/configuration.yaml, directly).As Zigbee2MQTT won’t start with an MQTT server
      or serial adapter
      you must configure these through the add-on configuration page before you
      can start Zigbee2MQTT for the first time.Existing installations should be able to safely remove the Zigbee2MQTT
      configuration from the add-on configuration as these values should have
      already been persisted to the configuration file.
1 Like

Wow.

I actually read about this BC during my morning google/troubleshoot, but couldn’t make head or tail of what I should actually DO with the information. Nor could I determine if it is linked to the protocol version issue which I reported. My conclusion was that it was unrelated.

I just adjusted my config as per the (very useful) thread/links you sent. And guess what? It’s up again. Houston, we have Zigbee. Again!

Thank you so much for helping me today!

1 Like

I’m a HA newbie, can someone explain to me what I need to do to make it working again for this error?

Your error? Have it worked? Your system, haos or? Have MQTT ever worked?

I uninstalled/reinstalled.
Went to /config/zigbee2mqtt/configuration.yaml
added “version: 5” under MQTT tab.
works now

3 Likes

Weird, as that didn’t work for me. :man_shrugging:

I have an existing Zigbee2MQTT setup. After recent Z2M update 1.26.0-1 mine failed with the MQTT retention requires protocol version 5 error.
I studied this and other threads on the error. With my existing installation, but was confused on which yaml code to edit. I had to edit the yaml using file editor from the HA sidebar menu, Not the yaml within Zigbee2MQTT configuration.

Used HA file editor (or other editor), navigated to /config/zigbee2mqtt/configuration.yaml and added a line of text “version: 5” to my existing config file under MQTT .

/config/zigbee2mqtt/configuration.yaml

homeassistant: true
mqtt:
  server: mqtt://core-mosquitto:1883
  user: addons
  password: aedaezopaif0o3didkow7fm1YaeGh9iieSh8ziiph0oashiep0Aomooz1cheeH
  version: 5    <---------
serial:
  port: >-
    /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_fcc9e82b0b86ec118ab1631719c2d21c-if00-port0
frontend:
  port: 8099
advanced:
  homeassistant_legacy_entity_attributes: false
  legacy_api: false
  legacy_availability_payload: false
  log_syslog:
    app_name: Zigbee2MQTT
    eol: /n
    host: localhost
    localhost: localhost
    path: /dev/log
    pid: process.pid
    port: 123
    protocol: tcp4
    type: '5424'
  transmit_power: 12
  channel: 25
  last_seen: ISO_8601_local
  network_key:
    - 97
    - 142
    - 35
    - 233
    - 190
    - 118
    - 46
trimmed
8 Likes

I had the same error message and adding “version: 5” to the yaml solved my issue instantly. Thanks a million!

+1 same error after upgrade today. setting version in UI does NOT correct the config file.

Edit the file by hand (it had a value, but was set to 4) changed to 5, and it starts correctly.

Breaking changes, oh the fun.

Yesterday this issue happened to me too. I updated to version 1.30.4-1. It help to add into file /config/zigbee2mqtt/configuration.yaml line version: 5, but there is still not working UI in side bar.
image
And it seems like Add-on is not working. But Zigbee devices like thermometers, TRV and other work.


Thank you.

Hello,
i had the same issue. After unistall zigbee2mqtt and an fresh install the same issue.
After next uninstall i controlled the config folder and there i found a zigbee2mqtt folder, which was not deleted. I deleted this folder made a reinstall and the issue was gone.

Best regards

Peer

1 Like

This works for me. Thank you!

1 Like

For me file editor worked as well.
I’m a newbie with “zigbee2MQTT”, what puzzles me here is that I successfully few days earlier installed add-on and got few test devices working OK, but only yesterday evening started to get this error. Took me hours to work with many restarts, config edits and googling for solution. I even read this thread but not to the bottom until now.

I had the same error and Z2M refused to run.
After editing configuration.yaml and adding version: 5 Z2M is now running again, but all my devices are lost and nothing works. The Z2M UI is empty. What did I do wrong? Or what more do I have to do?