USGS Earthquakes icon for geolocation entities (#26353)

* define icon

* updated tests

* added codeowner

* updated codeowners
This commit is contained in:
Malte Franken 2019-09-02 21:37:12 +10:00 committed by Martin Hjelmare
parent 7a171dae33
commit ecaadfed3a
4 changed files with 13 additions and 1 deletions

View File

@ -289,6 +289,7 @@ homeassistant/components/upcloud/* @scop
homeassistant/components/updater/* @home-assistant/core
homeassistant/components/upnp/* @robbiet480
homeassistant/components/uptimerobot/* @ludeeus
homeassistant/components/usgs_earthquakes_feed/* @exxamalte
homeassistant/components/utility_meter/* @dgomes
homeassistant/components/velbus/* @cereal2nd
homeassistant/components/velux/* @Julius2342

View File

@ -243,6 +243,11 @@ class UsgsEarthquakesEvent(GeolocationEvent):
self._type = feed_entry.type
self._alert = feed_entry.alert
@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."""

View File

@ -6,5 +6,7 @@
"geojson_client==0.4"
],
"dependencies": [],
"codeowners": []
"codeowners": [
"@exxamalte"
]
}

View File

@ -26,6 +26,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
@ -148,6 +149,7 @@ async def test_setup(hass):
ATTR_MAGNITUDE: 5.7,
ATTR_UNIT_OF_MEASUREMENT: "km",
ATTR_SOURCE: "usgs_earthquakes_feed",
ATTR_ICON: "mdi:pulse",
}
assert round(abs(float(state.state) - 15.5), 7) == 0
@ -161,6 +163,7 @@ async def test_setup(hass):
ATTR_FRIENDLY_NAME: "Title 2",
ATTR_UNIT_OF_MEASUREMENT: "km",
ATTR_SOURCE: "usgs_earthquakes_feed",
ATTR_ICON: "mdi:pulse",
}
assert round(abs(float(state.state) - 20.5), 7) == 0
@ -174,6 +177,7 @@ async def test_setup(hass):
ATTR_FRIENDLY_NAME: "Title 3",
ATTR_UNIT_OF_MEASUREMENT: "km",
ATTR_SOURCE: "usgs_earthquakes_feed",
ATTR_ICON: "mdi:pulse",
}
assert round(abs(float(state.state) - 25.5), 7) == 0