Add icon translations to Utility meter helper (#109656)
This commit is contained in:
parent
945aff6050
commit
f18448950c
4 changed files with 18 additions and 11 deletions
|
@ -1,8 +1,6 @@
|
||||||
"""Constants for the utility meter component."""
|
"""Constants for the utility meter component."""
|
||||||
DOMAIN = "utility_meter"
|
DOMAIN = "utility_meter"
|
||||||
|
|
||||||
TARIFF_ICON = "mdi:clock-outline"
|
|
||||||
|
|
||||||
QUARTER_HOURLY = "quarter-hourly"
|
QUARTER_HOURLY = "quarter-hourly"
|
||||||
HOURLY = "hourly"
|
HOURLY = "hourly"
|
||||||
DAILY = "daily"
|
DAILY = "daily"
|
||||||
|
|
14
homeassistant/components/utility_meter/icons.json
Normal file
14
homeassistant/components/utility_meter/icons.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"entity": {
|
||||||
|
"sensor": {
|
||||||
|
"utility_meter": {
|
||||||
|
"default": "mdi:counter"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"select": {
|
||||||
|
"tariff": {
|
||||||
|
"default": "mdi:clock-outline"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,13 +13,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
from homeassistant.helpers.restore_state import RestoreEntity
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from .const import (
|
from .const import CONF_METER, CONF_SOURCE_SENSOR, CONF_TARIFFS, DATA_UTILITY
|
||||||
CONF_METER,
|
|
||||||
CONF_SOURCE_SENSOR,
|
|
||||||
CONF_TARIFFS,
|
|
||||||
DATA_UTILITY,
|
|
||||||
TARIFF_ICON,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -100,6 +94,8 @@ async def async_setup_platform(
|
||||||
class TariffSelect(SelectEntity, RestoreEntity):
|
class TariffSelect(SelectEntity, RestoreEntity):
|
||||||
"""Representation of a Tariff selector."""
|
"""Representation of a Tariff selector."""
|
||||||
|
|
||||||
|
_attr_translation_key = "tariff"
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
name,
|
name,
|
||||||
|
@ -113,7 +109,6 @@ class TariffSelect(SelectEntity, RestoreEntity):
|
||||||
self._attr_device_info = device_info
|
self._attr_device_info = device_info
|
||||||
self._current_tariff: str | None = None
|
self._current_tariff: str | None = None
|
||||||
self._tariffs = tariffs
|
self._tariffs = tariffs
|
||||||
self._attr_icon = TARIFF_ICON
|
|
||||||
self._attr_should_poll = False
|
self._attr_should_poll = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -362,7 +362,7 @@ class UtilitySensorExtraStoredData(SensorExtraStoredData):
|
||||||
class UtilityMeterSensor(RestoreSensor):
|
class UtilityMeterSensor(RestoreSensor):
|
||||||
"""Representation of an utility meter sensor."""
|
"""Representation of an utility meter sensor."""
|
||||||
|
|
||||||
_attr_icon = "mdi:counter"
|
_attr_translation_key = "utility_meter"
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
Loading…
Add table
Reference in a new issue