How to create a forecast entity from a weather report in .xml?

Yes you will.

I have a very long file in package called arpav.yaml.
I was hoping to have arrived at a good point, look, a part that downloads the bulletins, then rest to extract all the data, all the available sensors, a working arpav weather entity with the current forecasts, but nothing, for future forecasts I can’t figure out how to create that part of the code.

##############################################################
#                                                            #
#                       BINARY_SENSOR                        #
#                                                            #
##############################################################

# diventa ON quanto c'è nuovo bollettino, serve per visualizzazione su scheda
binary_sensor:
  - platform: template
    sensors:
      arpav_nuovo_bollettino:
        entity_id: input_boolean.arpav_nuovo_bollettino
        device_class: update
        value_template: "{{ is_state('input_boolean.arpav_nuovo_bollettino', 'on') }}"
        icon_template: >-
          {% if is_state('input_boolean.arpav_nuovo_bollettino', 'on') %}
            mdi:information-variant
          {% else %}
            mdi:information-outline
          {% endif %}

##############################################################
#                                                            #
#                       SENSORI                              #
#                                                            #
##############################################################

sensor:
# seleziona l'ID dell zona per i sensor restful
  - platform: template
    sensors:
      arpav_zona_id:
        entity_id: input_select.arpav_zona
        icon_template: mdi:target
        value_template: >-
          {% set zona = states('input_select.arpav_zona') %}
          {% if zona == "Dolomiti Nord-Est" %} 0
          {% elif zona == "Dolomiti Sud-Ovest" %} 1
          {% elif zona == "Belluno e Prealpi orientali" %} 2
          {% elif zona == "Prealpi centrali" %} 3
          {% elif zona == "Pedemontana orientale" %} 4
          {% elif zona == "Treviso e pianura orientale" %} 5
          {% elif zona == "Veneziano orientale" %} 6
          {% elif zona == "Prealpi occidentali" %} 7
          {% elif zona == "Vicenza e pedemontana" %} 8
          {% elif zona == "Padova e pianura centrale" %} 9
          {% elif zona == "Venezia e laguna" %} 10
          {% elif zona == "Delta del Po" %} 11
          {% elif zona == "Rovigo e pianura meridionale" %} 12
          {% elif zona == "Verona e pedemontana" %} 13
          {% elif zona == "Area del Garda" %} 14
          {% elif zona == "Litorale nord" %} 15
          {% elif zona == "Litorale centrale" %} 16
          {% else%} 17
          {% endif %}
          
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: ARPAV Bollettino Aggiornamento
    value_template: >
      {% set data_ora = value_json.previsioni.data_aggiornamento['@date'] | default(None) %}
      {% if data_ora is not none %}
        {% set data = data_ora.split(' alle ')[0] %}
        {% set ora = data_ora.split(' alle ')[1].replace('.', ':') %}
        {% set anno_corrente = now().year %}
        {% if data.count('/') == 2 %}
          {{ strptime(data ~ ' ' ~ ora, '%d/%m/%Y %H:%M').strftime('%Y-%m-%dT%H:%M:%S') }}
        {% else %}
          {{ strptime(data ~ '/' ~ anno_corrente ~ ' ' ~ ora, '%d/%m/%Y %H:%M').strftime('%Y-%m-%dT%H:%M:%S') }}
        {% endif %}
      {% else %}
        "nessuno"
      {% endif %}
    scan_interval: 600
      
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: ARPAV Bollettino Emissione
    value_template: >
      {% set data_ora = value_json.previsioni.data_emissione['@date'] %}
      {% set data = data_ora.split(' alle ')[0] %}
      {% set ora = data_ora.split(' alle ')[1].replace('.', ':') %}
      {% set anno_corrente = now().year %}
      {% if data.count('/') == 2 %}
        {{ strptime(data ~ ' ' ~ ora, '%d/%m/%Y %H:%M').strftime('%Y-%m-%dT%H:%M:%S') }}
      {% else %}
        {{ strptime(data ~ '/' ~ anno_corrente ~ ' ' ~ ora, '%d/%m/%Y %H:%M').strftime('%Y-%m-%dT%H:%M:%S') }}
      {% endif %}
    scan_interval: 600

  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_zona
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int]['@name']  }}"
    scan_interval: 600
    
# Prima Mezza Giornata
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_simbolo0
    value_template: >
      {% set url = value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[0].previsione[0]['@value'] | default('Valore non disponibile') %}
      {% if url != 'Valore non disponibile' %}
        {% set file_name = url.split('/')[-1].replace('.png', '') %}
        {% if file_name == 'a1N' %}
          clear-night
        {% elif file_name in ['a4', 'a5', 'a6'] %}
          cloudy
        {% elif file_name in ['f1', 'f2', 'f3', 'f4'] %}
          fog
        {% elif file_name in ['c1', 'c2', 'c3', 'c5', 'c6', 'c7', 'c8', 'c9', 'c10'] %}
          lightning-rainy
        {% elif file_name == 'a3' %}
          partlycloudy
        {% elif file_name in ['b6', 'b7', 'b8', 'b9', 'b10'] %}
          pouring
        {% elif file_name in ['b1', 'b2', 'b3', 'b4', 'b5'] %}
          rainy
        {% elif file_name in ['d1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'd10'] %}
          snowy
        {% elif file_name in ['e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'e10'] %}
          snowy-rainy
        {% elif file_name in ['a1', 'a2'] %}
          sunny
        {% else %}
          "Condizione sconosciuta"
        {% endif %}
      {% else %}
        "Valore non disponibile"
      {% endif %}
    scan_interval: 600

  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_data0
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[0]['@data'] | default('Valore non disponibile') }}"
    scan_interval: 600
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_cielo0
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[0].previsione[1]['@value'] | default('Valore non disponibile') }}"
    scan_interval: 600
    
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_temperatura0
    value_template: >
      {%- set temp_string = value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[0].previsione[2]['@value'] -%}
      {%- set numbers = temp_string | regex_findall('\\d+') -%}
      {%- if numbers | length == 2 -%}
        {{ ((numbers[0] | int + numbers[1] | int) / 2) | round(0) }}
      {%- elif numbers | length == 1 -%}
        {{ numbers[0] | int }}
      {%- else -%}
        Valore non disponibile
      {%- endif -%}
    scan_interval: 600
    unit_of_measurement: "°C"
    device_class: temperature

  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_precipitazioni0
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[0].previsione[3]['@value'] | default('Valore non disponibile') }}"
    scan_interval: 600
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_probabilita0
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[0].previsione[4]['@value'] | default('Valore non disponibile') }}"
    scan_interval: 600

# Seconda Mezza Giornata
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_simbolo1
    value_template: >
      {% set url = value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[1].previsione[0]['@value'] | default('Valore non disponibile') %}
      {% if url != 'Valore non disponibile' %}
        {% set file_name = url.split('/')[-1].replace('.png', '') %}
        {% if file_name == 'a1N' %}
          clear-night
        {% elif file_name in ['a4', 'a5', 'a6'] %}
          cloudy
        {% elif file_name in ['f1', 'f2', 'f3', 'f4'] %}
          fog
        {% elif file_name in ['c1', 'c2', 'c3', 'c5', 'c6', 'c7', 'c8', 'c9', 'c10'] %}
          lightning-rainy
        {% elif file_name == 'a3' %}
          partlycloudy
        {% elif file_name in ['b6', 'b7', 'b8', 'b9', 'b10'] %}
          pouring
        {% elif file_name in ['b1', 'b2', 'b3', 'b4', 'b5'] %}
          rainy
        {% elif file_name in ['d1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'd10'] %}
          snowy
        {% elif file_name in ['e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'e10'] %}
          snowy-rainy
        {% elif file_name in ['a1', 'a2'] %}
          sunny
        {% else %}
          "Condizione sconosciuta"
        {% endif %}
      {% else %}
        "Valore non disponibile"
      {% endif %}
    scan_interval: 600

  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_data1
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[1]['@data'] }}"
    scan_interval: 600
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_cielo1
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[1].previsione[1]['@value'] }}"
    scan_interval: 600
    
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_temperatura1
    value_template: >
      {%- set temp_string = value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[1].previsione[2]['@value'] -%}
      {%- set numbers = temp_string | regex_findall('\\d+') -%}
      {%- if numbers | length == 2 -%}
        {{ ((numbers[0] | int + numbers[1] | int) / 2) | round(0) }}
      {%- elif numbers | length == 1 -%}
        {{ numbers[0] | int }}
      {%- else -%}
        Valore non disponibile
      {%- endif -%}
    scan_interval: 600
    unit_of_measurement: "°C"
    device_class: temperature

  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_precipitazioni1
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[1].previsione[3]['@value']}}"
    scan_interval: 600
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_probabilita1
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[1].previsione[4]['@value']}}"
    scan_interval: 600
    
