Self hosted MQTT - what are the actual options ?!

Hello all,

I haven’t yet tried without SSL, but I might do that to test everything else, but really want to get the SSL stuff sorted out.

Most importantly, either the integration is too new and very undocumented or there needs to be a much stronger CHANGELOG on the options for MQTT.

I have been browsing for hours on this forum and otherwise online resources, and roughly everyone is under the impression to use a configuration in configuration.yaml that looks like

mqtt:
  broker: "<ip or hostname>"
  port: 1883 # 8883 for TLS
  username: ha
  password: !secret mqtt_key
  tls_insecure: true
  tls_version: auto

However the only options of the official documentation only talks of the certificates options.
And in the logs, it is saying that all these options are deprecated.

As a result, the MQTT integration on reload never even tries to connect to the broker.
So what are the 2022.7 MQTT integration configurations that are valid ?

Reading at the code, I can see the options are in there so I am very confused…

Thank you all,

That’s because in 2022.7 the only config that goes in configuration.yaml for Mqtt is the certificate options. Hostname, port, username and password are all configured in the UI.

Basically just click this button and fill out the form:
Open your Home Assistant instance and start setting up a new integration.

If you don’t need SSL then you’re done. If you do need SSL then add just those options to your configuration.yaml and restart HA. Unfortunately those options have not been made available I’m the UI yet so if you need them you have to split up the configuration process.

Yeah, did that now, without TLS, which is working fine.
I have enabled both TLS and “non-TLS” on mosquitto allowing to poke around with that.

But now that the MQTT integration is working, I still cannot see anywhere in configuration files mqtt that the integration would have “generated”.

Having the options in the UI would help a lot of people for sure, but having a reliable configuration that works for configuration.yaml would be top notch.

For any integration in HA there is are two possible ways it could be configured:

  1. In the UI from the integrations page. In which case the config details are stored on disk in JSON files within the hidden .storage folder in the ha config folder
  2. In yaml in the configuration.yaml file

Which way an integration is configured is mostly up to the integration author. Although they have these rules to follow:

  • Integrations that communicate with devices and/or services are only configured via the UI. In rare cases, we can make an exception.
  • All other integrations are configured via YAML or via the UI.

There are many integrations now which are only configurable in the UI, it is not possible to configure them in yaml. Mqtt is sort of one in that you have to do some of it in the UI. Although if you need TLS, manual Mqtt entities or other advanced Mqtt options then you do those parts in yaml.

Either way the two config options aren’t interchangeable. The code owner must enable and maintain support for one of the two mechanisms for configuration. They can also optionally enable and maintain the other separately.

1 Like

Well in the meantime I have the MQTT and Zigbee2MQTT working both, so happy to see how this works and see what kind of rabbit hole I am going to fall into from there.

I will post later when I found a solution, whatever that might end up be.

Mike gave you the correct answer. Where are you still getting stuck? Solution to what?

I did not mean to say his answer is incorrect, only a to be continued to further understand how this configuration works. If I have done it in the UI, can I override it in config, etc. etc.

Solution to what → SSL, functional, for MQTT and Zigbee2MQTT

You should mark his post then as the solution, as it will help others to find it more easily. It certainly is a confusing matter (the inconsistency).

Apologies, I liked the answer instead :man_facepalming:
I will update when I get TLS to work if others are interested

1 Like