Ignore certain device trigger validation errors (#83972)

pull/84015/head
Erik Montnemery 2022-12-14 16:41:11 +01:00 committed by GitHub
parent ae9506d0bb
commit 774ebc760c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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)

View File

@ -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."""