# terza Mezza Giornata
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_simbolo2
    value_template: >
      {% set url = value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[2].previsione[0]['@value'] | default('Valore non disponibile') %}
      {% if url != 'Valore non disponibile' %}
        {% set file_name = url.split('/')[-1].replace('.png', '') %}
        {% if file_name == 'a1N' %}
          clear-night
        {% elif file_name in ['a4', 'a5', 'a6'] %}
          cloudy
        {% elif file_name in ['f1', 'f2', 'f3', 'f4'] %}
          fog
        {% elif file_name in ['c1', 'c2', 'c3', 'c5', 'c6', 'c7', 'c8', 'c9', 'c10'] %}
          lightning-rainy
        {% elif file_name == 'a3' %}
          partlycloudy
        {% elif file_name in ['b6', 'b7', 'b8', 'b9', 'b10'] %}
          pouring
        {% elif file_name in ['b1', 'b2', 'b3', 'b4', 'b5'] %}
          rainy
        {% elif file_name in ['d1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'd10'] %}
          snowy
        {% elif file_name in ['e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'e10'] %}
          snowy-rainy
        {% elif file_name in ['a1', 'a2'] %}
          sunny
        {% else %}
          "Condizione sconosciuta"
        {% endif %}
      {% else %}
        "Valore non disponibile"
      {% endif %}
    scan_interval: 600

  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_data2
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[2]['@data'] }}"
    scan_interval: 600
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_cielo2
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[2].previsione[1]['@value'] }}"
    scan_interval: 600
    
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_temperatura2
    value_template: >
      {%- set temp_string = value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[2].previsione[2]['@value'] -%}
      {%- set numbers = temp_string | regex_findall('\\d+') -%}
      {%- if numbers | length == 2 -%}
        {{ ((numbers[0] | int + numbers[1] | int) / 2) | round(0) }}
      {%- elif numbers | length == 1 -%}
        {{ numbers[0] | int }}
      {%- else -%}
        Valore non disponibile
      {%- endif -%}
    scan_interval: 600
    unit_of_measurement: "°C"
    device_class: temperature


  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_precipitazioni2
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[2].previsione[3]['@value']}}"
    scan_interval: 600
  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_probabilita2
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[2].previsione[4]['@value']}}"
    scan_interval: 600



# Aggiungi i sensori template separatamente
forecast_hourly_template: >
    {% from 'met_office_codes.jinja' import code2ha %}
    {% from 'direction.jinja' import dir %}
    {% set dh = state_attr('sensor.local_datahub_hourly','timeSeries') %}
    {% set ns = namespace(forecast=[]) %}
    {% for ts in dh -%}
      {% if ts['time']|as_datetime > now() %}
        {% set tsd = { 'datetime': (ts['time']|as_datetime).isoformat(),
                       'condition': code2ha(ts['significantWeatherCode']),
                       'precipitation_probability': ts['probOfPrecipitation'],
                       'wind_bearing': dir(ts['windDirectionFrom10m']),
                       'humidity': ts['screenRelativeHumidity'],
                       'pressure': ts['mslp'],
                       'uv_index': ts['uvIndex'],
                       'temperature': ts['screenTemperature']|round(0),
                       'apparent_temperature': ts['feelsLikeTemperature']|round(0),
                       'wind_speed': ts['windSpeed10m']|round(0) } -%}
        {% set ns.forecast = ns.forecast + [tsd] -%}
      {% endif %}
    {% endfor %}
    {{ ns.forecast }}







    
##############################################################
#                                                            #
#                       INPUT                                #
#                                                            #
##############################################################

# memorizza ultimo aggiornamento bollettino
input_text:
  arpav_data_ultimo_aggiornamento:
    name: ARPAV Data Ultimo Aggiornamento

# Diventa ON quando viene emesso un nuovo bollettino o un nuovo aggiornamento
input_boolean:
  arpav_nuovo_bollettino:
    name: ARPAV Nuovo Bollettino

# Selettore Zone presenti nel bollettino. Cambiare initial con la zona preferita
# altrimenti prende la prima della lista
input_select:
  arpav_zona:
    name: ARPAV Zona
    options:
      - "Dolomiti Nord-Est"
      - "Dolomiti Sud-Ovest"
      - "Belluno e Prealpi orientali"
      - "Prealpi centrali"
      - "Pedemontana orientale"
      - "Treviso e pianura orientale"
      - "Veneziano orientale"
      - "Prealpi occidentali"
      - "Vicenza e pedemontana"
      - "Padova e pianura centrale"
      - "Venezia e laguna"
      - "Delta del Po"
      - "Rovigo e pianura meridionale"
      - "Verona e pedemontana"
      - "Area del Garda"
      - "Litorale nord"
      - "Litorale centrale"
      - "Litorale sud"
    icon: mdi:target
    initial: "Padova e pianura centrale"
##############################################################
#                                                            #
#                       SCRIPT                               #
#                                                            #
##############################################################

script:
  bollettino_popup:
    sequence:
      - service: input_boolean.turn_off
        data: 
          entity_id: input_boolean.arpav_nuovo_bollettino

##############################################################
#                                                            #
#                  AUTOMAZIONI                               #
#                                                            #
##############################################################

automation:
# Mette ON input_boolean.arpav_nuovo_bollettino quando cambia la data rispetto 
# all'ultimo aggiornamento contenuta in input_text.arpav_data_ultimo_aggiornamento
  - id: '1575837712577'
    mode: single
    alias: Aggiornamento bollettino ARPAV
    trigger:
    - platform: template
      value_template: "{{ states('sensor.arpav_bollettino_aggiornamento') != states('input_text.arpav_data_ultimo_aggiornamento') }}" 
    condition: []
    action:
    - data: {}
      entity_id: input_boolean.arpav_nuovo_bollettino
      service: input_boolean.turn_on
    - data_template:
        value: "{{states('sensor.arpav_bollettino_aggiornamento')}}"
      entity_id: input_text.arpav_data_ultimo_aggiornamento
      service: input_text.set_value

# Aggiorna i sensori sensor.arpav_xxxx dopo ogni cambio di stato del selettore input_select.arpav_zona
# e mette ON input_boolean.arpav_nuovo_bollettino
  - id: '1575837712578'
    mode: single 
    alias: aggiorna sensori ARPAV
    trigger:
      platform: state
      entity_id: input_select.arpav_zona
    action:
    -  service: homeassistant.update_entity
       entity_id:
         - sensor.arpav_zona
         - sensor.arpav_data0
         - sensor.arpav_simbolo0
         - sensor.arpav_cielo0
         - sensor.arpav_temperatura0
         - sensor.arpav_precipitazioni0
         - sensor.arpav_probabilita0
         - sensor.arpav_data1
         - sensor.arpav_simbolo1
         - sensor.arpav_cielo1
         - sensor.arpav_temperatura1
         - sensor.arpav_precipitazioni1
         - sensor.arpav_probabilita1
         - sensor.arpav_data2
         - sensor.arpav_simbolo2
         - sensor.arpav_cielo2
         - sensor.arpav_temperatura2
         - sensor.arpav_precipitazioni2
         - sensor.arpav_probabilita2
    - data: {}
      entity_id: input_boolean.arpav_nuovo_bollettino
      service: input_boolean.turn_on


weather:
  - platform: template
    name: Meteo ARPAV
    condition_template: "{{ states('sensor.arpav_simbolo0') }}"
    temperature_template: "{{ states('sensor.arpav_temperatura0') }}"
    humidity_template: "{{ states('sensor.giardino_umidita') }}"

this really escapes me and I don’t understand, I think I’ll have to give up for the second time

forecast_hourly_template: >
    {% from 'met_office_codes.jinja' import code2ha %}
    {% from 'direction.jinja' import dir %}
    {% set dh = state_attr('sensor.local_datahub_hourly','timeSeries') %}
    {% set ns = namespace(forecast=[]) %}
    {% for ts in dh -%}
      {% if ts['time']|as_datetime > now() %}
        {% set tsd = { 'datetime': (ts['time']|as_datetime).isoformat(),
                       'condition': code2ha(ts['significantWeatherCode']),
                       'precipitation_probability': ts['probOfPrecipitation'],
                       'wind_bearing': dir(ts['windDirectionFrom10m']),
                       'humidity': ts['screenRelativeHumidity'],
                       'pressure': ts['mslp'],
                       'uv_index': ts['uvIndex'],
                       'temperature': ts['screenTemperature']|round(0),
                       'apparent_temperature': ts['feelsLikeTemperature']|round(0),
                       'wind_speed': ts['windSpeed10m']|round(0) } -%}
        {% set ns.forecast = ns.forecast + [tsd] -%}
      {% endif %}
    {% endfor %}
    {{ ns.forecast }}

