core: Dependency for mqtt component does not work as expected

The problem

Change https://github.com/home-assistant/core/pull/92296 was needed to make sure the snips integration set’s up. It failed because mqtt was not available, while that should not be possible. It is known that if an integration is set up as a platform it could be triggered by the mqtt platform setup. But snips is an integration component that should wait for the mqtt integration component as a dependency. Issue https://github.com/home-assistant/core/issues/92236 proves this does not work.

What version of Home Assistant Core has the issue?

core-dev-2023.5.b0

What was the last working version of Home Assistant Core?

core-dev-2023.4.0

What type of installation are you running?

Home Assistant OS

Integration causing the issue

mqtt

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 32 (29 by maintainers)

Most upvoted comments

What happens is that async_setup is awaited for, but not async_setup_entry. There were recent changes where we do not use async_setup anymore. The after_dependencies might work, but only if mqtt was set up manually and mqtt is optional. So for snips the added check is a good solution. The dependency will make sure mqtt is set up or the integration with the dependency will fail.

I do not see snips in your startup time list. Perhaps you can share some relevant details of your startup log files.

snips takes 1.66 seconds to start up. i’ll have a look in the log files and see what i can find after i set he logs to more verbose reporting (as per default setting integration startup is not logged).

@jbouwh asked in https://github.com/home-assistant/core/issues/92236#issuecomment-1529058634

May be you have some other stuff that takes some time to startup

i do, actually. first came the fritz integration to my mind, which takes about 140 seconds. when i looked again, there’s the xiaomi_miio_fan integration that takes a staggerin 862 seconds — although it was deactivated in the frontend. also, since i use a lot of command line sensors, the command line integration takes 23 seconds.

as far as i understand, none of the above mentioned intergrations use mqtt and after startup, mqtt usally is up shortly after the fritz integration is up. i never see any mention of the xiaomi_miio_fan integration in the startup notificaton („HA has not initialized completly, starting xxx“).

image Bildschirmfoto 2023-04-30 um 20 13 17