Moin zusammen,
ich habe in der template.yaml ein recht umfangreiches Codeschnipsel gebastelt für meinen Wetter Forecast. Es funktioniert auch; meine gewünschten Werte bekomme ich korrekt angezeigt.
ABER: Im Studio Coder Server bekomme ich folgende Fehler, die ich nicht verstehe und gerne weg haben möchte:
platform: time_pattern (String does noch match the pattern of "LEGACY_SYNTAX^")
platform: homeassistant (Missing property "entity_id")
service: weather.get_forecasts (String does not match the pattern of "LEGACY_SYNTAX^"
Hier der gesamt Code:
#-----------------------------------------------------------
# Aktuelles Wetter mit Forecast abrufen
#-----------------------------------------------------------
- trigger:
- platform: time_pattern
minutes: "/5"
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
target:
entity_id: weather.forecast_home
data:
type: daily
response_variable: daily
sensor:
- name: Wetter Deutsch
unique_id: weather_deu
state: "Vorhersage"
attributes:
Wetter_1: "{{ daily['weather.forecast_home'].forecast[0].condition }}"
Wetter_2: >
{% set condition = daily['weather.forecast_home'].forecast[0].condition %}
{% if condition == 'cloudy' %}
Bewölkt
{% elif condition == 'snowy' %}
Schneefall
{% elif condition == 'clear-night' %}
Klare Nacht
{% elif condition == 'fog' %}
Nebel
{% elif condition == 'hail' %}
Hagel
{% elif condition == 'lightning' %}
Gewitter
{% elif condition == 'lightning-rainy' %}
Gewitter & Regen
{% elif condition == 'partlycloudy' %}
Teilweise bewölkt
{% elif condition == 'pouring' %}
starker Regen
{% elif condition == 'rainy' %}
Regen
{% elif condition == 'snowy-rainy' %}
Schneeregen
{% elif condition == 'windy' %}
Windig
{% elif condition == 'sunny' %}
Sonne
{% elif condition == 'windy-variant' %}
stärkerer Wind
{% else %}
außergewöhnliche Wetterlage
{% endif %}
Temperatur: "{{ states('sensor.wetterstation_temperatur') }}"
Niederschlag: "{{ daily['weather.forecast_home'].forecast[0].precipitation }}"
Niederschlag_Prozent: "{{ daily['weather.forecast_home'].forecast[0].precipitation_probability }}"
Wind_Geschwindigkeit: "{{ states('sensor.wetterstation_windgeschwindigkeit') }}"
cond_icon: >
{% set weather = daily['weather.forecast_home'].forecast[0].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/ic/weather-icons/animated/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather-icons/animated/' + weather + '-night.svg'}}
{% endif %}
Gefuhlt_wie: >
{% set T = (states('sensor.wetterstation_temperatur') | float) %}
{% set K = (states('sensor.wetterstation_windgeschwindigkeit') | float)/3.6 %}
{% set V = (K/1000*60*60) %}
{% set A = 13.12 + 0.6215*T - 11.37*(V**0.16) + 0.3965*T*(V**0.16) %}
{{ (A) | round(1) }}
Wind_Richtung: >
{% set direction = ['N', 'NNO', 'NO', 'ONO', 'O', 'OSO', 'SO', 'SSO', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N'] %}
{% set degree = (states('sensor.wetterstation_windrichtung') | float) %}
{{ direction[((degree+11.25)/22.5)|int] }}
Wind_Beschreibung: >
{% set sensor = (states('sensor.wetterstation_windgeschwindigkeit') | float) %}
{% if sensor >= 0 and sensor < 0.99 %}
Windstille
{% elif sensor > 1 and sensor < 6.99 %}
leiser Zug
{% elif sensor > 7 and sensor < 11.99 %}
leichte Brise
{% elif sensor > 12 and sensor < 19.99 %}
schwache Brise
{% elif sensor > 20 and sensor < 29.99 %}
mäßige Brise
{% elif sensor > 30 and sensor < 39.99 %}
frische Brise
{% elif sensor > 40 and sensor < 50.99 %}
starker Wind
{% elif sensor > 51 and sensor < 62.99 %}
steifer Wind
{% elif sensor > 63 and sensor < 75.99 %}
stürmischer Wind
{% elif sensor > 76 and sensor < 87.99 %}
Sturm
{% elif sensor > 88 and sensor < 102.99 %}
schwerer Sturm
{% elif sensor > 103 and sensor < 117.99 %}
orkanartiger Sturm
{% else %}
Orkan
{% endif %}
datetime1: "{{ daily['weather.forecast_home'].forecast[1].datetime }}"
condition1: >
{% set condition = daily['weather.forecast_home'].forecast[1].condition %}
{% if condition == 'cloudy' %}
Bewölkt
{% elif condition == 'snowy' %}
Schneefall
{% elif condition == 'clear-night' %}
Klare Nacht
{% elif condition == 'fog' %}
Nebel
{% elif condition == 'hail' %}
Hagel
{% elif condition == 'lightning' %}
Gewitter
{% elif condition == 'lightning-rainy' %}
Gewitter & Regen
{% elif condition == 'partlycloudy' %}
Teilweise bewölkt
{% elif condition == 'pouring' %}
starker Regen
{% elif condition == 'rainy' %}
Regen
{% elif condition == 'snowy-rainy' %}
Schneeregen
{% elif condition == 'windy' %}
Windig
{% elif condition == 'sunny' %}
Sonne
{% elif condition == 'windy-variant' %}
stärkerer Wind
{% else %}
außergewöhnliche Wetterlage
{% endif %}
cond_icon1: >
{% set weather = daily['weather.forecast_home'].forecast[1].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/weather-icons/animated/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather-icons/animated/' + weather + '-night.svg'}}
{% endif %}
temperature1: "{{ daily['weather.forecast_home'].forecast[1].temperature }}"
precipitation1: "{{ daily['weather.forecast_home'].forecast[1].precipitation }}"
datetime2: "{{ daily['weather.forecast_home'].forecast[2].datetime }}"
condition2: >
{% set condition = daily['weather.forecast_home'].forecast[2].condition %}
{% if condition == 'cloudy' %}
Bewölkt
{% elif condition == 'snowy' %}
Schneefall
{% elif condition == 'clear-night' %}
Klare Nacht
{% elif condition == 'fog' %}
Nebel
{% elif condition == 'hail' %}
Hagel
{% elif condition == 'lightning' %}
Gewitter
{% elif condition == 'lightning-rainy' %}
Gewitter & Regen
{% elif condition == 'partlycloudy' %}
Teilweise bewölkt
{% elif condition == 'pouring' %}
starker Regen
{% elif condition == 'rainy' %}
Regen
{% elif condition == 'snowy-rainy' %}
Schneeregen
{% elif condition == 'windy' %}
Windig
{% elif condition == 'sunny' %}
Sonne
{% elif condition == 'windy-variant' %}
stärkerer Wind
{% else %}
außergewöhnliche Wetterlage
{% endif %}
cond_icon2: >
{% set weather = daily['weather.forecast_home'].forecast[2].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/weather-icons/animated/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather-icons/animated/' + weather + '-night.svg'}}
{% endif %}
temperature2: "{{ daily['weather.forecast_home'].forecast[2].temperature }}"
precipitation2: "{{ daily['weather.forecast_home'].forecast[2].precipitation }}"
datetime3: "{{ daily['weather.forecast_home'].forecast[3].datetime }}"
condition3: >
{% set condition = daily['weather.forecast_home'].forecast[3].condition %}
{% if condition == 'cloudy' %}
Bewölkt
{% elif condition == 'snowy' %}
Schneefall
{% elif condition == 'clear-night' %}
Klare Nacht
{% elif condition == 'fog' %}
Nebel
{% elif condition == 'hail' %}
Hagel
{% elif condition == 'lightning' %}
Gewitter
{% elif condition == 'lightning-rainy' %}
Gewitter & Regen
{% elif condition == 'partlycloudy' %}
Teilweise bewölkt
{% elif condition == 'pouring' %}
starker Regen
{% elif condition == 'rainy' %}
Regen
{% elif condition == 'snowy-rainy' %}
Schneeregen
{% elif condition == 'windy' %}
Windig
{% elif condition == 'sunny' %}
Sonne
{% elif condition == 'windy-variant' %}
stärkerer Wind
{% else %}
außergewöhnliche Wetterlage
{% endif %}
cond_icon3: >
{% set weather = daily['weather.forecast_home'].forecast[3].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/weather-icons/animated/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather-icons/animated/' + weather + '-night.svg'}}
{% endif %}
temperature3: "{{ daily['weather.forecast_home'].forecast[3].temperature }}"
precipitation3: "{{ daily['weather.forecast_home'].forecast[3].precipitation }}"
datetime4: "{{ daily['weather.forecast_home'].forecast[4].datetime }}"
condition4: >
{% set condition = daily['weather.forecast_home'].forecast[4].condition %}
{% if condition == 'cloudy' %}
Bewölkt
{% elif condition == 'snowy' %}
Schneefall
{% elif condition == 'clear-night' %}
Klare Nacht
{% elif condition == 'fog' %}
Nebel
{% elif condition == 'hail' %}
Hagel
{% elif condition == 'lightning' %}
Gewitter
{% elif condition == 'lightning-rainy' %}
Gewitter & Regen
{% elif condition == 'partlycloudy' %}
Teilweise bewölkt
{% elif condition == 'pouring' %}
starker Regen
{% elif condition == 'rainy' %}
Regen
{% elif condition == 'snowy-rainy' %}
Schneeregen
{% elif condition == 'windy' %}
Windig
{% elif condition == 'sunny' %}
Sonne
{% elif condition == 'windy-variant' %}
stärkerer Wind
{% else %}
außergewöhnliche Wetterlage
{% endif %}
cond_icon4: >
{% set weather = daily['weather.forecast_home'].forecast[4].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/weather-icons/animated/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather-icons/animated/' + weather + '-night.svg'}}
{% endif %}
temperature4: "{{ daily['weather.forecast_home'].forecast[4].temperature }}"
precipitation4: "{{ daily['weather.forecast_home'].forecast[4].precipitation }}"
datetime5: "{{ daily['weather.forecast_home'].forecast[5].datetime }}"
condition5: >
{% set condition = daily['weather.forecast_home'].forecast[5].condition %}
{% if condition == 'cloudy' %}
Bewölkt
{% elif condition == 'snowy' %}
Schneefall
{% elif condition == 'clear-night' %}
Klare Nacht
{% elif condition == 'fog' %}
Nebel
{% elif condition == 'hail' %}
Hagel
{% elif condition == 'lightning' %}
Gewitter
{% elif condition == 'lightning-rainy' %}
Gewitter & Regen
{% elif condition == 'partlycloudy' %}
Teilweise bewölkt
{% elif condition == 'pouring' %}
starker Regen
{% elif condition == 'rainy' %}
Regen
{% elif condition == 'snowy-rainy' %}
Schneeregen
{% elif condition == 'windy' %}
Windig
{% elif condition == 'sunny' %}
Sonne
{% elif condition == 'windy-variant' %}
stärkerer Wind
{% else %}
außergewöhnliche Wetterlage
{% endif %}
cond_icon5: >
{% set weather = daily['weather.forecast_home'].forecast[5].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/weather-icons/animated/' + weather + '.svg' }}
{% else %}
{{ '/local/ic/weather-icons/animated/' + weather + '-night.svg'}}
{% endif %}
temperature5: "{{ daily['weather.forecast_home'].forecast[5].temperature }}"
precipitation5: "{{ daily['weather.forecast_home'].forecast[5].precipitation }}"
Ich hätte schwören können, dass es nach Erstellung fehlerfrei war. Sind da
vielleicht Updates vom HA dafür verantwortlich? Wie bekomme ich das korrigiert? So ganz oft schaut man in die Dateien ja auch nicht rein, wenn das System rund läuft.
Besten Dank!
VG
der sven