diff --git a/homeassistant/helpers/template/extensions/config_entries.py b/homeassistant/helpers/template/extensions/config_entries.py index 27708724d476..af5baeec317f 100644 --- a/homeassistant/helpers/template/extensions/config_entries.py +++ b/homeassistant/helpers/template/extensions/config_entries.py @@ -1,6 +1,7 @@ """Config entry functions for Home Assistant templates.""" from collections.abc import Iterable +from enum import Enum from typing import TYPE_CHECKING, Any from homeassistant.exceptions import TemplateError @@ -104,4 +105,7 @@ class ConfigEntryExtension(BaseTemplateExtension): if config_entry is None: return None - return getattr(config_entry, attr_name) + value = getattr(config_entry, attr_name) + if isinstance(value, Enum): + return value.value + return value diff --git a/tests/helpers/template/extensions/test_config_entries.py b/tests/helpers/template/extensions/test_config_entries.py index ab82ce0d6463..0cd4897f2ff7 100644 --- a/tests/helpers/template/extensions/test_config_entries.py +++ b/tests/helpers/template/extensions/test_config_entries.py @@ -120,7 +120,7 @@ async def test_config_entry_attr(hass: HomeAssistant) -> None: config_entry = MockConfigEntry(**info) config_entry.add_to_hass(hass) - info["state"] = config_entries.ConfigEntryState.NOT_LOADED + info["state"] = "not_loaded" for key, value in info.items(): assert render(