mirror of
https://github.com/home-assistant/core
synced 2024-10-01 05:30:36 +02:00
USGS Earthquakes icon for geolocation entities (#26353)
* define icon * updated tests * added codeowner * updated codeowners
This commit is contained in:
parent
7a171dae33
commit
ecaadfed3a
@ -289,6 +289,7 @@ homeassistant/components/upcloud/* @scop
|
|||||||
homeassistant/components/updater/* @home-assistant/core
|
homeassistant/components/updater/* @home-assistant/core
|
||||||
homeassistant/components/upnp/* @robbiet480
|
homeassistant/components/upnp/* @robbiet480
|
||||||
homeassistant/components/uptimerobot/* @ludeeus
|
homeassistant/components/uptimerobot/* @ludeeus
|
||||||
|
homeassistant/components/usgs_earthquakes_feed/* @exxamalte
|
||||||
homeassistant/components/utility_meter/* @dgomes
|
homeassistant/components/utility_meter/* @dgomes
|
||||||
homeassistant/components/velbus/* @cereal2nd
|
homeassistant/components/velbus/* @cereal2nd
|
||||||
homeassistant/components/velux/* @Julius2342
|
homeassistant/components/velux/* @Julius2342
|
||||||
|
@ -243,6 +243,11 @@ class UsgsEarthquakesEvent(GeolocationEvent):
|
|||||||
self._type = feed_entry.type
|
self._type = feed_entry.type
|
||||||
self._alert = feed_entry.alert
|
self._alert = feed_entry.alert
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon(self):
|
||||||
|
"""Return the icon to use in the frontend."""
|
||||||
|
return "mdi:pulse"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source(self) -> str:
|
def source(self) -> str:
|
||||||
"""Return source value of this external event."""
|
"""Return source value of this external event."""
|
||||||
|
@ -6,5 +6,7 @@
|
|||||||
"geojson_client==0.4"
|
"geojson_client==0.4"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": []
|
"codeowners": [
|
||||||
|
"@exxamalte"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ from homeassistant.const import (
|
|||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
CONF_LATITUDE,
|
CONF_LATITUDE,
|
||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
|
ATTR_ICON,
|
||||||
)
|
)
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from tests.common import assert_setup_component, async_fire_time_changed
|
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_MAGNITUDE: 5.7,
|
||||||
ATTR_UNIT_OF_MEASUREMENT: "km",
|
ATTR_UNIT_OF_MEASUREMENT: "km",
|
||||||
ATTR_SOURCE: "usgs_earthquakes_feed",
|
ATTR_SOURCE: "usgs_earthquakes_feed",
|
||||||
|
ATTR_ICON: "mdi:pulse",
|
||||||
}
|
}
|
||||||
assert round(abs(float(state.state) - 15.5), 7) == 0
|
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_FRIENDLY_NAME: "Title 2",
|
||||||
ATTR_UNIT_OF_MEASUREMENT: "km",
|
ATTR_UNIT_OF_MEASUREMENT: "km",
|
||||||
ATTR_SOURCE: "usgs_earthquakes_feed",
|
ATTR_SOURCE: "usgs_earthquakes_feed",
|
||||||
|
ATTR_ICON: "mdi:pulse",
|
||||||
}
|
}
|
||||||
assert round(abs(float(state.state) - 20.5), 7) == 0
|
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_FRIENDLY_NAME: "Title 3",
|
||||||
ATTR_UNIT_OF_MEASUREMENT: "km",
|
ATTR_UNIT_OF_MEASUREMENT: "km",
|
||||||
ATTR_SOURCE: "usgs_earthquakes_feed",
|
ATTR_SOURCE: "usgs_earthquakes_feed",
|
||||||
|
ATTR_ICON: "mdi:pulse",
|
||||||
}
|
}
|
||||||
assert round(abs(float(state.state) - 25.5), 7) == 0
|
assert round(abs(float(state.state) - 25.5), 7) == 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user