1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-17 23:53:49 +01:00

Fix limited template unsupported lists (#166356)

This commit is contained in:
Artur Pragacz
2026-03-24 18:20:30 +01:00
committed by GitHub
parent 36051d015a
commit a5f9c400cc

View File

@@ -2027,8 +2027,7 @@ class TemplateEnvironment(ImmutableSandboxedEnvironment):
self.filters["config_entry_id"] = self.globals["config_entry_id"]
if limited:
# Only device_entities is available to limited templates, mark other
# functions and filters as unsupported.
def unsupported(name: str) -> Callable[[], NoReturn]:
def warn_unsupported(*args: Any, **kwargs: Any) -> NoReturn:
raise TemplateError(
@@ -2056,6 +2055,10 @@ class TemplateEnvironment(ImmutableSandboxedEnvironment):
"entity_name",
"expand",
"has_value",
"state_attr",
"state_attr_translated",
"state_translated",
"states",
]
hass_tests = [
"has_value",
@@ -2068,7 +2071,7 @@ class TemplateEnvironment(ImmutableSandboxedEnvironment):
for filt in hass_filters:
self.filters[filt] = unsupported(filt)
for test in hass_tests:
self.filters[test] = unsupported(test)
self.tests[test] = unsupported(test)
return
self.globals["closest"] = hassfunction(closest)