From a8cbfe5159b48f37c7a9e09da931767bd9ac8ad8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 21 Jul 2024 07:49:59 -0500 Subject: [PATCH] Make TemplateStateBase.entity_id a cached_property (#122279) --- homeassistant/helpers/template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index c21523baa38..7742418c5a7 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -10,7 +10,7 @@ from collections.abc import Callable, Generator, Iterable from contextlib import AbstractContextManager from contextvars import ContextVar from datetime import date, datetime, time, timedelta -from functools import cache, lru_cache, partial, wraps +from functools import cache, cached_property, lru_cache, partial, wraps import json import logging import math @@ -1022,7 +1022,7 @@ class TemplateStateBase(State): return self.state_with_unit raise KeyError - @property + @cached_property def entity_id(self) -> str: # type: ignore[override] """Wrap State.entity_id.