Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

HASS.Agent fails to start the first time when Home Assistant is restarted #2

Open
danielbrunt57 opened this issue Mar 22, 2024 · 0 comments

Comments

@danielbrunt57
Copy link

image

Logger: homeassistant.config_entries
Source: config_entries.py:504
First occurred: 4:03:26 AM (1 occurrences)
Last logged: 4:03:26 AM

Error setting up entry WINDOWS-11 for hass_agent
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 180, in async_subscribe
    mqtt_data = get_mqtt_data(hass)
                ^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/mqtt/util.py", line 179, in get_mqtt_data
    mqtt_data = hass.data[DATA_MQTT]
                ~~~~~~~~~^^^^^^^^^^^
KeyError: 'mqtt'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hass_agent/__init__.py", line 162, in async_setup_entry
    await async_subscribe_topics(hass, sub_state)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/subscription.py", line 132, in async_subscribe_topics
    await sub.subscribe()
  File "/usr/src/homeassistant/homeassistant/components/mqtt/subscription.py", line 61, in subscribe
    self.unsubscribe_callback = await self.subscribe_task
                                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 182, in async_subscribe
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Cannot subscribe to topic 'hass.agent/devices/WINDOWS-11', make sure MQTT is set up correctly

image

Reload integration...
image

And it works...
image

So the issue appears to be the timing of integrations loading...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant