mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
NSW Rural Fire Service icon for geolocation entities (#26416)
* define icon * add myself as codeowner
This commit is contained in:
parent
c191551091
commit
d1bc0c1dd9
@ -191,6 +191,7 @@ homeassistant/components/no_ip/* @fabaff
|
|||||||
homeassistant/components/notify/* @home-assistant/core
|
homeassistant/components/notify/* @home-assistant/core
|
||||||
homeassistant/components/notion/* @bachya
|
homeassistant/components/notion/* @bachya
|
||||||
homeassistant/components/nsw_fuel_station/* @nickw444
|
homeassistant/components/nsw_fuel_station/* @nickw444
|
||||||
|
homeassistant/components/nsw_rural_fire_service_feed/* @exxamalte
|
||||||
homeassistant/components/nuki/* @pschmitt
|
homeassistant/components/nuki/* @pschmitt
|
||||||
homeassistant/components/nws/* @MatthewFlamm
|
homeassistant/components/nws/* @MatthewFlamm
|
||||||
homeassistant/components/ohmconnect/* @robbiet480
|
homeassistant/components/ohmconnect/* @robbiet480
|
||||||
|
@ -210,6 +210,13 @@ class NswRuralFireServiceLocationEvent(GeolocationEvent):
|
|||||||
self._size = feed_entry.size
|
self._size = feed_entry.size
|
||||||
self._responsible_agency = feed_entry.responsible_agency
|
self._responsible_agency = feed_entry.responsible_agency
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon(self):
|
||||||
|
"""Return the icon to use in the frontend."""
|
||||||
|
if self._fire:
|
||||||
|
return "mdi:fire"
|
||||||
|
return "mdi:alarm-light"
|
||||||
|
|
||||||
@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"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ from homeassistant.const import (
|
|||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_RADIUS,
|
CONF_RADIUS,
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
|
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
|
||||||
@ -150,6 +151,7 @@ async def test_setup(hass):
|
|||||||
ATTR_RESPONSIBLE_AGENCY: "Agency 1",
|
ATTR_RESPONSIBLE_AGENCY: "Agency 1",
|
||||||
ATTR_UNIT_OF_MEASUREMENT: "km",
|
ATTR_UNIT_OF_MEASUREMENT: "km",
|
||||||
ATTR_SOURCE: "nsw_rural_fire_service_feed",
|
ATTR_SOURCE: "nsw_rural_fire_service_feed",
|
||||||
|
ATTR_ICON: "mdi:fire",
|
||||||
}
|
}
|
||||||
assert round(abs(float(state.state) - 15.5), 7) == 0
|
assert round(abs(float(state.state) - 15.5), 7) == 0
|
||||||
|
|
||||||
@ -164,6 +166,7 @@ async def test_setup(hass):
|
|||||||
ATTR_FIRE: False,
|
ATTR_FIRE: False,
|
||||||
ATTR_UNIT_OF_MEASUREMENT: "km",
|
ATTR_UNIT_OF_MEASUREMENT: "km",
|
||||||
ATTR_SOURCE: "nsw_rural_fire_service_feed",
|
ATTR_SOURCE: "nsw_rural_fire_service_feed",
|
||||||
|
ATTR_ICON: "mdi:alarm-light",
|
||||||
}
|
}
|
||||||
assert round(abs(float(state.state) - 20.5), 7) == 0
|
assert round(abs(float(state.state) - 20.5), 7) == 0
|
||||||
|
|
||||||
@ -178,6 +181,7 @@ async def test_setup(hass):
|
|||||||
ATTR_FIRE: True,
|
ATTR_FIRE: True,
|
||||||
ATTR_UNIT_OF_MEASUREMENT: "km",
|
ATTR_UNIT_OF_MEASUREMENT: "km",
|
||||||
ATTR_SOURCE: "nsw_rural_fire_service_feed",
|
ATTR_SOURCE: "nsw_rural_fire_service_feed",
|
||||||
|
ATTR_ICON: "mdi:fire",
|
||||||
}
|
}
|
||||||
assert round(abs(float(state.state) - 25.5), 7) == 0
|
assert round(abs(float(state.state) - 25.5), 7) == 0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user