MQTT yaml configuration deprecation

I have had an external MQTT server defined in my configuration.yaml file for ages. With the upgrade to 2022.3.x, I see that the use of the Configuration.yaml entry is deprecated. Has anyone removed this and used the integrations panel to add it back? Did it change any of your sensors/devices using MQTT?

Log Details (WARNING)

Logger: homeassistant.components.mqtt
Source: helpers/config_validation.py:817
Integration: MQTT ([documentation](https://www.home-assistant.io/integrations/mqtt), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+mqtt%22))
First occurred: 4:51:41 PM (4 occurrences)
Last logged: 4:51:41 PM

* The 'broker' option near /config/configuration.yaml:41 is deprecated, please remove it from your configuration
* The 'discovery' option near /config/configuration.yaml:41 is deprecated, please remove it from your configuration
* The 'password' option near /config/configuration.yaml:41 is deprecated, please remove it from your configuration
* The 'username' option near /config/configuration.yaml:41 is deprecated, please remove it from your configuration

It shouldn’t make any difference.

Everything comes back, don’t worry about that… I use an external mosquitto too, no problems with it on 2022.3.x

Could you please explain what you mean by “everything comes back”? I am getting the same deprecation messages. The configuration is working for now, but the warnings mean that they will not in the future, if deprecation means anything. I have not been able to find any documentation on this matter.

3 Likes

Comment out the current mqtt entry in the configuration.yaml file, restart, then go into Configuratin > Integrations and add the mqtt integration there. Everything I had working with MQTT before came back and did not have to be recreated.

3 Likes

See the comment of dap35.

I deleted my mqtt settings from configuration.yaml. Then I still had an error, so I deleted the integration, and re-added it. Indeed, everything seems to come back, but all the names are back to default again. This is a disaster. I have to find out each and every sensor, switch, dimmer, etc. Really disappointing.

1 Like

It should be enough just delete it from configuration.yaml and then restart HA. Integration should remain untouched. This worked with every migration from configuration.yaml defined integrations in past to UI defined integrations after upgrade.

1 Like

I had similar experience like @rolandow. I had to restore backup, because every entity name of MQTT device changed back to default.

What did job for me without any loss of customizations:

  1. Go to Configuration → Devices & Services
  2. In Integrations tab find your MQTT configuration.yaml integration
  3. Configure → Re-Configure MQTT → Next → Submit (you will see some errors in HA log after submit)
  4. Delete mqtt block from HA config
  5. Restart HA
4 Likes

I did steps as you mentioned, worked fine. Thanks!

Hello guys,

I had HA not up to date for a long time. I am still at version 2022.7.5.
My MQTT Shelly integration is still working since 2018 with no issue.

Now I want to install the latest version available, but I want to be sure that my configuration will still work.

I have this configuration right now:

what are the changes I should have in my yaml configuration to make the mqtt works with the HA latest version?

Thank you in advance for the support

what’s the solution? I didn’t get it

MQTT is now a top-level configuration item, so you want something like this in configuration.yaml:

mqtt:
  light: !include luci.yaml
  switch:
    - name: "Termosifoni"
      [options]

and then in luci.yaml (assuming that only contains MQTT lights, not other lights):

- name "Led Divano"
  state_topic: "..."
  [options]

- name: "Faretti Soggiorno"
  state_topic: "..."
  [options]

using options as in this document (most should be carry-over from your existing config):

Your MQTT switch will also need updating, as I’ve shown above. Documentation for that one:

If any of your sensors are MQTT, they’ll need similar adjustment.

1 Like

Great! Thank you so much!
Do you suggest to apply the change before or after update HA?

With an old version like that, I don’t think it matters: the old config definitely will generate errors in the new version; but I don’t know if the old version will cope with the new config.

Perhaps comment out the switch: section and the light: line, then upgrade, then sort it out int eh new version.

1 Like

FYI I tried and the old version copes with the new config.

Thanks again for the help

1 Like