r-renato / ha-card-weather-conditions

Weather condition card (Lovelace) for Home Assistant.
MIT License
191 stars 37 forks source link

Pollen values not displaying - HA now receives values of None, Very Low, Low, Medium, High and Very High #69

Open Venom84 opened 3 years ago

Venom84 commented 3 years ago

Hi,

Climacell are reporting the pollen values to HA as the following states. None Very Low Low Medium High Very High

So the numeric method of indicating pollen (0 to 5) doesn't work anymore.

Are you able to please update the integration to fix this?

damiano75 commented 3 years ago

Hi, I've created this templated sensors:

  - platform: template
    sensors:
      cc_<YOUR_CITY>_pollen_grass_mod:
        friendly_name: Pollen Grass <YOUR_CITY>
        icon_template: 'mdi:flower'
        value_template: >-
          {% if is_state('sensor.cc_<YOUR_CITY>_pollen_grass','None') %}
            0
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_grass','Very Low') %}
            1
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_grass','Low') %}
            2
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_grass','Medium') %}
            3
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_grass','High') %}
            4
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_grass','Very High') %}
            5
          {% else %}
            Sconosciuto
          {% endif %}

  - platform: template
    sensors:
      cc_<YOUR_CITY>_pollen_tree_mod:
        friendly_name: Pollen Tree <YOUR_CITY>
        icon_template: 'mdi:tree'
        value_template: >-
          {% if is_state('sensor.cc_<YOUR_CITY>_pollen_tree','None') %}
            0
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_tree','Very Low') %}
            1
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_tree','Low') %}
            2
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_tree','Medium') %}
            3
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_tree','High') %}
            4
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_tree','Very High') %}
            5
          {% else %}
            Sconosciuto
          {% endif %}

  - platform: template
    sensors:
      cc_<YOUR_CITY>_pollen_weed_mod:
        friendly_name: Pollen Weed <YOUR_CITY>
        icon_template: 'mdi:sprout'
        value_template: >-
          {% if is_state('sensor.cc_<YOUR_CITY>_pollen_weed','None') %}
            0
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_weed','Very Low') %}
            1
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_weed','Low') %}
            2
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_weed','Medium') %}
            3
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_weed','High') %}
            4
          {% elif is_state('sensor.cc_<YOUR_CITY>_pollen_weed','Very High') %}
            5
          {% else %}
            Sconosciuto
          {% endif %}

And I used them in the card configuration

Venom84 commented 3 years ago

Thanks so much @damiano75 :-) just applied the template and works like a charm!! Will this fix be integrated into the weather card in the future by any chance? Just trying to figure out if i should close this issue or keep it open.

NicoLouis-be commented 3 years ago

solution works, but had to change 'Very High' to 'very_high' etc.