From 8af7475f73ff0c2d49d091d9f312e038b37ce90a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 12 Sep 2023 12:36:56 -0500 Subject: [PATCH] Set TriggerBaseEntity device_class in init (#100216) --- homeassistant/helpers/trigger_template_entity.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/homeassistant/helpers/trigger_template_entity.py b/homeassistant/helpers/trigger_template_entity.py index 0ee653b42bdfc6..bc7deceefefa74 100644 --- a/homeassistant/helpers/trigger_template_entity.py +++ b/homeassistant/helpers/trigger_template_entity.py @@ -119,6 +119,7 @@ def __init__( # We make a copy so our initial render is 'unknown' and not 'unavailable' self._rendered = dict(self._static_rendered) self._parse_result = {CONF_AVAILABILITY} + self._attr_device_class = config.get(CONF_DEVICE_CLASS) @property def name(self) -> str | None: @@ -130,11 +131,6 @@ def unique_id(self) -> str | None: """Return unique ID of the entity.""" return self._unique_id - @property - def device_class(self): # type: ignore[no-untyped-def] - """Return device class of the entity.""" - return self._config.get(CONF_DEVICE_CLASS) - @property def icon(self) -> str | None: """Return icon."""