Add icon translations to Waze Travel Time (#112352)

* Add icon translations to Waze Travel Time

* Fix tests
This commit is contained in:
Joost Lekkerkerker 2024-03-06 23:06:41 +01:00 committed by GitHub
parent 581a4f82b2
commit 74dabff4a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View File

@ -0,0 +1,9 @@
{
"entity": {
"sensor": {
"waze_travel_time": {
"default": "mdi:car"
}
}
}
}

View File

@ -90,6 +90,7 @@ class WazeTravelTime(SensorEntity):
identifiers={(DOMAIN, DOMAIN)}, identifiers={(DOMAIN, DOMAIN)},
configuration_url="https://www.waze.com", configuration_url="https://www.waze.com",
) )
_attr_translation_key = "waze_travel_time"
def __init__( def __init__(
self, self,
@ -105,7 +106,6 @@ class WazeTravelTime(SensorEntity):
self._attr_name = name self._attr_name = name
self._origin = origin self._origin = origin
self._destination = destination self._destination = destination
self._attr_icon = "mdi:car"
self._state = None self._state = None
async def async_added_to_hass(self) -> None: async def async_added_to_hass(self) -> None:

View File

@ -74,7 +74,6 @@ async def test_sensor(hass: HomeAssistant) -> None:
hass.states.get("sensor.waze_travel_time").attributes["unit_of_measurement"] hass.states.get("sensor.waze_travel_time").attributes["unit_of_measurement"]
== "min" == "min"
) )
assert hass.states.get("sensor.waze_travel_time").attributes["icon"] == "mdi:car"
@pytest.mark.parametrize( @pytest.mark.parametrize(