For starters, you need to make a template weather entity. You just copied and pasted what troon wrote into your configuration.

yes exactly, I copied and pasted saying “I don’t understand this thing”. I understand that I have to create a weather template entity, I will still have to study to understand how

How have you created any other template entity? Note your file has other examples of other templates. e.g. your binary sensor starts with

And the template weather documents show:

Yet you just copied and pasted

thanks again for your patience, little by little I hope to succeed!
I created this:

weather:
  - platform: template
    name: Meteo ARPAV
    condition_template: "{{ states('sensor.arpav_simbolo1') }}"
    temperature_template: "{{ states('sensor.arpav_temperatura1') }}"
    humidity_template: "{{ states('sensor.giardino_umidita') }}"
    forecast_daily_template: "{{ states('sensor.forecast_arpav') }}"

then I also created a template, hoping it works, as a test:

  - platform: template
    sensors:
      forecast_arpav:
        friendly_name: "Forecast ARPAV"
        unique_id: forecast_arpav
        value_template: >
          {% set ns = namespace(forecast=[]) %}
          {% set simbolo = states('sensor.arpav_simbolo1') %}
          {% set temperatura = states('sensor.arpav_temperatura1') %}
          {% set precipitazioni = states('sensor.arpav_precipitazioni1') %}
          {% set probabilita_precipitazioni = states('sensor.arpav_probabilita1') %}
          {% set cielo = states('sensor.arpav_cielo2') %}
          
          {% if simbolo != 'Valore non disponibile' and temperatura != 'Valore non disponibile' %}
            {% set tsd = {
              'datetime': now().isoformat(),
              'condition': simbolo,
              'temperature': temperatura,
              'precipitation_probability': probabilita_precipitazioni,
              'precipitation': precipitazioni,
              'sky_condition': cielo
            } %}
            {% set ns.forecast = ns.forecast + [tsd] %}
          {% endif %}
          
          {{ ns.forecast }}

image
at least now I managed to save my arpav.yaml file without errors and restart home assistant.
The weather entity is created, but no forecast, I think there are definitely errors in my template. Now I just have to figure out how to generate it correctly, I have the data, I just have to figure out how to make home assistant understand it

Paste that whole template into Developer Tools / Template and see what it generates.

You should be looking for a state of 'unavailable' — the front end might translate it into Valore non disponibile but the template will look for the “real” state.

this:

  - platform: template
    sensors:
      forecast_arpav:
        friendly_name: "Forecast ARPAV"
        unique_id: forecast_arpav
        value_template: >
          {% set ns = namespace(forecast=[]) %}
          {% set simbolo = states('sensor.arpav_simbolo1') %}
          {% set temperatura = states('sensor.arpav_temperatura1') %}
          {% set precipitazioni = states('sensor.arpav_precipitazioni1') %}
          {% set probabilita_precipitazioni = states('sensor.arpav_probabilita1') %}
          {% set cielo = states('sensor.arpav_cielo2') %}
          
          {% if simbolo != 'Valore non disponibile' and temperatura != 'Valore non disponibile' %}
            {% set tsd = {
              'datetime': now().isoformat(),
              'condition': simbolo,
              'temperature': temperatura,
              'precipitation_probability': probabilita_precipitazioni,
              'precipitation': precipitazioni,
              'sky_condition': cielo
            } %}
            {% set ns.forecast = ns.forecast + [tsd] %}
          {% endif %}
          
          {{ ns.forecast }}

answer:

Tipo di risultato: string
- platform: template
    sensors:
      forecast_arpav:
        friendly_name: "Forecast ARPAV"
        unique_id: forecast_arpav
        value_template: >
          
          
          
          
          
          
          
          
            
            
          
          
          [{'datetime': '2024-10-15T22:30:00.388459+02:00', 'condition': 'cloudy', 'temperature': '12', 'precipitation_probability': '20%', 'precipitation': 'Deboli piogge sparse', 'sky_condition': 'Nuvoloso o molto nuvoloso'}]

OK, that’s a good start. You only have one forecast entry, but that’s to be expected as you have no for loop. You’ll need to fix the precipitation_probability, which must just be a number. Either do that in the original sensor or in your template like this:

          {% set precipitazioni = states('sensor.arpav_precipitazioni1')|replace('%','') %}

Maybe I’m taking crazy pills, but that configuration is back to a template sensor, not weather entity.

I can’t comment on the pills, but you’re right.

@Diegocampy — this must be a forecast_daily_template: (or hourly) under a template weather entity. Look at the docs again:

I’m having trouble understanding what to do. I’ll try to reread these messages tomorrow. I’m not a programmer, and my English isn’t very strong, so both things together are really confusing me.

In this post, you created:

weather:
  - platform: template
    name: Meteo ARPAV
    condition_template: "{{ states('sensor.arpav_simbolo1') }}"
    temperature_template: "{{ states('sensor.arpav_temperatura1') }}"
    humidity_template: "{{ states('sensor.giardino_umidita') }}"
    forecast_daily_template: "{{ states('sensor.forecast_arpav') }}"
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The forecast_daily_template is set to the state of your template sensor.forecast_arpav. That won’t work. You need to put the template directly into the weather entity instead, like this:

weather:
  - platform: template
    name: Meteo ARPAV
    condition_template: "{{ states('sensor.arpav_simbolo1') }}"
    temperature_template: "{{ states('sensor.arpav_temperatura1') }}"
    humidity_template: "{{ states('sensor.giardino_umidita') }}"
    forecast_daily_template: >
      {% set ns = namespace(forecast=[]) %}
      {% set simbolo = states('sensor.arpav_simbolo1') %}
      {% set temperatura = states('sensor.arpav_temperatura1') %}
      {% set precipitazioni = states('sensor.arpav_precipitazioni1') %}
      {% set probabilita_precipitazioni = states('sensor.arpav_probabilita1')|replace('%','') %}
      {% set cielo = states('sensor.arpav_cielo2') %}
      etc...

The state of a sensor is an up-to-255 character string, but you need a complex object.

Work on your template in the editor so that it produces an output with a structure exactly like the example in my post above, then copy that template into your weather entity.

I @Troon I have several doubts so I try to report them separately on each point to ask for your help to solve them:

regarding the rain, the ARPAV station gives me two different data:

<previsione title="Precipitazioni" type="text" value="Generalmente assenti"/>
<previsione title="Probabilita' precipitazione" type="text" value="0%"/>

(precipitation percentage and precipitation probability with a text.)
Can Weather handle both? It seems like a duplicate of the same thing, maybe I could just use the probability?

I get the data with this rest

  - platform: rest
    resource: https://www.arpa.veneto.it/previsioni/it/xml/bollettino_utenti.xml
    name: arpav_probabilita0
    value_template: "{{ value_json.previsioni.meteogrammi.meteogramma[states('sensor.arpav_zona_id')|int].scadenza[0].previsione[4]['@value'] | default('Valore non disponibile') }}"
    scan_interval: 600
{% set precipitazioni = states('sensor.arpav_probabilita1')|replace('%','') %}

Well, the result could be this: my doubts written in the code after the # symbol

weather:
  - platform: template
    name: Meteo ARPAV
    condition_template: "{{ states('sensor.arpav_simbolo0') }}"
    temperature_template: "{{ states('sensor.arpav_temperatura0') }}"
    humidity_template: "{{ states('sensor.giardino_umidita') }}"
    forecast_daily_template: >
      {% set ns = namespace(forecast=[]) %}
      {% set simbolo = states('sensor.arpav_simbolo1') %}
      {% set temperatura = states('sensor.arpav_temperatura1') %}
      {% set precipitazioni = states('sensor.arpav_precipitazioni1') %} #Could I eliminate one of these two entities?
      {% set probabilita_precipitazioni = states('sensor.arpav_probabilita1')|replace('%','') %} #Could I eliminate one of these two entities?
      {% set cielo = states('sensor.arpav_cielo1') %}
      {% if simbolo != 'unavailable' and temperatura != 'unavailable' %}
            {% set tsd = {
              'datetime': now().isoformat(),
              'condition': simbolo,
              'temperature': temperatura,
              'precipitation_probability': probabilita_precipitazioni, #Could I eliminate one of these two entities?
              'precipitation': precipitazioni, #Could I eliminate one of these two entities?
              'sky_condition': cielo
            } %}
            {% set ns.forecast = ns.forecast + [tsd] %}
          {% endif %}
          
          {{ ns.forecast }}

