Add icon translations to GDACS (#111611)
* Add icon translations to GDACS * Add icon translations to GDACS * Add icon translations to GDACSpull/111709/head
parent
3077039470
commit
cd9219d4c6
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"alerts": {
|
||||
"default": "mdi:alert"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from . import GdacsFeedEntityManager
|
||||
from .const import DEFAULT_ICON, DOMAIN, FEED
|
||||
from .const import DOMAIN, FEED
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -48,10 +48,10 @@ class GdacsSensor(SensorEntity):
|
|||
"""Status sensor for the GDACS integration."""
|
||||
|
||||
_attr_should_poll = False
|
||||
_attr_icon = DEFAULT_ICON
|
||||
_attr_native_unit_of_measurement = DEFAULT_UNIT_OF_MEASUREMENT
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = None
|
||||
_attr_translation_key = "alerts"
|
||||
|
||||
def __init__(
|
||||
self, config_entry: ConfigEntry, manager: GdacsFeedEntityManager
|
||||
|
|
|
@ -15,7 +15,6 @@ from homeassistant.components.gdacs.sensor import (
|
|||
ATTR_UPDATED,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ICON,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
CONF_LATITUDE,
|
||||
CONF_LONGITUDE,
|
||||
|
@ -101,7 +100,6 @@ async def test_setup(hass: HomeAssistant) -> None:
|
|||
assert attributes[ATTR_LAST_UPDATE_SUCCESSFUL].tzinfo == dt_util.UTC
|
||||
assert attributes[ATTR_LAST_UPDATE] == attributes[ATTR_LAST_UPDATE_SUCCESSFUL]
|
||||
assert attributes[ATTR_UNIT_OF_MEASUREMENT] == "alerts"
|
||||
assert attributes[ATTR_ICON] == "mdi:alert"
|
||||
|
||||
# Simulate an update - two existing, one new entry, one outdated entry
|
||||
mock_feed_update.return_value = "OK", [mock_entry_1, mock_entry_4, mock_entry_3]
|
||||
|
|
Loading…
Reference in New Issue