Fix mqtt not available when starting snips (#92296)
This commit is contained in:
parent
2cc31d6a5b
commit
7a43b29f38
2 changed files with 6 additions and 1 deletions
|
@ -91,6 +91,11 @@ SERVICE_SCHEMA_FEEDBACK = vol.Schema(
|
||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Activate Snips component."""
|
"""Activate Snips component."""
|
||||||
|
|
||||||
|
# Make sure MQTT integration is enabled and the client is available
|
||||||
|
if not await mqtt.async_wait_for_mqtt_client(hass):
|
||||||
|
_LOGGER.error("MQTT integration is not available")
|
||||||
|
return False
|
||||||
|
|
||||||
async def async_set_feedback(site_ids, state):
|
async def async_set_feedback(site_ids, state):
|
||||||
"""Set Feedback sound state."""
|
"""Set Feedback sound state."""
|
||||||
site_ids = site_ids if site_ids else config[DOMAIN].get(CONF_SITE_IDS)
|
site_ids = site_ids if site_ids else config[DOMAIN].get(CONF_SITE_IDS)
|
||||||
|
|
|
@ -46,7 +46,7 @@ async def test_snips_no_mqtt(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
assert not result
|
assert not result
|
||||||
assert "MQTT is not enabled" in caplog.text
|
assert "MQTT integration is not available" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
async def test_snips_bad_config(
|
async def test_snips_bad_config(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue