From 774ebc760c2e3a870baaa1908bcc408ca291fe03 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 14 Dec 2022 16:41:11 +0100 Subject: [PATCH] Ignore certain device trigger validation errors (#83972) --- homeassistant/components/device_automation/trigger.py | 4 ++-- tests/components/deconz/test_device_trigger.py | 1 + tests/components/zha/test_device_trigger.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/device_automation/trigger.py b/homeassistant/components/device_automation/trigger.py index 05f2f79ff28..cd5b3a84c82 100644 --- a/homeassistant/components/device_automation/trigger.py +++ b/homeassistant/components/device_automation/trigger.py @@ -68,7 +68,7 @@ async def async_validate_trigger_config( # Only call the dynamic validator if the relevant config entry is loaded registry = dr.async_get(hass) if not (device := registry.async_get(config[CONF_DEVICE_ID])): - raise InvalidDeviceAutomationConfig + return config device_config_entry = None for entry_id in device.config_entries: @@ -80,7 +80,7 @@ async def async_validate_trigger_config( break if not device_config_entry: - raise InvalidDeviceAutomationConfig + return config if not await hass.config_entries.async_wait_component(device_config_entry): return config diff --git a/tests/components/deconz/test_device_trigger.py b/tests/components/deconz/test_device_trigger.py index bcd178f21d4..66033aa286d 100644 --- a/tests/components/deconz/test_device_trigger.py +++ b/tests/components/deconz/test_device_trigger.py @@ -349,6 +349,7 @@ async def test_functional_device_trigger( assert automation_calls[0].data["some"] == "test_trigger_button_press" +@pytest.mark.skip(reason="Temporarily disabled until automation validation is improved") async def test_validate_trigger_unknown_device(hass, aioclient_mock): """Test unknown device does not return a trigger config.""" await setup_deconz_integration(hass, aioclient_mock) diff --git a/tests/components/zha/test_device_trigger.py b/tests/components/zha/test_device_trigger.py index 8e19fe5b637..49eeacc0e42 100644 --- a/tests/components/zha/test_device_trigger.py +++ b/tests/components/zha/test_device_trigger.py @@ -372,6 +372,7 @@ async def test_exception_bad_trigger(hass, mock_devices, calls, caplog): assert "Invalid config for [automation]" in caplog.text +@pytest.mark.skip(reason="Temporarily disabled until automation validation is improved") async def test_exception_no_device(hass, mock_devices, calls, caplog): """Test for exception on event triggers firing."""