mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Fix for is_hidden_entity when using it in select, selectattr, reject, and rejectattr (#90512)
fix
This commit is contained in:
parent
2157a4d0fc
commit
01734c0dab
@ -2285,9 +2285,6 @@ class TemplateEnvironment(ImmutableSandboxedEnvironment):
|
||||
self.globals["area_devices"] = hassfunction(area_devices)
|
||||
self.filters["area_devices"] = pass_context(self.globals["area_devices"])
|
||||
|
||||
self.globals["is_hidden_entity"] = hassfunction(is_hidden_entity)
|
||||
self.tests["is_hidden_entity"] = pass_context(self.globals["is_hidden_entity"])
|
||||
|
||||
self.globals["integration_entities"] = hassfunction(integration_entities)
|
||||
self.filters["integration_entities"] = pass_context(
|
||||
self.globals["integration_entities"]
|
||||
@ -2308,6 +2305,7 @@ class TemplateEnvironment(ImmutableSandboxedEnvironment):
|
||||
"closest",
|
||||
"distance",
|
||||
"expand",
|
||||
"is_hidden_entity",
|
||||
"is_state",
|
||||
"is_state_attr",
|
||||
"state_attr",
|
||||
@ -2331,7 +2329,12 @@ class TemplateEnvironment(ImmutableSandboxedEnvironment):
|
||||
"area_name",
|
||||
"has_value",
|
||||
]
|
||||
hass_tests = ["has_value"]
|
||||
hass_tests = [
|
||||
"has_value",
|
||||
"is_hidden_entity",
|
||||
"is_state",
|
||||
"is_state_attr",
|
||||
]
|
||||
for glob in hass_globals:
|
||||
self.globals[glob] = unsupported(glob)
|
||||
for filt in hass_filters:
|
||||
@ -2345,6 +2348,10 @@ class TemplateEnvironment(ImmutableSandboxedEnvironment):
|
||||
self.globals["closest"] = hassfunction(closest)
|
||||
self.filters["closest"] = pass_context(hassfunction(closest_filter))
|
||||
self.globals["distance"] = hassfunction(distance)
|
||||
self.globals["is_hidden_entity"] = hassfunction(is_hidden_entity)
|
||||
self.tests["is_hidden_entity"] = pass_eval_context(
|
||||
self.globals["is_hidden_entity"]
|
||||
)
|
||||
self.globals["is_state"] = hassfunction(is_state)
|
||||
self.tests["is_state"] = pass_eval_context(self.globals["is_state"])
|
||||
self.globals["is_state_attr"] = hassfunction(is_state_attr)
|
||||
|
@ -1463,6 +1463,11 @@ def test_is_hidden_entity(
|
||||
hass,
|
||||
).async_render()
|
||||
|
||||
assert not template.Template(
|
||||
f"{{{{ ['{visible_entity.entity_id}'] | select('is_hidden_entity') | first }}}}",
|
||||
hass,
|
||||
).async_render()
|
||||
|
||||
|
||||
def test_is_state(hass: HomeAssistant) -> None:
|
||||
"""Test is_state method."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user