2022.8.4: Invalid config for [automation]: Integration 'mqtt' does not provide trigger support

hi all, I upgraded to 2022.8.4 (from 2021.1.5) and my mqtt automations stopped working. My MQTT sensors still work but incoming MQTT events no longer trigger automations. I do not appear to be the only person with this problem (see https://github.com/home-assistant/core/issues/76619).

The home-assistant UI shows this error:

Logger: homeassistant.config
Source: config.py:455
First occurred: 11:46:36 AM (13 occurrences)
Last logged: 11:46:36 AM
Invalid config for [automation]: Integration 'mqtt' does not provide trigger support. Got OrderedDict([('config', {}), ('frontend', {}), ('history', {}), ('homeassistant', OrderedDict([('auth_providers', [OrderedDict([('api_password', 'ddd'), ('type', 'legacy_api_password')]), OrderedDict([('allow_bypass_login', True), ('trusted_networks', ['127.0.0.1', '::1']), ('type', 'trusted_networks')])]), ('customize', OrderedDict([('sensor.bed_pi_full', OrderedDict([('hidden', True)])), ('sensor.bedroom_full', OrderedDict([('hidden', True)]))])), ('elevation', 36), ('latitude', 48.83954.... (See /srv/homeassistant/config/configuration.yaml, line 49).

My automation.yaml contains 13 automations like this one:

- action:
    data:
      value: RFI Monde
    service: shell_command.radio_info
  alias: key 1 - RFI Monde
  trigger:
    payload: key 1
    platform: mqtt
    topic: keyboard

According to the current documentation Automation Trigger - Home Assistant my code seems OK.

Can anybody help me understand the problem?

When I start home-assistant I see this stack trace:

Aug 13 09:47:22 entrance sh[16034]: 2022-08-13 09:47:22.453 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry configuration.yaml for mqtt
Aug 13 09:47:22 entrance sh[16034]: Traceback (most recent call last):
Aug 13 09:47:22 entrance sh[16034]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/config_entries.py", line 357, in async_setup
Aug 13 09:47:22 entrance sh[16034]:     result = await component.async_setup_entry(hass, self)
Aug 13 09:47:22 entrance sh[16034]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/__init__.py", line 463, in async_setup_entry
Aug 13 09:47:22 entrance sh[16034]:     await async_forward_entry_setup_and_setup_discovery(entry)
Aug 13 09:47:22 entrance sh[16034]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/__init__.py", line 456, in async_forward_entry_setup_and_setup_discovery
Aug 13 09:47:22 entrance sh[16034]:     await _async_setup_discovery(hass, conf, entry)
Aug 13 09:47:22 entrance sh[16034]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/__init__.py", line 162, in _async_setup_discovery
Aug 13 09:47:22 entrance sh[16034]:     await discovery.async_start(hass, conf[CONF_DISCOVERY_PREFIX], config_entry)
Aug 13 09:47:22 entrance sh[16034]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/discovery.py", line 246, in async_start
Aug 13 09:47:22 entrance sh[16034]:     hass.data[DISCOVERY_UNSUBSCRIBE] = await asyncio.gather(
Aug 13 09:47:22 entrance sh[16034]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/discovery.py", line 248, in <genexpr>
Aug 13 09:47:22 entrance sh[16034]:     mqtt.async_subscribe(hass, topic, async_discovery_message_received, 0)
Aug 13 09:47:22 entrance sh[16034]: AttributeError: module 'homeassistant.components.mqtt' has no attribute 'async_subscribe'

Could the error in the stack trace indicate that MQTT triggers are broken? The full startup messages are in https://github.com/home-assistant/core/issues/76619

As an aside, why does the log show a random bit of configuration and one that includes my API password?

1 Like

Similar problems after upgrading to 2022.8.4 from 8.2:

Invalid config
The following integrations and platforms could not be set up:
…/integrations/mqtt
…/integrations/zha
…/integrations/number

HA even doesn’t want to restart from GUI…
I am thinking about reinstalling the whole system - HA OS (Raspberry Pi 3).

I am probably not of much help, but as of 2022.9 we will have to switch to the mqtt: component format.

This probably isn’t causing your problems, though.

Just go back to your most recent working snapshot (backup).

Thanks for this but when I go to /hassio/backups I can see some partial and a full backup, but when I select it the only option is Delete selected backups - no restore. What can I do?

Click on the backup name and the “restore” option is in the popup.

Thank you, it worked and HA is working now.

hi! My configuration has started working. I did a few changes so that I could still use my home automation without my MQTT triggers and somehow they have started working.

My configuration still contains:

- action:
    data:
      value: RFI Monde
    service: shell_command.radio_info
  alias: key 1 - RFI Monde
  trigger:
    payload: key 1
    platform: mqtt
    topic: keyboard

I still see the ugly stack trace:

Aug 13 12:07:32 entrance sh[19111]: 2022-08-13 12:07:32.326 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry configuration.yaml for mqtt
Aug 13 12:07:32 entrance sh[19111]: Traceback (most recent call last):
Aug 13 12:07:32 entrance sh[19111]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/config_entries.py", line 357, in async_setup
Aug 13 12:07:32 entrance sh[19111]:     result = await component.async_setup_entry(hass, self)
Aug 13 12:07:32 entrance sh[19111]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/__init__.py", line 463, in async_setup_entry
Aug 13 12:07:32 entrance sh[19111]:     await async_forward_entry_setup_and_setup_discovery(entry)
Aug 13 12:07:32 entrance sh[19111]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/__init__.py", line 456, in async_forward_entry_setup_and_setup_discovery
Aug 13 12:07:32 entrance sh[19111]:     await _async_setup_discovery(hass, conf, entry)
Aug 13 12:07:32 entrance sh[19111]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/__init__.py", line 162, in _async_setup_discovery
Aug 13 12:07:32 entrance sh[19111]:     await discovery.async_start(hass, conf[CONF_DISCOVERY_PREFIX], config_entry)
Aug 13 12:07:32 entrance sh[19111]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/discovery.py", line 246, in async_start
Aug 13 12:07:32 entrance sh[19111]:     hass.data[DISCOVERY_UNSUBSCRIBE] = await asyncio.gather(
Aug 13 12:07:32 entrance sh[19111]:   File "/tmp/ve/lib/python3.10/site-packages/homeassistant/components/mqtt/discovery.py", line 248, in <genexpr>
Aug 13 12:07:32 entrance sh[19111]:     mqtt.async_subscribe(hass, topic, async_discovery_message_received, 0)
Aug 13 12:07:32 entrance sh[19111]: AttributeError: module 'homeassistant.components.mqtt' has no attribute 'async_subscribe'

but am also seeing:

Aug 13 13:09:08 entrance sh[19111]: 2022-08-13 13:09:08.945 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'message', payload: 'living volume up'
Aug 13 13:09:08 entrance sh[19111]: 2022-08-13 13:09:08.947 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'keyboard', payload: 'key 1'
Aug 13 13:09:08 entrance sh[19111]: 2022-08-13 13:09:08.948 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'keyboard', payload: 'key 2'
Aug 13 13:09:08 entrance sh[19111]: 2022-08-13 13:09:08.949 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'keyboard', payload: 'key 3'
Aug 13 13:09:08 entrance sh[19111]: 2022-08-13 13:09:08.951 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'keyboard', payload: 'key 4'
Aug 13 13:09:08 entrance sh[19111]: 2022-08-13 13:09:08.952 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'keyboard', payload: 'key 7'
Aug 13 13:09:08 entrance sh[19111]: 2022-08-13 13:09:08.960 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'keyboard', payload: 'key 8'
Aug 13 13:09:08 entrance sh[19111]: 2022-08-13 13:09:08.961 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'keyboard', payload: 'key 9'

Sending the MQTT message key 1 with topic keyboard now starts playing the radio.

hi! Well, I restarted HA (I just turned the MQTT log level down from debug to info) and now incoming MQTT events so longer trigger my automations. I upgraded to 2022.8.6 but still I have the same problem.

I am still seeing the stack-trace but the Attaching MQTT trigger for topic messages have vanished.

But no, if I reload the automations using the developer-tools/yaml page I see Attaching MQTT trigger for topic message and my MQTT triggers start working. This sounds like a bug. Should I open a bug report?

In summary, with hass 2022.8.6,after a restart MQTT triggers do not work. I need to reload the automations to make them work.