Cache entity properties that are never expected to change in the base class (#95315)

This commit is contained in:
J. Nick Koston 2023-09-14 17:48:48 -05:00 committed by GitHub
parent 5f20725fd5
commit 042776ebb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 146 additions and 48 deletions

View file

@ -8,6 +8,7 @@ from typing import final
import voluptuous as vol
from homeassistant.backports.functools import cached_property
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TIME
from homeassistant.core import HomeAssistant, ServiceCall
@ -75,7 +76,7 @@ class TimeEntity(Entity):
_attr_device_class: None = None
_attr_state: None = None
@property
@cached_property
@final
def device_class(self) -> None:
"""Return the device class for the entity."""