core: Missing MQTT services after removing the YAML config

The problem

When removing the MQTT config from my YAML the MQTT dump and publish services are missing.

This is the MQTT config I had before the upgrade and what I deleted.

mqtt:
  broker: 10.10.10.2
  discovery: true
  discovery_prefix: homeassistant
  username: homeassistant
  password: !secret mqtt_password
  birth_message:
    topic: "hass/status"
    payload: "online"
  will_message:
    topic: "hass/status"
    payload: "offline

These are the visible services before it is removed; Screenshot 2022-03-07 at 08 57 37

After removal

Screenshot 2022-03-07 at 09 01 28

Re adding the above config, making no other changes and restarting home assistant resolved the issue for me. Although now I see deprecation warnings.

commit 7638cfae92680197eb12853546c2fc6ca15a4119 (HEAD -> master, origin/master, origin/HEAD)
Author: Dougal Matthews <dougal@.com>
Date:   Mon Mar 7 08:55:23 2022 +0000

    Revert "Remove mqtt config"

    This reverts commit 3d355bd90b06b8b24ed8c8f9de54d2c66ac99902.

diff --git a/configuration.yaml b/configuration.yaml
index 398d2ec7..b43ea090 100644
--- a/configuration.yaml
+++ b/configuration.yaml
@@ -134,6 +134,19 @@ mobile_app:

 apple_tv:

+mqtt:
+  broker: 10.10.10.2
+  discovery: true
+  discovery_prefix: homeassistant
+  username: homeassistant
+  password: !secret mqtt_password
+  birth_message:
+    topic: "hass/status"
+    payload: "online"
+  will_message:
+    topic: "hass/status"
+    payload: "offline"
+
 homekit:
   filter:
     include_entities:

What version of Home Assistant Core has the issue?

2022.3

What was the last working version of Home Assistant Core?

2022.2

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

mqtt

Link to integration documentation on our website

https://www.home-assistant.io/integrations/mqtt/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

I found this error in my logs

2022-03-07 09:00:17 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry configuration.yaml for mqtt
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 638, in async_setup_entry
    await hass.data[DATA_MQTT].async_connect()
  File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 925, in async_connect
    self.conf[CONF_BROKER],
KeyError: 'broker'


### Additional information

_No response_

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Removing MQTT configuration from YAML is a mistake and should be restored; complicated or pre-defined configurations are not user-friendly and any extant sensor dependent on the MQTT integration breaks upon load prior to end-user being able to configure MQTT through UI.

The linked PR makes sure the data in the config entry is complete, a bit late though 😃

I can only confirm that the lack of the services is due to MQTT not started correctly in your case.

I dropped my YAML config for MQTT to UI configuration with 2022.3 and I have the 3 services 👍