Add icon translations to Season (#112221)

This commit is contained in:
Joost Lekkerkerker 2024-03-04 16:53:10 +01:00 committed by GitHub
parent 47b7333d99
commit 3c12f6339e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 11 deletions

View file

@ -0,0 +1,15 @@
{
"entity": {
"sensor": {
"season": {
"default": "mdi:cloud",
"state": {
"spring": "mdi:flower",
"summer": "mdi:sunglasses",
"autumn": "mdi:leaf",
"winter": "mdi:snowflake"
}
}
}
}
}

View file

@ -32,13 +32,6 @@ HEMISPHERE_SEASON_SWAP = {
STATE_SUMMER: STATE_WINTER,
}
SEASON_ICONS = {
STATE_SPRING: "mdi:flower",
STATE_SUMMER: "mdi:sunglasses",
STATE_AUTUMN: "mdi:leaf",
STATE_WINTER: "mdi:snowflake",
}
async def async_setup_entry(
hass: HomeAssistant,
@ -113,7 +106,3 @@ class SeasonSensorEntity(SensorEntity):
self._attr_native_value = get_season(
utcnow().replace(tzinfo=None), self.hemisphere, self.type
)
self._attr_icon = "mdi:cloud"
if self._attr_native_value:
self._attr_icon = SEASON_ICONS[self._attr_native_value]