dnguyen800 / air-visual-card

A Lovelace card showing air quality data from airvisual.com. Requires the AirVisual component.
MIT License
103 stars 35 forks source link

air_pollution_level does not work with template sensor #44

Closed Th30wl closed 3 years ago

Th30wl commented 3 years ago

I have the following template sensor that I use to translate the pollution level to my language:

- platform: template
  sensors:
    pollution_level_translated:
      friendly_name: "Kvalitet Vazduha"
      value_template: >
        {% if states("sensor.u_s_air_quality_index")|int <= 50 %}
          Dobar
        {% elif  states("sensor.u_s_air_quality_index")|int <= 100 %}
          Malo zagađen
        {% elif  states("sensor.u_s_air_quality_index")|int <= 150 %}
          Nezdrav za hronične bolesnike
        {% elif  states("sensor.u_s_air_quality_index")|int <= 200 %}
          Nezdrav
        {% elif  states("sensor.u_s_air_quality_index")|int <= 300 %}
          Veoma nezdrav
        {% else %}
          Opasno zagađen
        {% endif % }

However setting air_pollution_level still shows the text in English:

image