Set TriggerBaseEntity device_class in init (#100216)

pull/100228/head
J. Nick Koston 2023-09-12 12:36:56 -05:00 committed by GitHub
parent f5c0c7bf27
commit 8af7475f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -119,6 +119,7 @@ class TriggerBaseEntity(Entity):
# 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 @@ class TriggerBaseEntity(Entity):
"""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."""