mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add season icons (#18221)
* Add season icons * Use STATE constants * Calm down hound * Update season.py
This commit is contained in:
parent
087bffeaae
commit
121ec5c684
@ -34,6 +34,13 @@ HEMISPHERE_SEASON_SWAP = {STATE_WINTER: STATE_SUMMER,
|
||||
STATE_AUTUMN: STATE_SPRING,
|
||||
STATE_SUMMER: STATE_WINTER}
|
||||
|
||||
SEASON_ICONS = {
|
||||
STATE_SPRING: 'mdi:flower',
|
||||
STATE_SUMMER: 'mdi:sunglasses',
|
||||
STATE_AUTUMN: 'mdi:leaf',
|
||||
STATE_WINTER: 'mdi:snowflake'
|
||||
}
|
||||
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Optional(CONF_TYPE, default=TYPE_ASTRONOMICAL): vol.In(VALID_TYPES)
|
||||
@ -116,6 +123,11 @@ class Season(Entity):
|
||||
"""Return the current season."""
|
||||
return self.season
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Icon to use in the frontend, if any."""
|
||||
return SEASON_ICONS.get(self.season, 'mdi:cloud')
|
||||
|
||||
def update(self):
|
||||
"""Update season."""
|
||||
self.datetime = datetime.now()
|
||||
|
Loading…
x
Reference in New Issue
Block a user