From 2f9de2a5a50e69123a0e32e9a2130ba2985a2ec5 Mon Sep 17 00:00:00 2001 From: Malte Franken Date: Wed, 4 Sep 2019 11:58:40 +1000 Subject: [PATCH] IGN Sismologia icon for geolocation entities (#26408) * define icon * fixed tests --- homeassistant/components/ign_sismologia/geo_location.py | 5 +++++ tests/components/ign_sismologia/test_geo_location.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/homeassistant/components/ign_sismologia/geo_location.py b/homeassistant/components/ign_sismologia/geo_location.py index 44ba41ea783..057d832b4fa 100644 --- a/homeassistant/components/ign_sismologia/geo_location.py +++ b/homeassistant/components/ign_sismologia/geo_location.py @@ -201,6 +201,11 @@ class IgnSismologiaLocationEvent(GeolocationEvent): self._publication_date = feed_entry.published self._image_url = feed_entry.image_url + @property + def icon(self): + """Return the icon to use in the frontend.""" + return "mdi:pulse" + @property def source(self) -> str: """Return source value of this external event.""" diff --git a/tests/components/ign_sismologia/test_geo_location.py b/tests/components/ign_sismologia/test_geo_location.py index fa3042e9f7a..4babbb6a425 100644 --- a/tests/components/ign_sismologia/test_geo_location.py +++ b/tests/components/ign_sismologia/test_geo_location.py @@ -23,6 +23,7 @@ from homeassistant.const import ( ATTR_ATTRIBUTION, CONF_LATITUDE, CONF_LONGITUDE, + ATTR_ICON, ) from homeassistant.setup import async_setup_component from tests.common import assert_setup_component, async_fire_time_changed @@ -126,6 +127,7 @@ async def test_setup(hass): ATTR_MAGNITUDE: 5.7, ATTR_UNIT_OF_MEASUREMENT: "km", ATTR_SOURCE: "ign_sismologia", + ATTR_ICON: "mdi:pulse", } assert float(state.state) == 15.5 @@ -141,6 +143,7 @@ async def test_setup(hass): ATTR_MAGNITUDE: 4.6, ATTR_UNIT_OF_MEASUREMENT: "km", ATTR_SOURCE: "ign_sismologia", + ATTR_ICON: "mdi:pulse", } assert float(state.state) == 20.5 @@ -156,6 +159,7 @@ async def test_setup(hass): ATTR_REGION: "Region 3", ATTR_UNIT_OF_MEASUREMENT: "km", ATTR_SOURCE: "ign_sismologia", + ATTR_ICON: "mdi:pulse", } assert float(state.state) == 25.5