Dynamic icon for sensor.season?

Hi fellow Home Assistant users!

I’ve set up the season sensor a long time ago but only now noticed that it has the default eye icon:


Would it be possible to configure an icon which changes based on the state? I tried adding icon_template to both the sensor itself and customize.yaml but none of those changes seem to be picked up:

- platform: season
  icon_template: >
    '{% if is_state("sensor.season", "autumn") %}
    {% elif is_state("sensor.season", "winter") %}
    {% elif is_state("sensor.season", "spring") %}
    {% elif is_state("sensor.season", "summer") %}
    {% else %}
    {% endif %}'

I could always create a new template sensor and base it off of the sensor.season’s state but that seems rather hacky.

1 Like

you can’t use template_icon in customise and the season sensor doesn’t accept it either.
Only way to achieve this is to create a template_sensor that extracts the season sensor’s state and set a template_icon there

Aaah too bad. Wish this could be done but will solve with a template sensor then. Or maybe if I find the time, create a PR to add this functionality.

This is actually a good idea, opened a PR to implement this: https://github.com/home-assistant/home-assistant/pull/18221

1 Like

Whoa nice, such a simple change it seems. Thank you!