Zigbee2mqtt Autodiscovery

Hi,

There is a lot written on the forum about MQTT in general and zigbee2mqtt in particular.

I was wondering what status is about autodiscovery, Is it possible to auto-discover zigbee devices connected via zigbee2mqtt?

Adding devices item by item, channel by channel it is tedious, good for getting started, but after a few 10s of devices…

Is it possible? Is it functional?

I can see in the zigbee2mqtt documentation that it seems possible with other automation packages and perhaps this is an interesting area to contribute to if something is still pending…

I do not use it as i prefer manual adding devices, but as per the z2mqtt docs you could try the home assistant setting added in your config file which should enable auto discovery.

any particular reason why not to enable it? is it not working properly?

It works well for me!

I tried it, and this is what I see:

  • I am not a fun of the MQTT messages that homeassistant compatibility puts in the wire, they are full of long IDs and make the wire very unser-unfriendly.
  • Things are nicely detected by OpenHAB, I haven’t tested if they work well, because of the next issue. But that seems promising.
  • Suddenly the traditional MQTT of zigbee2mqtt is behaving differently. This seems like a bug. But it is sending multiple messages for single actions (see below). Other integrations based on n8n that I have are breaking. This is a show stopper for me.

For example, this is what happens with z2m mqtt when I press off on a switch just once:

z2m/switch2 {"action":"off","battery":87,"click":"off","linkquality":222}
z2m/switch2 {"action":"","battery":87,"linkquality":222}
z2m/switch2 {"action":null,"battery":87,"click":"","linkquality":222}
z2m/switch2/action off
z2m/switch2/click off

before enable homeassistant compatibility a single message was publish with the new thing state.

@SpaceGlider are you also seeing this?

just in case I have reported it as a problem, it just seems very strange:

I did not activate it as I like to control what goes into OH without spamming the inbox, also, there are still some limitations with the HA feature, one being, as you mentioned, the msg formatting (I prefer the plain one, also too lazy to redo all my OH things).

I also use some advanced/experimental config settings to get rid of the JSON formatting for instance which works fine in my case (each signal like link quality, status etc. has it’s own MQTT topic per device).

Also have a look here, maybe it helps.