Make TemplateStateBase.entity_id a cached_property (#122279)
parent
0ab1ccc5ae
commit
a8cbfe5159
|
@ -10,7 +10,7 @@ from collections.abc import Callable, Generator, Iterable
|
||||||
from contextlib import AbstractContextManager
|
from contextlib import AbstractContextManager
|
||||||
from contextvars import ContextVar
|
from contextvars import ContextVar
|
||||||
from datetime import date, datetime, time, timedelta
|
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 json
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
@ -1022,7 +1022,7 @@ class TemplateStateBase(State):
|
||||||
return self.state_with_unit
|
return self.state_with_unit
|
||||||
raise KeyError
|
raise KeyError
|
||||||
|
|
||||||
@property
|
@cached_property
|
||||||
def entity_id(self) -> str: # type: ignore[override]
|
def entity_id(self) -> str: # type: ignore[override]
|
||||||
"""Wrap State.entity_id.
|
"""Wrap State.entity_id.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue