Skip to content

Commit

Permalink
add device class (needed for translations)
Browse files Browse the repository at this point in the history
  • Loading branch information
bruxy70 committed Feb 8, 2022
1 parent c55a1b6 commit 9265c9e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions custom_components/garbage_collection/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
import homeassistant.util.dt as dt_util
from dateutil.parser import ParserError, parse
from dateutil.relativedelta import relativedelta
from homeassistant.const import ATTR_HIDDEN, CONF_ENTITIES, CONF_NAME, WEEKDAYS
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_HIDDEN,
CONF_ENTITIES,
CONF_NAME,
WEEKDAYS,
)
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.discovery import async_load_platform
from homeassistant.helpers.restore_state import RestoreEntity
Expand Down Expand Up @@ -272,10 +278,11 @@ def extra_state_attributes(self):
res[const.ATTR_DAYS] = self._days
res[const.ATTR_LAST_COLLECTION] = self.last_collection
res[const.ATTR_LAST_UPDATED] = self._last_updated
res[ATTR_DEVICE_CLASS] = self.DEVICE_CLASS
return res

@property
def DEVICE_CLASS(self):
def DEVICE_CLASS(self): # pylint: disable=C0103
"""Return the class of the sensor."""
return const.DEVICE_CLASS

Expand Down

0 comments on commit 9265c9e

Please sign in to comment.