Module 'homeassistant.components.mqtt' has no attribute 'async_subscribe'

Hello

I have a problem after updating. I had updated HA (core installation) last time on 07/07, then upgraded today to 2022.8.9. After the first “boot”, I saw this error in the log:

Error setting up entry localhost for mqtt

Traceback (most recent call last):
  File "/home/homeassistant/.pyenv/versions/3.9.7/lib/python3.9/site-packages/homeassistant/config_entries.py", line 357, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/home/homeassistant/.pyenv/versions/3.9.7/lib/python3.9/site-packages/homeassistant/components/mqtt/__init__.py", line 463, in async_setup_entry
    await async_forward_entry_setup_and_setup_discovery(entry)
  File "/home/homeassistant/.pyenv/versions/3.9.7/lib/python3.9/site-packages/homeassistant/components/mqtt/__init__.py", line 456, in async_forward_entry_setup_and_setup_discovery
    await _async_setup_discovery(hass, conf, entry)
  File "/home/homeassistant/.pyenv/versions/3.9.7/lib/python3.9/site-packages/homeassistant/components/mqtt/__init__.py", line 162, in _async_setup_discovery
    await discovery.async_start(hass, conf[CONF_DISCOVERY_PREFIX], config_entry)
  File "/home/homeassistant/.pyenv/versions/3.9.7/lib/python3.9/site-packages/homeassistant/components/mqtt/discovery.py", line 246, in async_start
    hass.data[DISCOVERY_UNSUBSCRIBE] = await asyncio.gather(
  File "/home/homeassistant/.pyenv/versions/3.9.7/lib/python3.9/site-packages/homeassistant/components/mqtt/discovery.py", line 248, in <genexpr>
    mqtt.async_subscribe(hass, topic, async_discovery_message_received, 0)
AttributeError: module 'homeassistant.components.mqtt' has no attribute 'async_subscribe'

So my MQTT extension stopped working.
What can I do? I checked in the release notes but found nothing that seemed related.

I tried to remove and add again the MQTT integration, but same issue

I see an open issue on GitHub for it: https://github.com/home-assistant/core/issues/77060

Actually my behavior was not similar; in that issue the user could just restart the automations, in my case the whole integration was not working.

I’m using the past tense because this morning I checked the logs and saw that all my custom packages using the mqtt platform had an error stating the paho library was not present. For this reason I manually installed the paho-mqtt package in the home assistant virtual environment and… now it works again :slight_smile: