From 11931cdb5669c0e1b59c0541c92847358427663c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 17 Apr 2024 14:28:09 -0500 Subject: [PATCH] Simplify labels and areas template calls (#115673) The labels and areas are already exposed on the object --- homeassistant/helpers/template.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index d344a473494..1f0742e896d 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -1453,8 +1453,7 @@ def floor_areas(hass: HomeAssistant, floor_id_or_name: str) -> Iterable[str]: def areas(hass: HomeAssistant) -> Iterable[str | None]: """Return all areas.""" - area_reg = area_registry.async_get(hass) - return [area.id for area in area_reg.async_list_areas()] + return list(area_registry.async_get(hass).areas) def area_id(hass: HomeAssistant, lookup_value: str) -> str | None: @@ -1580,7 +1579,7 @@ def labels(hass: HomeAssistant, lookup_value: Any = None) -> Iterable[str | None """Return all labels, or those from a area ID, device ID, or entity ID.""" label_reg = label_registry.async_get(hass) if lookup_value is None: - return [label.label_id for label in label_reg.async_list_labels()] + return list(label_reg.labels) ent_reg = entity_registry.async_get(hass)