Simplify and speed up mqtt_config_entry_enabled check (#117886)

This commit is contained in:
J. Nick Koston 2024-05-21 15:04:31 -10:00 committed by GitHub
parent 5f7b84caea
commit 1800a60a6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,9 +84,9 @@ async def async_forward_entry_setup_and_setup_discovery(
def mqtt_config_entry_enabled(hass: HomeAssistant) -> bool | None:
"""Return true when the MQTT config entry is enabled."""
if not bool(hass.config_entries.async_entries(DOMAIN)):
return None
return not bool(hass.config_entries.async_entries(DOMAIN)[0].disabled_by)
return hass.config_entries.async_has_entries(
DOMAIN, include_disabled=False, include_ignore=False
)
async def async_wait_for_mqtt_client(hass: HomeAssistant) -> bool: