mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 18:28:14 +02:00
Do not fail mqtt entry on single platform config schema error (#101373)
* Do not fail mqtt entry on platform config * Raise on reload with invalid config * Do not store issues * Follow up
This commit is contained in:
@ -3547,14 +3547,21 @@ async def test_publish_or_subscribe_without_valid_config_entry(
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.mqtt.PLATFORMS",
|
||||
["tag", Platform.LIGHT],
|
||||
[Platform.ALARM_CONTROL_PANEL, Platform.LIGHT],
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"hass_config",
|
||||
[
|
||||
{
|
||||
"mqtt": {
|
||||
"light": [{"name": "test", "command_topic": "test-topic"}],
|
||||
"alarm_control_panel": [
|
||||
{
|
||||
"name": "test",
|
||||
"state_topic": "home/alarm",
|
||||
"command_topic": "home/alarm/set",
|
||||
},
|
||||
],
|
||||
"light": [{"name": "test", "command_topic": "test-topic_new"}],
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -3568,10 +3575,18 @@ async def test_disabling_and_enabling_entry(
|
||||
await mqtt_mock_entry()
|
||||
entry = hass.config_entries.async_entries(mqtt.DOMAIN)[0]
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
# Late discovery of a mqtt entity/tag
|
||||
# Late discovery of a mqtt entity
|
||||
config_tag = '{"topic": "0AFFD2/tag_scanned", "value_template": "{{ value_json.PN532.UID }}"}'
|
||||
config_light = '{"name": "test2", "command_topic": "test-topic_new"}'
|
||||
config_alarm_control_panel = '{"name": "test_new", "state_topic": "home/alarm", "command_topic": "home/alarm/set"}'
|
||||
config_light = '{"name": "test_new", "command_topic": "test-topic_new"}'
|
||||
|
||||
# Discovery of mqtt tag
|
||||
async_fire_mqtt_message(hass, "homeassistant/tag/abc/config", config_tag)
|
||||
|
||||
# Late discovery of mqtt entities
|
||||
async_fire_mqtt_message(
|
||||
hass, "homeassistant/alarm_control_panel/abc/config", config_alarm_control_panel
|
||||
)
|
||||
async_fire_mqtt_message(hass, "homeassistant/light/abc/config", config_light)
|
||||
|
||||
# Disable MQTT config entry
|
||||
@ -3585,6 +3600,10 @@ async def test_disabling_and_enabling_entry(
|
||||
"MQTT integration is disabled, skipping setup of discovered item MQTT tag"
|
||||
in caplog.text
|
||||
)
|
||||
assert (
|
||||
"MQTT integration is disabled, skipping setup of discovered item MQTT alarm_control_panel"
|
||||
in caplog.text
|
||||
)
|
||||
assert (
|
||||
"MQTT integration is disabled, skipping setup of discovered item MQTT light"
|
||||
in caplog.text
|
||||
@ -3601,6 +3620,7 @@ async def test_disabling_and_enabling_entry(
|
||||
assert new_mqtt_config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
assert hass.states.get("light.test") is not None
|
||||
assert hass.states.get("alarm_control_panel.test") is not None
|
||||
|
||||
|
||||
@patch("homeassistant.components.mqtt.PLATFORMS", [Platform.LIGHT])
|
||||
|
Reference in New Issue
Block a user