mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add default config if not there (#43321)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
@@ -453,18 +453,12 @@ def async_template(
|
||||
) -> bool:
|
||||
"""Test if template condition matches."""
|
||||
try:
|
||||
value = value_template.async_render(variables)
|
||||
value: str = value_template.async_render(variables, parse_result=False)
|
||||
except TemplateError as ex:
|
||||
_LOGGER.error("Error during template condition: %s", ex)
|
||||
return False
|
||||
|
||||
if isinstance(value, bool):
|
||||
return value
|
||||
|
||||
if isinstance(value, str):
|
||||
return value.lower() == "true"
|
||||
|
||||
return False
|
||||
return value.lower() == "true"
|
||||
|
||||
|
||||
def async_template_from_config(
|
||||
|
||||
Reference in New Issue
Block a user