Mqtt anonymous connect

Hi

My setup is Home Assistant Supervised with Zigbee2Mqtt and Mqtt Broker add-ons running Rasperry Pi 4.

I am designing small devices by myself and planning to connect them to HA. Current aproach is to use WPS for connecting them to Wifi, then let the device search for HA using mDns and then connect to the MQTT broker.

Testing “stuff” out I have come to the conclusion that a Mqtt Client (device) can not connect to HA anonymous, need valid user and password.

I am trying to avoid any need of configuraton of the device ( involvment of end user ) but getting to a point where I am out of ideas.

Avoiding device configuration I can only see two options???

  1. Hard code user and paswword into the device.
  2. Allow anonymous access
  3. ???

Have anyone had similar thoughs and how to solve it???

As this is not possible with the Mosquitto addon:

  1. Run your own broker instead of the Mosquitto addon.