mirror of
https://github.com/home-assistant/core.git
synced 2025-12-25 05:26:47 +00:00
Fix area_id and area_name template functions (#55470)
This commit is contained in:
@@ -1828,6 +1828,16 @@ async def test_area_id(hass):
|
||||
assert_result_info(info, area_entry_entity_id.id)
|
||||
assert info.rate_limit is None
|
||||
|
||||
# Make sure that when entity doesn't have an area but its device does, that's what
|
||||
# gets returned
|
||||
entity_entry = entity_registry.async_update_entity(
|
||||
entity_entry.entity_id, area_id=area_entry_entity_id.id
|
||||
)
|
||||
|
||||
info = render_to_info(hass, f"{{{{ area_id('{entity_entry.entity_id}') }}}}")
|
||||
assert_result_info(info, area_entry_entity_id.id)
|
||||
assert info.rate_limit is None
|
||||
|
||||
|
||||
async def test_area_name(hass):
|
||||
"""Test area_name function."""
|
||||
@@ -1897,6 +1907,16 @@ async def test_area_name(hass):
|
||||
assert_result_info(info, area_entry.name)
|
||||
assert info.rate_limit is None
|
||||
|
||||
# Make sure that when entity doesn't have an area but its device does, that's what
|
||||
# gets returned
|
||||
entity_entry = entity_registry.async_update_entity(
|
||||
entity_entry.entity_id, area_id=None
|
||||
)
|
||||
|
||||
info = render_to_info(hass, f"{{{{ area_name('{entity_entry.entity_id}') }}}}")
|
||||
assert_result_info(info, area_entry.name)
|
||||
assert info.rate_limit is None
|
||||
|
||||
|
||||
def test_closest_function_to_coord(hass):
|
||||
"""Test closest function to coord."""
|
||||
|
||||
Reference in New Issue
Block a user