Badge Weather with dynamic Icon and temperature in label

Hey,

I’d like to do this Weather badge like in this picture (4th), with the dynamic icon based on weather and the temperature in a label.

Thanks for your help :slight_smile: @Mariusthvdb

a6123dda3de0d246e236acef2ff2466af8dcdf9d

sure, here you go:

its a template sensor:

      weather_animated_icon:
        friendly_name_template: >
          {{states('sensor.dark_sky_forecast_icon')|capitalize|replace('-',' ')}}
        value_template: >
          {{states('sensor.dark_sky_forecast_icon')|capitalize|replace('-',' ')}}
        entity_picture_template: >
          {% set mapper =
            { 'breezy':'cloudy',
              'clear-night':'night',
              'clear':'day',
              'mostly-clear':'day',
              'clear-day':'day',
              'cloudy':'cloudy',
              'fog':'fog',
              'hail':'rainy-7',
              'haze':'haze',
              'lightning':'thunder',
              'mostly-cloudy':'cloudy',
              'partly-cloudy':'cloudy-day-3',
              'partly-cloudy-day':'partly-cloudy-day',
              'partly-cloudy-night':'partly-cloudy-night',
              'rain':'rainy-4',
              'scattered-showers':'rainy-3',
              'showers':'rainy-6',
              'sleet':'sleet',
              'snow':'snowy-6',
              'mostly-sunny':'day',
              'sunny':'day',
              'thunderstorm':'thunder',
              'tornado':'tornado',
              'wind':'wind',
              'windy':'wind'} %}
          {% set state = states('sensor.dark_sky_icon') %}
          {% set weather = mapper[state] if state in mapper else 'weather' %}
          {% set path = '/local/weather/animated/' %}
          {% set ext = '.svg'%}
            {{[path,weather,ext]|join('')}}

using the Amcharts animated icons

the badge label (used for unit_of_measurement) is customized, and in this case with custom-ui.

homeassistant:
  customize:
    sensor.weather_animated_icon:
      templates:
        unit_of_measurement: >
          if (entities['sensor.temp_current'])
          return entities['sensor.temp_current'].state +' °C';
          return 'Initializing';

cheers!

we might ask @Ildar_Gabdullin whether our journey with card-mod’ing the badges also enables the template for the temperature in the label.

card-mod is a modern way of modding the HA frontend.

Cannot check it by myself since I have not installed Custom_UI so far…
But here there is a description of styling badges - and I think this will work with templates as well, need to try.

Hey @Mariusthvdb,

So i have been trying to set this badge.
I put the animated icons in the /local/weather/animated folder
And when i restarted home assistant sensor.weather_animated_icon is Unknown.
I haven’t setup custom yet.
Best regards