Skip to content

Commit

Permalink
Made sure the component setup is not done until MQTT is fully configu…
Browse files Browse the repository at this point in the history
…red and started. This should also fix #133 but needs testing by someone who had the MQTT error (I did not, I actually never have).
  • Loading branch information
xNUTx committed Sep 6, 2024
1 parent 5de3dac commit d2c9afd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/openhasp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import re

from homeassistant.components.mqtt import async_subscribe, async_publish
import homeassistant.components.mqtt as mqtt
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
Expand Down Expand Up @@ -164,6 +165,9 @@ def hasp_object(value):


async def async_setup(hass, config):
"""Wait for MQTT to become available before starting."""
await mqtt.async_wait_for_mqtt_client(hass)

"""Set up the MQTT async example component."""
conf = config.get(DOMAIN)

Expand Down

0 comments on commit d2c9afd

Please sign in to comment.