mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Queensland Bushfire Alert icon for geolocation entities (#26439)
* define icon * reordered const imports
This commit is contained in:
parent
f7dc537275
commit
a000125729
@ -198,6 +198,11 @@ class QldBushfireLocationEvent(GeolocationEvent):
|
|||||||
self._updated_date = feed_entry.updated
|
self._updated_date = feed_entry.updated
|
||||||
self._status = feed_entry.status
|
self._status = feed_entry.status
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon(self):
|
||||||
|
"""Return the icon to use in the frontend."""
|
||||||
|
return "mdi:fire"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source(self) -> str:
|
def source(self) -> str:
|
||||||
"""Return source value of this external event."""
|
"""Return source value of this external event."""
|
||||||
|
@ -5,23 +5,24 @@ from unittest.mock import patch, MagicMock, call
|
|||||||
from homeassistant.components import geo_location
|
from homeassistant.components import geo_location
|
||||||
from homeassistant.components.geo_location import ATTR_SOURCE
|
from homeassistant.components.geo_location import ATTR_SOURCE
|
||||||
from homeassistant.components.qld_bushfire.geo_location import (
|
from homeassistant.components.qld_bushfire.geo_location import (
|
||||||
ATTR_EXTERNAL_ID,
|
|
||||||
SCAN_INTERVAL,
|
|
||||||
ATTR_CATEGORY,
|
ATTR_CATEGORY,
|
||||||
ATTR_STATUS,
|
ATTR_EXTERNAL_ID,
|
||||||
ATTR_PUBLICATION_DATE,
|
ATTR_PUBLICATION_DATE,
|
||||||
|
ATTR_STATUS,
|
||||||
ATTR_UPDATED_DATE,
|
ATTR_UPDATED_DATE,
|
||||||
|
SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_START,
|
ATTR_ATTRIBUTION,
|
||||||
CONF_RADIUS,
|
ATTR_FRIENDLY_NAME,
|
||||||
|
ATTR_ICON,
|
||||||
ATTR_LATITUDE,
|
ATTR_LATITUDE,
|
||||||
ATTR_LONGITUDE,
|
ATTR_LONGITUDE,
|
||||||
ATTR_FRIENDLY_NAME,
|
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
ATTR_ATTRIBUTION,
|
|
||||||
CONF_LATITUDE,
|
CONF_LATITUDE,
|
||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
|
CONF_RADIUS,
|
||||||
|
EVENT_HOMEASSISTANT_START,
|
||||||
)
|
)
|
||||||
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
|
||||||
@ -122,6 +123,7 @@ async def test_setup(hass):
|
|||||||
ATTR_STATUS: "Status 1",
|
ATTR_STATUS: "Status 1",
|
||||||
ATTR_UNIT_OF_MEASUREMENT: "km",
|
ATTR_UNIT_OF_MEASUREMENT: "km",
|
||||||
ATTR_SOURCE: "qld_bushfire",
|
ATTR_SOURCE: "qld_bushfire",
|
||||||
|
ATTR_ICON: "mdi:fire",
|
||||||
}
|
}
|
||||||
assert float(state.state) == 15.5
|
assert float(state.state) == 15.5
|
||||||
|
|
||||||
@ -135,6 +137,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: "qld_bushfire",
|
ATTR_SOURCE: "qld_bushfire",
|
||||||
|
ATTR_ICON: "mdi:fire",
|
||||||
}
|
}
|
||||||
assert float(state.state) == 20.5
|
assert float(state.state) == 20.5
|
||||||
|
|
||||||
@ -148,6 +151,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: "qld_bushfire",
|
ATTR_SOURCE: "qld_bushfire",
|
||||||
|
ATTR_ICON: "mdi:fire",
|
||||||
}
|
}
|
||||||
assert float(state.state) == 25.5
|
assert float(state.state) == 25.5
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user