Switches and covers unknown/unavailable after ha restart

Hi everyone,

I’m having a constant issue with MQTT after restarting Home Assistant and I was wondering if anyone could help as I have no idea how to properly fix the issue. Whenever I restart all my switches stop have unknown triggers states and my cover devices also show as unavailable.

When I was running HA on a Raspberry Pie I never had this issue but after upgrading to a Proxmox VM HAOS, the issue started. So far to get round the issue I have to reinstall Mosquito Broker and MQTT, but this only lasts temporary before the issue happens again.

After a few HA restarts I then have to restart MQTT after each HA restart this then leads to 20 restarts and combined with broker restarts for the devices to work again. After some more HA restarts I then need to reinstall MQTT again and the cycle repeats.

I have been completely lost on how to resolve this. After Googling I have found some articles saying MQTT needs to be set to retain but I’m not sure where to set this. I run Zigbee2MQTT for my Zigbee devices and I can only find an ‘mqtt’ entry within the Z2M config file but I’m unsure where or if I need to add retain.

As of 14th April 2024 I am running HAOS v2024.4.3. I’m now trying to avoid all HA restarts which is of course not a sustainable idea. Any help with this would be appreciated. Thanks

Create a Debian VM and install Mosquitto on it. Then switch to this broker instead of the add-on.

You can set retain from within the Z2MQTT interface > click each device > Settings > Retain, but you’d also have to change the MQTT version to 5 in Z2MQTT > Settings > MQTT.

However, what you’re describing is definitely not normal and something else is going on. Let’s do some digging, shall we?

  • Which zigbee coordinator are you using?
  • You say the issue only started when you upgraded to Proxmox. How did you set up HA when the upgrade was done? Did you restore a backup or set up everything from scratch?
  • Is your old Raspberry Pi still up & running HA & Z2MQTT? If it is, switch it off, because you can’t have 2 instances of Z2MQTT publishing to the same base topic.
  • Go through the logs for Z2MQTT, Mosquitto broker & HA Core (in that order), and paste anything which looks suspicious.
  • Finally, Install MQTT Explorer on your PC and check if messages are being sent on the zigbee2mqtt & homeassistant topics.

Hi Francisp, thanks for the suggestion I will look into this :slightly_smiling_face:

Hi ShadowFist thank you for the reply. I’m using a Combee II stick for my coordinator and my old pie with HA isn’t running anymore or turned on.

When setting my Proxmox I followed a guide and installed a fresh HAOS on a VM with 10GB RAM (overkill I know but wanted to see how much HA was using due to my 2GB pie reaching it’s limit) then once all set up I ran a backup which I took from my old setup to restore everything.

When looking at my switches in MQTT I can see actions being run when I press them buy instead of for example ‘single click’ it’s showing as unknown. My Z2M is also not showing errors. As of this morning I reinstalled my broker and mqtt but I will look at their logs once the issue happens again and paste any issues here.

1 Like

Great, in the meantime, I suggest installing MQTT Explorer to have it all set up for when/if things go wrong. It’s helped me out a couple of times before and is a handy tool to have.