I don’t have any other important information, only
“snow level”
“reliability”
which I don’t think makes sense to include, so that code could be ok?
i think NO! I don’t know what’s wrong, Only the current weather always appears, nothing about future forecasts
image

If this is the weather code,
all the template code I had done before, and that I had put in my package file, do I have to delete it? I’m talking about this:

  - platform: template
    sensors:
      forecast_arpav:
        friendly_name: "Forecast ARPAV"
        unique_id: forecast_arpav
        value_template: >
          {% set ns = namespace(forecast=[]) %}
          {% set simbolo = states('sensor.arpav_simbolo1') %}
          {% set temperatura = states('sensor.arpav_temperatura1') %}
          {% set precipitazioni = states('sensor.arpav_precipitazioni1') %}
          {% set probabilita_precipitazioni = states('sensor.arpav_probabilita1') %}
          {% set cielo = states('sensor.arpav_cielo2') %}
          
          {% if simbolo != 'unavailable' and temperatura != 'unavailable' %}
            {% set tsd = {
              'datetime': now().isoformat(),
              'condition': simbolo,
              'temperature': temperatura,
              'precipitation_probability': probabilita_precipitazioni,
              'precipitation': precipitazioni,
              'sky_condition': cielo
            } %}
            {% set ns.forecast = ns.forecast + [tsd] %}
          {% endif %}
          
          {{ ns.forecast }}

I deleted it from my package file, did I do it right? It’s not clear to me if it was needed or not.

at this point, I entered the forecasts with all my sensors with the final “1”. I didn’t understand how to manage the others.
Let me explain better, ARPAV issues a bulletin with “current” data that I mapped with the number “0” then divided into 5 half days and 2 last full days.

Obtaining a widget of this type:
!ARPAV!

surely using templates I should create a structure to call the correct sensor based on the time of day, and this will be another obstacle to overcome. But first I have to understand how to insert the data of the following days.

This is my current situation, the weather sees the current forecasts but none of the future ones. Among other things, due to a time problem, every morning it sees the forecasts of the evening before, as well as the original ARPAV widget, until a new bulletin is issued at 13:00, but I could also fix that with a template at a later time, first I have to understand how to get the other forecasts though. I hope this long message of mine can explain my doubts well and what I have managed to do so far.

edit: I managed to play with the current weather to solve the problem of symbol and correct temperature, changing sensors to use based on how many hours have passed since the bulletin was released, but my doubts remain on how to make future forecasts

weather:
  - platform: template
    name: Meteo ARPAV
    condition_template: >
      {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %}
      {% set current_time = as_timestamp(now()) %}
      {% set hours_passed = (current_time - emission_time) / 3600 %}
      {% if hours_passed < 12 %}
        {{ states('sensor.arpav_simbolo0') }}
      {% elif 12 <= hours_passed < 24 %}
        {{ states('sensor.arpav_simbolo1') }}
      {% else %}
        'unavailable'
      {% endif %}
    temperature_template: >
      {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %}
      {% set current_time = as_timestamp(now()) %}
      {% set hours_passed = (current_time - emission_time) / 3600 %}
      {% if hours_passed < 12 %}
        {{ states('sensor.arpav_temperatura0') }}
      {% elif 12 <= hours_passed < 24 %}
        {{ states('sensor.arpav_temperatura1') }}
      {% else %}
        'unavailable'
      {% endif %}
    humidity_template: "{{ states('sensor.giardino_umidita') }}"
    forecast_daily_template: >
      {% set ns = namespace(forecast=[]) %}
      {% set simbolo = states('sensor.arpav_simbolo1') %}
      {% set temperatura = states('sensor.arpav_temperatura1') %}
      {% set precipitazioni = states('sensor.arpav_precipitazioni1') %} 
      {% set probabilita_precipitazioni = states('sensor.arpav_probabilita1')|replace('%','') %}
      {% set cielo = states('sensor.arpav_cielo1') %}
      {% if simbolo != 'unavailable' and temperatura != 'unavailable' %}
        {% set tsd = {
          'datetime': now().isoformat(),
          'condition': simbolo,
          'temperature': temperatura,
          'precipitation_probability': probabilita_precipitazioni, 
          'precipitation': precipitazioni,
          'sky_condition': cielo
        } %}
        {% set ns.forecast = ns.forecast + [tsd] %}
      {% endif %}
      {{ ns.forecast }}

image
just to tell you that after a lot of testing, something finally appeared!
All wrong as a division of the days, there is still a lot of work, but at least I made a small step forward.
this is the code:

weather:
  - platform: template
    name: Meteo ARPAV
    condition_template: >
      {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %}
      {% set current_time = as_timestamp(now()) %}
      {% set hours_passed = (current_time - emission_time) / 3600 %}
      {% if hours_passed < 12 %}
        {{ states('sensor.arpav_simbolo0') }}
      {% elif 12 <= hours_passed < 24 %}
        {{ states('sensor.arpav_simbolo1') }}
      {% else %}
        'unavailable'
      {% endif %}
    temperature_template: >
      {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %}
      {% set current_time = as_timestamp(now()) %}
      {% set hours_passed = (current_time - emission_time) / 3600 %}
      {% if hours_passed < 12 %}
        {{ states('sensor.arpav_temperatura0') }}
      {% elif 12 <= hours_passed < 24 %}
        {{ states('sensor.arpav_temperatura1') }}
      {% else %}
        'unavailable'
      {% endif %}
    humidity_template: "{{ states('sensor.giardino_umidita') }}"
    forecast_daily_template: >
        {% set ns = namespace(forecast=[]) %}
        
        {# Calcola il tempo di emissione e il tempo attuale #}
        {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %}
        {% set current_time = as_timestamp(now()) %}
        {% set hours_passed = (current_time - emission_time) / 3600 %}

        {# Inizializza i simboli e le temperature per i prossimi intervalli #}
        {% for i in range(0, 7) %}
            {% set simbolo = states('sensor.arpav_simbolo' ~ i) %}
            {% set temperatura = states('sensor.arpav_temperatura' ~ i) %}
            {% set probabilita_precipitazioni = states('sensor.arpav_probabilita' ~ i) | replace('%', '') %}

            {# Aggiungi i dati alla previsione solo se simbolo e temperatura sono disponibili #}
            {% if simbolo != 'unavailable' and temperatura != 'unavailable' %}
                {% set tsd = {
                    'datetime': (now() + timedelta(hours=i * 6)).isoformat(),
                    'condition': simbolo,
                    'temperature': temperatura,
                    'precipitation_probability': probabilita_precipitazioni,
                    'is_daytime': true if (now().hour + i * 6) < 13 else false
                } %}
                {% set ns.forecast = ns.forecast + [tsd] %}
            {% endif %}
        {% endfor %}
        
        {{ ns.forecast }}

I need to figure out how to get these day splits instead of daily or half day or hourly.
Friday 18th afternoon/evening
Saturday 19th night/morning
Saturday 19th afternoon/evening
Sunday 20th night/morning
Sunday 20th afternoon/evening
Monday 21st all day
Tuesday 22nd all day
Thanks again for the support so far

1 Like

image

This is the code of the Weather (not the end)
There is still some work to be done on temperature and precipitation, but I am happy to have finally obtained something sensible. I have to thank infinitely @Troon for the help, and chat gpt for generating many parts unknown to me, but after long conversations she and I found the right direction

weather:
  - platform: template
    name: Meteo ARPAV
    condition_template: >
      {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %}
      {% set current_time = as_timestamp(now()) %}
      {% set hours_passed = (current_time - emission_time) / 3600 %}
      {% if hours_passed < 12 %}
        {{ states('sensor.arpav_simbolo0') }}
      {% elif 12 <= hours_passed < 24 %}
        {{ states('sensor.arpav_simbolo1') }}
      {% else %}
        'unavailable'
      {% endif %}
    temperature_template: >
      {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %}
      {% set current_time = as_timestamp(now()) %}
      {% set hours_passed = (current_time - emission_time) / 3600 %}
      {% if hours_passed < 12 %}
        {{ states('sensor.arpav_temperatura0') }}
      {% elif 12 <= hours_passed < 24 %}
        {{ states('sensor.arpav_temperatura1') }}
      {% else %}
        'unavailable'
      {% endif %}
    humidity_template: "{{ states('sensor.giardino_umidita') }}"
    forecast_daily_template: >
      {% set ns = namespace(forecast=[]) %}
      {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %}
      {% set time_ref = emission_time %}
      
      {% set offsets = [0, 12, 24, 36, 48] %}
      {% for i in range(0, 5) %}
        {% set forecast_time = time_ref + (offsets[i] * 3600) %}
        {% set simbolo = states('sensor.arpav_simbolo' ~ i) %}
        {% set temperatura = states('sensor.arpav_temperatura' ~ i) %}
        {% set hour = '13:00:00' if i % 2 == 0 else '01:00:00' %}
        
        {% set tsd = {
          'datetime': (forecast_time | timestamp_custom('%Y-%m-%dT')) ~ hour,
          'condition': simbolo,
          'temperature': temperatura,
          'precipitation_probability': 'unknown'
        } %}
        
        {% set ns.forecast = ns.forecast + [tsd] %}
      {% endfor %}
      
      {% for i in range(5, 7) %}
        {% set forecast_time = time_ref + ((60 + (i - 5) * 24) * 3600) %}
        {% set simbolo = states('sensor.arpav_simbolo' ~ i) %}
        {% set temperatura = 'unknown' %}
        
        {% set tsd = {
          'datetime': (forecast_time | timestamp_custom('%Y-%m-%dT13:00:00')),
          'condition': simbolo,
          'temperature': temperatura,
          'precipitation_probability': 'unknown'
        } %}
        
        {% set ns.forecast = ns.forecast + [tsd] %}
      {% endfor %}
      
      {{ ns.forecast }}

“Nothing works; the half-day forecasts do not appear, and I can’t even see the maximum and minimum temperatures for the same day, so many cards are not functioning properly. If you have any advice after looking at my code, I would be grateful.”

weather:
  - platform: template
    name: Meteo ARPAV
    condition_template: >
      {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %} 
      {% set current_time = as_timestamp(now()) %} 
      {% set hours_passed = (current_time - emission_time) / 3600 %} 
      {% if hours_passed < 12 %} 
        {{ states('sensor.arpav_simbolo0') }} 
      {% elif 12 <= hours_passed < 24 %} 
        {{ states('sensor.arpav_simbolo1') }} 
      {% else %} 
        'unavailable' 
      {% endif %}
    temperature_template: >
      {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %} 
      {% set current_time = as_timestamp(now()) %} 
      {% set hours_passed = (current_time - emission_time) / 3600 %} 
      {% if hours_passed < 12 %} 
        {{ states('sensor.arpav_temperatura0') }} 
      {% elif 12 <= hours_passed < 24 %} 
        {{ states('sensor.arpav_temperatura1') }} 
      {% else %} 
        'unavailable' 
      {% endif %}
    humidity_template: "{{ states('sensor.giardino_umidita') }}"
    
    forecast_daily_template: >
        {% set ns = namespace(forecast=[]) %} 
        {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %} 
        {% set time_ref = emission_time %} 
        {% set offsets = [0, 12, 24, 36, 48] %} 
        {% for i in range(0, 5) %} 
            {% set forecast_time = time_ref + (offsets[i] * 3600) %} 
            {% set simbolo = states('sensor.arpav_simbolo' ~ i) %} 
            {% set temperatura = states('sensor.arpav_temperatura' ~ i) %} 

            {% set temperatura_minima = 'N/A' %}
            {% set temperatura_massima = 'N/A' %}
            
            {% if i > 0 and states('sensor.arpav_temperatura' ~ (i - 1)) != 'unknown' %}
                {% set temperatura_minima = states('sensor.arpav_temperatura' ~ (i - 1)) %}
            {% endif %}
            
            {% if i < 4 and states('sensor.arpav_temperatura' ~ (i + 1)) != 'unknown' %}
                {% set temperatura_massima = states('sensor.arpav_temperatura' ~ (i + 1)) %}
            {% endif %}
            
            {% set tsd = { 
                'datetime': (forecast_time | timestamp_custom('%Y-%m-%dT')) ~ ('13:00:00' if i % 2 == 0 else '01:00:00'), 
                'condition': simbolo, 
                'temperature': temperatura, 
                'temperature_max': temperatura_massima,  
                'temperature_min': temperatura_minima,    
                'precipitation_probability': 'unknown' 
            } %} 
            
            {% set ns.forecast = ns.forecast + [tsd] %} 
        {% endfor %}
        
        {{ ns.forecast }}
        
    forecast_hourly_template: >
        {% set ns = namespace(forecast=[]) %} 
        {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %} 
        {% set time_ref = emission_time %} 
        {% set offsets = [0, 12, 24, 36, 48, 72, 84] %} 
        {% for i in range(0, 7) %}
            {% set forecast_time = time_ref + (offsets[i] * 3600) %} 
            {% set simbolo = states('sensor.arpav_simbolo' ~ i) %} 
            
            {% if i < 5 %}
                {% set temperatura = states('sensor.arpav_temperatura' ~ i) %} 
            {% else %}
                {% set temperatura = 'N/A' %}  # Valore predefinito per i sensori non disponibili
            {% endif %}
            
            {% set tsd = { 
                'datetime': (forecast_time | timestamp_custom('%Y-%m-%dT%H:%M:%S')), 
                'condition': simbolo, 
                'temperature': temperatura, 
                'precipitation_probability': 'unknown' 
            } %} 
            
            {% set ns.forecast = ns.forecast + [tsd] %} 
        {% endfor %}
        
        {{ ns.forecast }}
        
    forecast_twice_daily_template: >
        {% set ns = namespace(forecast=[]) %} 
        {% set emission_time = as_timestamp(states('sensor.arpav_bollettino_emissione')) %} 
        {% set time_ref = emission_time %} 
        {% set offsets = [0, 12] %}  # Due offset per la previsione

        {% for i in range(0, 2) %}  # Cambiato a 2 per evitare l'errore
            {% set forecast_time = time_ref + (offsets[i] * 3600) %} 
            {% set simbolo = states('sensor.arpav_simbolo' ~ i) %} 
            {% set temperatura = states('sensor.arpav_temperatura' ~ i) %} 
            {% set hour = '00:00:00' if i % 2 == 0 else '12:00:00' %} 
            
            {% set tsd = { 
                'datetime': (forecast_time | timestamp_custom('%Y-%m-%dT')) ~ hour, 
                'condition': simbolo, 
                'temperature': temperatura, 
                'precipitation_probability': 'unknown' 
            } %} 
            
            {% set ns.forecast = ns.forecast + [tsd] %} 
        {% endfor %}
        
        {{ ns.forecast }}

Diego,
your effort is amazing and the result also.

I don’ t understand if you can use the forecast as a trigger in the automation.

I’m making the same job for Meteored api v2, but some weather icones o temperatures doe not apear.

weather icones does not apear here
Captura desde 2024-10-25 15-36-10
and here
Captura desde 2024-10-25 15-35-57

temperatures does not apear here :
Captura desde 2024-10-25 15-35-41

Here is my code, can someone help me ?

weather:
  - platform: template
    name: "Meteored"
    condition_template: >
        {% set nowtime = now() %}
        {% set hour = as_timestamp(now()) | timestamp_custom('%H') %}
        {% set condition_text = states('sensor.wthr_today_'+hour+'h_logo') %}
        {% if '1' in condition_text %}
          {% set sunrise = state_attr('sun.sun', 'next_rising')|as_datetime|as_local %}
          {% set sunset = state_attr('sun.sun', 'next_setting')|as_datetime|as_local %}
          {% set pre_sunrise = (sunrise - timedelta(hours=1)).time() %}
          {% set pre_sunset = (sunset - timedelta(hours=1)).time() %}
          {% set t = now().time() %}    
          {% if pre_sunrise <= t < pre_sunset %} 
            sunny
          {% else %} 
            clear-night
          {% endif %}
        {% elif '2' in condition_text %}
            partlycloudy
        {% elif '3' in condition_text %}
            cloudy
        {% elif '4' in condition_text %}
            cloudy
        {% elif '5' in condition_text %}
            rainy
        {% elif '6' in condition_text %}
            rainy
        {% elif '7' in condition_text %}
            rainy
        {% elif '8' in condition_text %}
            pouring
        {% elif '9' in condition_text %}
            pouring
        {% elif '10' in condition_text %}
            pouring
        {% elif '11' in condition_text %}
            lightning-rainy
        {% elif '12' in condition_text %}
            lightning-rainy
        {% elif '13' in condition_text %}
            lightning-rainy
        {% elif '14' in condition_text %}
            hail
        {% elif '15' in condition_text %}
            hail
        {% elif '16' in condition_text %}
            hail
        {% elif '17' in condition_text %}
            snowy
        {% elif '18' in condition_text %}
            snowy
        {% elif '19' in condition_text %}
            snowy
        {% elif '20' in condition_text %}
            snowy-rainy
        {% elif '21' in condition_text %}
            snowy-rainy
        {% elif '22' in condition_text %}
            snowy-rainy
        {% else %}
            unknown
        {% endif %}
    temperature_template: "{{ states('sensor.wthr_today_'+hour+'h_temp') | float }}"
    humidity_template: "{{ states('sensor.wthr_today_'+hour+'h_humidity') | float }}"
    pressure_template: "{{ states('sensor.wthr_today_'+hour+'h_pressure') | float }}"
    wind_speed_template: "{{ states('sensor.wthr_today_'+hour+'h_wind') | float }}"
    wind_gust_speed_template: "{{ states('sensor.wthr_today_'+hour+'h_wind_gust') | float }}"
    forecast_daily_template: >
        {% set ns = namespace(forecast=[]) %}
        {% set days=["today","tomorrow","day3","day4","day5"] %}
        {% for day in days %}
            {% set date = as_datetime(as_timestamp(states('sensor.wthr_'+day+'_date')),'%Y%m%d') %}
            {% set cloud_coverage = states('sensor.wthr_'+day+'_description') %}
            {% set condition_text = states('sensor.wthr_'+day+'_logo') %}
            {% if '1' in condition_text %}
               {% set condition = "sunny" %}
            {% elif '2' in condition_text %}
               {% set condition = "partly cloudy" %}
            {% elif '3' in condition_text %}
               {% set condition = "cloudy" %}
            {% elif '4' in condition_text %}
               {% set condition = "cloudy" %}
            {% elif '5' in condition_text %}
               {% set condition = "rainy" %} 
            {% elif '6' in condition_text %}
               {% set condition = "rainy" %}
            {% elif '7' in condition_text %}
               {% set condition = "rainy" %} 
            {% elif '8' in condition_text %}
               {% set condition = "pouring" %}
            {% elif '9' in condition_text %}
               {% set condition = "pouring" %}
            {% elif '10' in condition_text %}
               {% set condition = "pouring" %}
            {% elif '11' in condition_text %}
               {% set condition = "lightning-rainy" %}
            {% elif '12' in condition_text %}
               {% set condition = "lightning-rainy" %}
            {% elif '13' in condition_text %}
               {% set condition = "lightning-rainy" %}
            {% elif '14' in condition_text %}
               {% set condition = "hail" %}
            {% elif '15' in condition_text %}
               {% set condition = "hail" %}
            {% elif '16' in condition_text %}
               {% set condition = "hail" %}
            {% elif '17' in condition_text %}
               {% set condition = "snowy" %}" %}
            {% elif '18' in condition_text %}
               {% set condition = "snowy" %}
            {% elif '19' in condition_text %}
               {% set condition = "snowy" %}
            {% elif '20' in condition_text %}
               {% set condition = "snowy-rainy" %}
            {% elif '21' in condition_text %}
               {% set condition = "snowy-rainy" %}
            {% elif '22' in condition_text %}
               {% set condition = "snowy-rainy" %}
            {% else %}
                {% set condition = "unknown" %}
            {% endif %}
            {% set humidity = states('sensor.wthr_'+day+'_humidity') %}
            {% set precipitation = states('sensor.wthr_'+day+'_rain') %}
            {% set pressure = states('sensor.wthr_'+day+'_pressure') %}
            {% set temperature = states('sensor.wthr_'+day+'_temp_max') %}
            {% set templow = states('sensor.wthr_'+day+'_temp_min') %}
            {% set wind_speed = states('sensor.wthr_'+day+'_wind') %}
            {% set wind_gust_speed = states('sensor.wthr_'+day+'_wind_gust') %}
            {% set uv_index = states('sensor.wthr_'+day+'_uv_max') %}
            {% if condition != 'unavailable' and temperature != 'unavailable' %}
                {% set tsd = {
                  'datetime': date.isoformat(),
                  'condition': condition,
                  'humidity': humidity,
                  'precipitation': precipitation,
                  'pressure': pressure,
                  'temperature': temperature,
                  'templow': templow,
                  'wind_speed': wind_speed,
                  'wind_gust_speed': wind_gust_speed,
                  'uv_index': uv_index
                } %}
                {% set ns.forecast = ns.forecast + [tsd] %}
            
            {% endif %}
        {% endfor %}  
        {{ ns.forecast }}
    forecast_hourly_template: >
        {% set ns = namespace(forecast=[]) %}
        {% set days=["today","tomorrow","day3","day4","day5"] %}
        {% set hours=["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24"] %}
        {% for day in days %}
            {% for hour in hours %}
                {% set date = as_datetime(as_timestamp(states('sensor.wthr_'+day+'_date')+' '+hour+'00'),'%Y%m%d %H%M') %}
                {% set cloud_coverage = states('sensor.wthr_'+day+'_'+hour+'h_clouds') %}
                {% set condition_text = states('sensor.wthr_'+day+'_'+hour+'h_logo') %}
                {% if '1' in condition_text %}
                   {% set condition = "sunny" %}
                {% elif '2' in condition_text %}
                   {% set condition = "partly cloudy" %}
                {% elif '3' in condition_text %}
                   {% set condition = "cloudy" %}
                {% elif '4' in condition_text %}
                   {% set condition = "cloudy" %}
                {% elif '5' in condition_text %}
                   {% set condition = "rainy" %} 
                {% elif '6' in condition_text %}
                   {% set condition = "rainy" %}
                {% elif '7' in condition_text %}
                   {% set condition = "rainy" %} 
                {% elif '8' in condition_text %}
                   {% set condition = "pouring" %}
                {% elif '9' in condition_text %}
                   {% set condition = "pouring" %}
                {% elif '10' in condition_text %}
                   {% set condition = "pouring" %}
                {% elif '11' in condition_text %}
                   {% set condition = "lightning-rainy" %}
                {% elif '12' in condition_text %}
                   {% set condition = "lightning-rainy" %}
                {% elif '13' in condition_text %}
                   {% set condition = "lightning-rainy" %}
                {% elif '14' in condition_text %}
                   {% set condition = "hail" %}
                {% elif '15' in condition_text %}
                   {% set condition = "hail" %}
                {% elif '16' in condition_text %}
                   {% set condition = "hail" %}
                {% elif '17' in condition_text %}
                   {% set condition = "snowy" %}" %}
                {% elif '18' in condition_text %}
                   {% set condition = "snowy" %}
                {% elif '19' in condition_text %}
                   {% set condition = "snowy" %}
                {% elif '20' in condition_text %}
                   {% set condition = "snowy-rainy" %}
                {% elif '21' in condition_text %}
                   {% set condition = "snowy-rainy" %}
                {% elif '22' in condition_text %}
                   {% set condition = "snowy-rainy" %}
                {% else %}
                   {% set condition = "unknown" %}
                {% endif %}
                {% set humidity = states('sensor.wthr_'+day+'_'+hour+'h_humidity') %}
                {% set precipitation = states('sensor.wthr_'+day+'_'+hour+'h_rain') %}
                {% set pressure = states('sensor.wthr_'+day+'_'+hour+'h_pressure') %}
                {% set temperature = states('sensor.wthr_'+day+'_'+hour+'h_temp') %}
                {% set apparent_temperature = states('sensor.wthr_'+day+'_'+hour+'h_windchill') %}
                {% set wind_speed = states('sensor.wthr_'+day+'_'+hour+'h_wind') %}
                {% set wind_bearing = states('sensor.wthr_'+day+'_'+hour+'h_wind_direction') %}
                {% set wind_gust_speed = states('sensor.wthr_'+day+'_'+hour+'h_wind_gust') %}
                {% set uv_index = states('sensor.wthr_'+day+'_'+hour+'h_uv') %}
                {% if condition != 'unknown'%}
                    {% set tsd = {
                      'datetime': date.isoformat(),
                      'cloud_coverage': cloud_coverage,
                      'condition':condition,
                      'humidity': humidity,
                      'precipitation': precipitation,
                      'pressure': pressure,
                      'temperature': temperature,
                      'apparent_temperature': apparent_temperature,
                      'wind_speed': wind_speed,
                      'wind_bearing': wind_bearing,
                      'wind_gust_speed': wind_gust_speed,
                      'uv_index': uv_index
                    } %}
                    {% set ns.forecast = ns.forecast + [tsd] %}
                {% endif %}
            {% endfor %}  
        {% endfor %}  
        {{ ns.forecast }}

and the restful sensor creation:

rest:
    scan_interval: 1800
    resource: "http://api.meteored.cl/index.php?api_lang=cl&localidad=18013&affiliate_id=XXXXXXXXXXXXXXXXXX&v=2.0&h=1"
    sensor:
      - name: "wthr today date"
        value_template: "{{ value_json['report']['location']['day'][0]['@value']}}"
      - name: "wthr today name"
        value_template: "{{ value_json['report']['location']['day'][0]['@name']}}"
      - name: "wthr today logo"
        value_template: "{{ value_json['report']['location']['day'][0]['symbol']['@value']}}"
      - name: "wthr today description"
        value_template: "{{ value_json['report']['location']['day'][0]['symbol']['@desc']}}"
      - name: "wthr today temp-min"
        value_template: "{{ value_json['report']['location']['day'][0]['tempmin']['@value']}}"
        unit_of_measurement: "°C"
      - name: "wthr today temp-max"
        value_template: "{{ value_json['report']['location']['day'][0]['tempmax']['@value']}}"
        unit_of_measurement: "°C"
      - name: "wthr today wind"
        value_template: "{{ value_json['report']['location']['day'][0]['wind']['@value']}}"
        device_class: "wind_speed"
        unit_of_measurement: "km/h"
      - name: "wthr today wind-symbol"
        value_template: "{{ value_json['report']['location']['day'][0]['wind']['@symbol']}}"
      - name: "wthr today wind-symbolB"
        value_template: "{{ value_json['report']['location']['day'][0]['wind']['@symbolB']}}"
        device_class: "wind_speed"
        unit_of_measurement: "km/h"
      - name: "wthr today wind-gust"
        value_template: "{{ value_json['report']['location']['day'][0]['wind-gust']['@value']}}"
        device_class: "wind_speed"
        unit_of_measurement: "km/h"
      - name: "wthr today rain"
        value_template: "{{ value_json['report']['location']['day'][0]['rain']['@value']}}"
        device_class: "precipitation"
        unit_of_measurement: "mm"
      - name: "wthr today humidity"
        value_template: "{{ value_json['report']['location']['day'][0]['humidity']['@value']}}"
        device_class: "humidity"
        unit_of_measurement: "%"
      - name: "wthr today pressure"
        value_template: "{{ value_json['report']['location']['day'][0]['pressure']['@value']}}"
        device_class: "atmospheric_pressure"
        unit_of_measurement: "mbar"
      - name: "wthr today snowline"
        value_template: "{{ value_json['report']['location']['day'][0]['snowline']['@value']}}"
        unit_of_measurement: "m"
      - name: "wthr today uv-max"
        value_template: "{{ value_json['report']['location']['day'][0]['uv_index_max']['@value']}}"
      - name: "wthr today sun in"
        value_template: "{{ value_json['report']['location']['day'][0]['sun']['@in']}}"
      - name: "wthr today sun mid"
        value_template: "{{ value_json['report']['location']['day'][0]['sun']['@mid']}}"
      - name: "wthr today sun out"
        value_template: "{{ value_json['report']['location']['day'][0]['sun']['@out']}}"
      - name: "wthr today moon name"
        value_template: "{{ value_json['report']['location']['day'][0]['moon']['@desc']}}"
      - name: "wthr today moon symbol"
        value_template: "{{ value_json['report']['location']['day'][0]['moon']['@symbol']}}"
      - name: "wthr today moon lumi"
        value_template: "{{ value_json['report']['location']['day'][0]['moon']['@lumi']}}"
      - name: "wthr today moon in"
        value_template: "{{ value_json['report']['location']['day'][0]['moon']['@in']}}"
      - name: "wthr today moon out"
        value_template: "{{ value_json['report']['location']['day'][0]['moon']['@out']}}"

      - name: "wthr today 01h temp"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['temp']['@value']}}"
        device_class: "temperature"
        unit_of_measurement: "ºC"
      - name: "wthr today 01h logo"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['symbol']['@value']}}"
      - name: "wthr today 01h description"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['symbol']['@desc']}}"
      - name: "wthr today 01h wind"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['wind']['@value']}}"
        device_class: "wind_speed"
        unit_of_measurement: "km/h"
      - name: "wthr today 01h wind-direction"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['wind']['@dir']}}"
      - name: "wthr today 01h wind-symbol"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['wind']['@symbol']}}"
      - name: "wthr today 01h wind-symbolB"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['wind']['@symbolB']}}"
      - name: "wthr today 01h wind-gust"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['wind-gust']['@value']}}"
        device_class: "wind_speed"
        unit_of_measurement: "km/h"
      - name: "wthr today 01h rain"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['rain']['@value']}}"
        device_class: "precipitation"
        unit_of_measurement: "mm"
      - name: "wthr today 01h humidity"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['humidity']['@value']}}"
        device_class: "humidity"
        unit_of_measurement: "%"
      - name: "wthr today 01h pressure"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['pressure']['@value']}}"
        device_class: "atmospheric_pressure"
        unit_of_measurement: "mbar"
      - name: "wthr today 01h clouds"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['clouds']['@value']}}"
      - name: "wthr today 01h snowline"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['snowline']['@value']}}"
        unit_of_measurement: "m"
      - name: "wthr today 01h windchill"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['windchill']['@value']}}"
        device_class: "temperature"
        unit_of_measurement: "ºC"
      - name: "wthr today 01h uv"
        value_template: "{{ value_json['report']['location']['day'][0]['hour'][0]['uv_index']['@value']}}"
...

and an extract of the xml file :

<report>
<location city="San Fabián de Alico [Ñuble;Chile]">
<interesting>
<url description="Predicción">https://www.meteored.cl/tiempo-en_San+Fabian+de+Alico-America+Sur-Chile-Biobio--1-18013.html</url>
</interesting>
<day value="20241025" name="Viernes">
<symbol value="5" desc="Intervalos nubosos con lluvias débiles" value2="12" desc2="Cielos nubosos con chubascos tormentosos"/>
<tempmin value="4" unit="°C"/>
<tempmax value="17" unit="°C"/>
<wind value="13" unit="km/h" symbol="15" symbolB="47"/>
<wind-gusts value="37" unit="km/h"/>
<rain value="0.1" unit="mm"/>
<humidity value="80"/>
<pressure value="1020" unit="mb"/>
<snowline value="1800" unit="m"/>
<uv_index_max value="8"/>
<sun in="06:49" mid="13:30" out="20:12"/>
<moon in="03:44" out="13:57" lumi="37.25%" desc="Menguante, 37.25% Iluminada" symbol="6"/>
<local_info local_time="07:40" offset="-3"/>
<hour value="01:00">
<temp value="9" unit="°C"/>
<symbol value="5" desc="Intervalos nubosos con lluvias débiles" value2="12" desc2="Cielos nubosos con chubascos tormentosos"/>
<wind value="8" unit="km/h" dir="SW" symbol="14" symbolB="38"/>
<wind-gusts value="28" unit="km/h"/>
<rain value="0.1" unit="mm"/>
<humidity value="91"/>
<pressure value="1020" unit="mb"/>
<clouds value="51%"/>
<snowline value="1900" unit="m"/>
<windchill value="8" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="02:00">
<temp value="9" unit="°C"/>
<symbol value="2" desc="Intervalos nubosos" value2="3" desc2="Cielos nubosos"/>
<wind value="6" unit="km/h" dir="S" symbol="13" symbolB="37"/>
<wind-gusts value="25" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="89"/>
<pressure value="1020" unit="mb"/>
<clouds value="12%"/>
<snowline value="1900" unit="m"/>
<windchill value="8" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="03:00">
<temp value="7" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="4" unit="km/h" dir="S" symbol="13" symbolB="37"/>
<wind-gusts value="28" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="95"/>
<pressure value="1020" unit="mb"/>
<clouds value="7%"/>
<snowline value="1900" unit="m"/>
<windchill value="7" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="04:00">
<temp value="5" unit="°C"/>
<symbol value="2" desc="Intervalos nubosos" value2="3" desc2="Cielos nubosos"/>
<wind value="3" unit="km/h" dir="SE" symbol="4" symbolB="28"/>
<wind-gusts value="16" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="100"/>
<pressure value="1020" unit="mb"/>
<clouds value="18%"/>
<snowline value="1900" unit="m"/>
<windchill value="6" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="05:00">
<temp value="5" unit="°C"/>
<symbol value="3" desc="Cielos nubosos" value2="4" desc2="Cielos cubiertos"/>
<wind value="2" unit="km/h" dir="SE" symbol="4" symbolB="28"/>
<wind-gusts value="12" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="100"/>
<pressure value="1020" unit="mb"/>
<clouds value="64%"/>
<snowline value="1900" unit="m"/>
<windchill value="5" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="06:00">
<temp value="5" unit="°C"/>
<symbol value="2" desc="Intervalos nubosos" value2="3" desc2="Cielos nubosos"/>
<wind value="4" unit="km/h" dir="E" symbol="3" symbolB="27"/>
<wind-gusts value="16" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="100"/>
<pressure value="1021" unit="mb"/>
<clouds value="23%"/>
<snowline value="1900" unit="m"/>
<windchill value="5" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="07:00">
<temp value="4" unit="°C"/>
<symbol value="2" desc="Intervalos nubosos" value2="3" desc2="Cielos nubosos"/>
<wind value="5" unit="km/h" dir="E" symbol="3" symbolB="27"/>
<wind-gusts value="15" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="100"/>
<pressure value="1022" unit="mb"/>
<clouds value="35%"/>
<snowline value="1900" unit="m"/>
<windchill value="4" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="08:00">
<temp value="7" unit="°C"/>
<symbol value="2" desc="Intervalos nubosos" value2="3" desc2="Cielos nubosos"/>
<wind value="7" unit="km/h" dir="E" symbol="3" symbolB="35"/>
<wind-gusts value="20" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="96"/>
<pressure value="1022" unit="mb"/>
<clouds value="37%"/>
<snowline value="2000" unit="m"/>
<windchill value="5" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="09:00">
<temp value="10" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="4" unit="km/h" dir="E" symbol="3" symbolB="35"/>
<wind-gusts value="20" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="82"/>
<pressure value="1023" unit="mb"/>
<clouds value="3%"/>
<snowline value="2100" unit="m"/>
<windchill value="10" unit="°C"/>
<uv_index value="1"/>
</hour>
<hour value="10:00">
<temp value="12" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="2" unit="km/h" dir="SW" symbol="6" symbolB="30"/>
<wind-gusts value="19" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="65"/>
<pressure value="1022" unit="mb"/>
<clouds value="0%"/>
<snowline value="2200" unit="m"/>
<windchill value="12" unit="°C"/>
<uv_index value="3"/>
</hour>
<hour value="11:00">
<temp value="13" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="8" unit="km/h" dir="SW" symbol="14" symbolB="38"/>
<wind-gusts value="23" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="63"/>
<pressure value="1022" unit="mb"/>
<clouds value="0%"/>
<snowline value="3200" unit="m"/>
<windchill value="13" unit="°C"/>
<uv_index value="5"/>
</hour>
<hour value="12:00">
<temp value="14" unit="°C"/>
<symbol value="2" desc="Intervalos nubosos" value2="3" desc2="Cielos nubosos"/>
<wind value="10" unit="km/h" dir="SW" symbol="14" symbolB="46"/>
<wind-gusts value="30" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="63"/>
<pressure value="1021" unit="mb"/>
<clouds value="17%"/>
<snowline value="3400" unit="m"/>
<windchill value="14" unit="°C"/>
<uv_index value="7"/>
</hour>
<hour value="13:00">
<temp value="15" unit="°C"/>
<symbol value="2" desc="Intervalos nubosos" value2="3" desc2="Cielos nubosos"/>
<wind value="11" unit="km/h" dir="W" symbol="15" symbolB="47"/>
<wind-gusts value="33" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="62"/>
<pressure value="1021" unit="mb"/>
<clouds value="20%"/>
<snowline value="3500" unit="m"/>
<windchill value="15" unit="°C"/>
<uv_index value="8"/>
</hour>
<hour value="14:00">
<temp value="16" unit="°C"/>
<symbol value="2" desc="Intervalos nubosos" value2="3" desc2="Cielos nubosos"/>
<wind value="13" unit="km/h" dir="W" symbol="15" symbolB="47"/>
<wind-gusts value="36" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="64"/>
<pressure value="1021" unit="mb"/>
<clouds value="23%"/>
<snowline value="3600" unit="m"/>
<windchill value="16" unit="°C"/>
<uv_index value="8"/>
</hour>
<hour value="15:00">
<temp value="16" unit="°C"/>
<symbol value="2" desc="Intervalos nubosos" value2="3" desc2="Cielos nubosos"/>
<wind value="12" unit="km/h" dir="SW" symbol="14" symbolB="46"/>
<wind-gusts value="37" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="65"/>
<pressure value="1021" unit="mb"/>
<clouds value="25%"/>
<snowline value="3600" unit="m"/>
<windchill value="16" unit="°C"/>
<uv_index value="7"/>
</hour>
<hour value="16:00">
<temp value="16" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="12" unit="km/h" dir="SW" symbol="14" symbolB="46"/>
<wind-gusts value="36" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="62"/>
<pressure value="1021" unit="mb"/>
<clouds value="10%"/>
<snowline value="3600" unit="m"/>
<windchill value="16" unit="°C"/>
<uv_index value="5"/>
</hour>
<hour value="17:00">
<temp value="16" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="11" unit="km/h" dir="SW" symbol="14" symbolB="46"/>
<wind-gusts value="33" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="62"/>
<pressure value="1020" unit="mb"/>
<clouds value="1%"/>
<snowline value="3600" unit="m"/>
<windchill value="16" unit="°C"/>
<uv_index value="3"/>
</hour>
<hour value="18:00">
<temp value="16" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="11" unit="km/h" dir="SW" symbol="14" symbolB="46"/>
<wind-gusts value="36" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="63"/>
<pressure value="1019" unit="mb"/>
<clouds value="0%"/>
<snowline value="3700" unit="m"/>
<windchill value="16" unit="°C"/>
<uv_index value="1"/>
</hour>
<hour value="19:00">
<temp value="16" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="9" unit="km/h" dir="SW" symbol="14" symbolB="38"/>
<wind-gusts value="27" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="67"/>
<pressure value="1019" unit="mb"/>
<clouds value="0%"/>
<snowline value="3800" unit="m"/>
<windchill value="16" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="20:00">
<temp value="13" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="6" unit="km/h" dir="S" symbol="13" symbolB="37"/>
<wind-gusts value="21" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="82"/>
<pressure value="1018" unit="mb"/>
<clouds value="0%"/>
<snowline value="3800" unit="m"/>
<windchill value="13" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="21:00">
<temp value="11" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="6" unit="km/h" dir="SE" symbol="12" symbolB="36"/>
<wind-gusts value="27" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="88"/>
<pressure value="1018" unit="mb"/>
<clouds value="0%"/>
<snowline value="3800" unit="m"/>
<windchill value="11" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="22:00">
<temp value="11" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="6" unit="km/h" dir="SE" symbol="4" symbolB="28"/>
<wind-gusts value="18" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="90"/>
<pressure value="1018" unit="mb"/>
<clouds value="0%"/>
<snowline value="3900" unit="m"/>
<windchill value="11" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="23:00">
<temp value="9" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="8" unit="km/h" dir="E" symbol="11" symbolB="35"/>
<wind-gusts value="22" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="96"/>
<pressure value="1018" unit="mb"/>
<clouds value="0%"/>
<snowline value="3900" unit="m"/>
<windchill value="9" unit="°C"/>
<uv_index value="0"/>
</hour>
<hour value="24:00">
<temp value="9" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="10" unit="km/h" dir="E" symbol="11" symbolB="35"/>
<wind-gusts value="26" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="94"/>
<pressure value="1017" unit="mb"/>
<clouds value="0%"/>
<snowline value="3900" unit="m"/>
<windchill value="7" unit="°C"/>
<uv_index value="0"/>
</hour>
</day>
<day value="20241026" name="Sábado">
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<tempmin value="7" unit="°C"/>
<tempmax value="27" unit="°C"/>
<wind value="18" unit="km/h" symbol="11" symbolB="51"/>
<wind-gusts value="46" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="72"/>
<pressure value="1013" unit="mb"/>
<snowline value="3900" unit="m"/>
<uv_index_max value="9"/>
<sun in="06:47" mid="13:30" out="20:13"/>
<moon in="04:12" out="14:58" lumi="28.15%" desc="Menguante, 28.15% Iluminada" symbol="5"/>
<local_info local_time="07:40" offset="-3"/>
<hour value="01:00">
<temp value="8" unit="°C"/>
<symbol value="1" desc="Cielos despejados" value2="1" desc2="Cielos despejados"/>
<wind value="10" unit="km/h" dir="E" symbol="11" symbolB="35"/>
<wind-gusts value="27" unit="km/h"/>
<rain value="0" unit="mm"/>
<humidity value="89"/>

auto-answer
i corrected the daytime detection which was unconsistent.
I corrected the condition template value “partly cloudy” to “partlycloudy” which in my opinion is inconsistent with other terms like clear-night and others 2words conditions values
i corrected temperature for current forcast by adding this :

    temperature_template: >
        {% set hour = as_timestamp(now()) | timestamp_custom('%H') %}
        {{ states('sensor.wthr_today_'+hour+'h_temp') | float }}

1 Like