diff --git a/homeassistant/components/mqtt_statestream/__init__.py b/homeassistant/components/mqtt_statestream/__init__.py index 01425737543..aa4c2c628b4 100644 --- a/homeassistant/components/mqtt_statestream/__init__.py +++ b/homeassistant/components/mqtt_statestream/__init__.py @@ -41,15 +41,6 @@ _LOGGER = logging.getLogger(__name__) async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the MQTT state feed.""" - # Make sure MQTT is available and the entry is loaded - if not hass.config_entries.async_entries( - mqtt.DOMAIN - ) or not await hass.config_entries.async_wait_component( - hass.config_entries.async_entries(mqtt.DOMAIN)[0] - ): - _LOGGER.error("MQTT integration is not available") - return False - conf: ConfigType = config[DOMAIN] publish_filter = convert_include_exclude_filter(conf) base_topic: str = conf[CONF_BASE_TOPIC] diff --git a/tests/components/mqtt_statestream/test_init.py b/tests/components/mqtt_statestream/test_init.py index 130d874cc50..c5c91a97eea 100644 --- a/tests/components/mqtt_statestream/test_init.py +++ b/tests/components/mqtt_statestream/test_init.py @@ -96,12 +96,19 @@ async def test_setup_and_stop_waits_for_ha( mqtt_mock.async_publish.assert_not_called() +@pytest.mark.xfail() async def test_startup_no_mqtt( hass: HomeAssistant, caplog: pytest.LogCaptureFixture ) -> None: """Test startup without MQTT support.""" - assert not await add_statestream(hass, base_topic="pub") - assert "MQTT integration is not available" in caplog.text + e_id = "fake.entity" + + assert await add_statestream(hass, base_topic="pub") + # Set a state of an entity + mock_state_change_event(hass, State(e_id, "on")) + await hass.async_block_till_done() + await hass.async_block_till_done() + assert "MQTT is not enabled" in caplog.text async def test_setup_succeeds_with_attributes(