mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Continue on template error during yaml import for generic (#69440)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
fe8e193225
commit
c6bba19e05
@ -136,7 +136,7 @@ async def async_test_still(hass, info) -> tuple[dict[str, str], str | None]:
|
|||||||
try:
|
try:
|
||||||
url = url.async_render(parse_result=False)
|
url = url.async_render(parse_result=False)
|
||||||
except TemplateError as err:
|
except TemplateError as err:
|
||||||
_LOGGER.error("Error parsing template %s: %s", url, err)
|
_LOGGER.warning("Problem rendering template %s: %s", url, err)
|
||||||
return {CONF_STILL_IMAGE_URL: "template_error"}, None
|
return {CONF_STILL_IMAGE_URL: "template_error"}, None
|
||||||
verify_ssl = info.get(CONF_VERIFY_SSL)
|
verify_ssl = info.get(CONF_VERIFY_SSL)
|
||||||
auth = generate_auth(info)
|
auth = generate_auth(info)
|
||||||
@ -283,6 +283,14 @@ class GenericIPCamConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
if self.check_for_existing(import_config):
|
if self.check_for_existing(import_config):
|
||||||
return self.async_abort(reason="already_exists")
|
return self.async_abort(reason="already_exists")
|
||||||
errors, still_format = await async_test_still(self.hass, import_config)
|
errors, still_format = await async_test_still(self.hass, import_config)
|
||||||
|
if errors.get(CONF_STILL_IMAGE_URL) == "template_error":
|
||||||
|
_LOGGER.warning(
|
||||||
|
"Could not render template, but it could be that "
|
||||||
|
"referenced entities are still initialising. "
|
||||||
|
"Continuing assuming that imported YAML template is valid"
|
||||||
|
)
|
||||||
|
errors.pop(CONF_STILL_IMAGE_URL)
|
||||||
|
still_format = import_config.get(CONF_CONTENT_TYPE, "image/jpeg")
|
||||||
errors = errors | await async_test_stream(self.hass, import_config)
|
errors = errors | await async_test_stream(self.hass, import_config)
|
||||||
still_url = import_config.get(CONF_STILL_IMAGE_URL)
|
still_url = import_config.get(CONF_STILL_IMAGE_URL)
|
||||||
stream_url = import_config.get(CONF_STREAM_SOURCE)
|
stream_url = import_config.get(CONF_STREAM_SOURCE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user