I'm sporadically getting the following error logged when HA starts:
Error during setup of component mqtt_discoverystream
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 186, 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/setup.py", line 332, in _async_setup_component
result = await task
^^^^^^^^^^
File "/config/custom_components/mqtt_discoverystream/__init__.py", line 302, in async_setup
await hass.components.mqtt.async_subscribe(f"{base_topic}switch/+/set", message_received)
File "/usr/src/homeassistant/homeassistant/components/mqtt/client.py", line 188, in async_subscribe
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Cannot subscribe to topic 'homeassistant/switch/+/set', make sure MQTT is set up correctly
MQTT is set up correctly, I have a large number of devices working over MQTT (and my docker-compose config makes sure the MQTT broker is up and running before HA is started). Sometimes - maybe one time in five or six - everything starts up just fine and mqtt_discoverystream works perfectly, which makes me wonder if this is some sort of race condition and that HA is sometimes trying to initialise mqtt_discoverystream before the mqtt integration.
My mqtt_discoverystream configuration is via a packages/mqtt_discoverystream.yaml file:
I'm sporadically getting the following error logged when HA starts:
MQTT is set up correctly, I have a large number of devices working over MQTT (and my docker-compose config makes sure the MQTT broker is up and running before HA is started). Sometimes - maybe one time in five or six - everything starts up just fine and
mqtt_discoverystream
works perfectly, which makes me wonder if this is some sort of race condition and that HA is sometimes trying to initialisemqtt_discoverystream
before themqtt
integration.My
mqtt_discoverystream
configuration is via apackages/mqtt_discoverystream.yaml
file: