Bonjour la team,
Mon problème
j’ai une erreur de configuration mais je ne trouve pas mon problème. pouvez vous m’expliquer
configuration non valide
Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: expected token ',', got 'temperature') for dictionary value @ data['sensors']['weather_temperature']['value_template']. Got '{% if states.weather.gif_sur_yvette.state == "unavailable" -%}\n {{ state_attr(\'weather.maison\' , \'temperature\') }}\n{% else -%}\n {{ state_attr(\'weather.gif_sur_yvette , \'temperature\') }}\n{% endif -%} '. (See ?, line ?).
meteo.yaml
sensor:
- platform: template
sensors:
weather_temperature:
friendly_name: "Weather Température"
value_template: >-
{% if states.weather.gif_sur_yvette.state == "unavailable" -%}
{{ state_attr('weather.maison' , 'temperature') }}
{% else -%}
{{ state_attr('weather.gif_sur_yvette , 'temperature') }}
{% endif -%}
weather_temperature_v2:
friendly_name: "Weather Température"
value_template: >-
{% if states.weather.gif_sur_yvette.state == "unavailable" -%}
{{ state_attr('weather.maison' , 'temperature') }}
{% else -%}
{{ state_attr('weather.gif_sur_yvette' , 'temperature') }}
{% endif -%}
weather_humidite:
friendly_name: "Weather Humidité"
value_template: "{{ state_attr('weather.gif_sur_yvette' , 'humidity') }}%"
weather_alert_inondation:
friendly_name: "Alerte Inondation"
value_template: "{{ state_attr('sensor.91_weather_alert' , 'Inondation') }}"
weather_alert_grand_froid:
friendly_name: "Alerte Grand-froid"
value_template: "{{ state_attr('sensor.91_weather_alert' , 'Grand-froid') }}"
weather_alert_orages:
friendly_name: "Alerte Orages"
value_template: "{{ state_attr('sensor.91_weather_alert' , 'Orages') }}"
weather_alert_pluie_inondation:
friendly_name: "Alerte Pluie-inondation"
value_template: "{{ state_attr('sensor.91_weather_alert' , 'Pluie-inondation') }}"
weather_alert_vent_violent:
friendly_name: "Alerte Vent violent"
value_template: "{{ state_attr('sensor.91_weather_alert' , 'Vent violent') }}"
weather_alert_neige_verglas:
friendly_name: "Alerte Neige-verglas"
value_template: "{{ state_attr('sensor.91_weather_alert' , 'Neige-verglas') }}"
weather_alert_canicule:
friendly_name: "Alerte Canicule"
value_template: "{{ state_attr('sensor.91_weather_alert' , 'Canicule') }}"
weather_conditions:
value_template: >-
{% set meteo = states('weather.gif_sur_yvette') %}
{% set traduction = {'cloudy':'Nuageux', 'rainy':'Pluvieux', 'partlycloudy':'Partiellement nuageux', 'clear-night':'Nuit claire', 'fog':'Brouillard', 'hail':'Grêle', 'lightning-rainy':'Pluie orageuse', 'lightning':'Orages', 'pouring':'Fortes pluies', 'snowy-rainy':'Neigeux', 'snowy':'Neigeux', 'sunny':'Ensoleillé', 'windy-variant':'Venteux', 'windy':'Venteux', 'exceptional':'Exceptionel'}%}
{% if not state_attr('weather.maison', 'temperature') == 'Indisponible' -%}
{% if states('weather.gif_sur_yvette') == 'lightning-rainy' -%}
Pluies orageuses
{% elif states.sensor.gif_sur_yvette_rain_chance.state | float > 0 -%}
{{ traduction[meteo] }}
{% else -%}
{{ traduction[meteo] }}
{% endif -%}
{% else -%}
Pas d'info
{% endif -%}
weather_conditions_pluie:
value_template: >-
{% set precip = states('sensor.gif_sur_yvette_rain_chance') | round %}
{% if states.sensor.gif_sur_yvette_rain_chance.state | float > 0 -%}
{{ precip }}
{% else -%}
{{ precip }}
{% endif -%}
weather_conditions_neige:
value_template: >-
{% set snow = states('sensor.gif_sur_yvette_snow_chance') | round %}
{% if states.sensor.gif_sur_yvette_snow_chance.state | float > 0 -%}
{{ snow }}
{% else -%}
{{ snow }}
{% endif -%}
weather_conditions_ciel:
value_template: >-
{% set ciel = states('sensor.gif_sur_yvette_cloud_cover') | round -%}
{% if states.sensor.gif_sur_yvette_cloud_cover.state | float > 10 -%}
{{ ciel }}
{% else -%}
{{ ciel }}
{% endif -%}
weather_vent:
friendly_name: "Weather vent"
value_template:
"{{ state_attr('weather.gif_sur_yvette' , 'wind_speed') }}"
weather_conditions_vent:
value_template: >-
{% set vent = states('sensor.weather_vent') | round -%}
{% if states.sensor.weather_vent.state | float > 20 -%}
{{ vent }}
{% else -%}
{{ vent }}
{% endif -%}
weather_conditions_uv:
value_template: >-
{% set uv = states('sensor.gif_sur_yvette_uv') | round -%}
{% if states.sensor.gif_sur_yvette_uv.state | float > 5 -%}
{{ uv }}
{% else -%}
{{ uv }}
{% endif -%}
weather_alerte_couleur_v2:
friendly_name: Alerte météo sans couleur
value_template: >-
{% if is_state("sensor.91_weather_alert", "Jaune") -%}
Vigilance Jaune
{% elif is_state("sensor.91_weather_alert", "Orange") -%}
Vigilance Orange
{% elif is_state("sensor.91_weather_alert", "Rouge") -%}
Vigilance Rouge
{% elif is_state("sensor.91_weather_alert", "Vert") -%}
Aucune vigilance en cours
{%- endif %}
weather_alerte:
friendly_name: Alerte météo
value_template: >-
{% if is_state("sensor.91_weather_alert", "Vert") -%}
Aucune
{%- endif %}
{% if not is_state("sensor.91_weather_alert", "Vert") -%}
{%- endif %}
{% if is_state("sensor.weather_alert_grand_froid", "Jaune") -%}
Froid {%- endif %}
{% if is_state("sensor.weather_alert_canicule", "Jaune") -%}
Canicule {%- endif %}
{% if is_state("sensor.weather_alert_neige_verglas", "Jaune") -%}
Neige / Verglas{%- endif %}
{% if is_state("sensor.weather_alert_inondation", "Jaune") -%}
Inondation{%- endif %}
{% if is_state("sensor.weather_alert_orages", "Jaune") -%}
Orages{%- endif %}
{% if is_state("sensor.weather_alert_vent_violent", "Jaune") -%}
Vent{%- endif %}
{% if is_state("sensor.weather_alert_pluie_inondation", "Jaune") -%}
Pluie / Inondation{%- endif %}
{% if is_state("sensor.weather_alert_grand_froid", "Orange") -%}
Froid {%- endif %}
{% if is_state("sensor.weather_alert_canicule", "Orange") -%}
Canicule {%- endif %}
{% if is_state("sensor.weather_alert_neige_verglas", "Orange") -%}
Neige / Verglas{%- endif %}
{% if is_state("sensor.weather_alert_inondation", "Orange") -%}
Inondation{%- endif %}
{% if is_state("sensor.weather_alert_orages", "Orange") -%}
Orages{%- endif %}
{% if is_state("sensor.weather_alert_vent_violent", "Orange") -%}
Vent{%- endif %}
{% if is_state("sensor.weather_alert_pluie_inondation", "Orange") -%}
Pluie / Inondation{%- endif %}
{% if is_state("sensor.weather_alert_grand_froid", "Rouge") -%}
Froid {%- endif %}
{% if is_state("sensor.weather_alert_canicule", "Rouge") -%}
Canicule {%- endif %}
{% if is_state("sensor.weather_alert_neige_verglas", "Rouge") -%}
Neige / Verglas{%- endif %}
{% if is_state("sensor.weather_alert_inondation", "Rouge") -%}
Inondation{%- endif %}
{% if is_state("sensor.weather_alert_orages", "Rouge") -%}
Orages{%- endif %}
{% if is_state("sensor.weather_alert_vent_violent", "Rouge") -%}
Vent{%- endif %}
{% if is_state("sensor.weather_alert_pluie_inondation", "Rouge") -%}
Pluie / Inondation{%- endif %}
weather_alerte2:
friendly_name: Alerte météo
value_template: >-
Alerte météo {{states('sensor.91_weather_alert')}} en cours:
{%- for attribut in ['Vent violent', 'Pluie-inondation', 'Orages', 'Inondation', 'Pluie-inondation', 'Neige-verglas','Canicule', 'Grand-froid', 'Avalanches', 'Vagues-submersion'] %}
{%- if state_attr('sensor.91_weather_alert', attribut) == 'Vert' and state_attr('sensor.91_weather_alert', attribut) != None -%}
- {{attribut}} : {{state_attr('sensor.91_weather_alert', attribut)}}{{"\n"}}
{%- endif -%}
{% endfor %}
weather_soleil:
friendly_name: Soleil levé couché
value_template: >-
{% if is_state("sun.sun", "above_horizon") -%}
{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%-Hh%M") }}
{% else %}
{{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%-Hh%M") }}
{% endif %}
weather_leve_soleil:
friendly_name: Soleil levé
value_template: >-
{{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%-Hh%M") }}
weather_couche_soleil:
friendly_name: Soleil couché
value_template: >-
{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%-Hh%M") }}
weather_temp_max:
friendly_name: Température max du jour
value_template: "{{ states.weather.maison.attributes.forecast[0].temperature|float|round(2) }}"
weather_temp_min:
friendly_name: Température min du jour
value_template: "{{ states.weather.maison.attributes.forecast[0].templow|float|round(0) }}"