I created a custom weather card.
When I tap on the card, the weekly forecast opens.
Everything is running fine so far, the only problem is that between 00:00 and 03:00 I apparently don’t receive any data, and the card runs into an error, so that only the faulty code is visible.
Anyone have an idea what could be causing this?
Here is the excerpt from my `configuration.yaml:
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
target:
entity_id:
- weather.tomorrow_io_daily
data:
type: hourly
response_variable: hourly
- service: weather.get_forecasts
target:
entity_id:
- weather.tomorrow_io_daily
data:
type: daily
response_variable: daily
sensor:
- name: Wetter Vorhersage alles
unique_id: wetter_vorhersage_alles
state: "{{ now().isoformat() }}"
attributes:
now_condition: >
{% from 'weather_translate.jinja' import translate_condition %}
{{ translate_condition(hourly['weather.tomorrow_io_daily'].forecast[0].condition) }}
now_icon: >
{% set weather = hourly['weather.tomorrow_io_daily'].forecast[0].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/weather_icons/' + weather + '.svg' }}
{% else %}
{{ '/local/weather_icons/' + weather + '_night.svg' }}
{% endif %}
now_wind_direction: >
{% set direction = ['N','NNO','NO','ONO','O','OSO','SO','SSO','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
{% set degree = (hourly['weather.tomorrow_io_daily'].forecast[0].wind_bearing | float) %}
{{ direction[((degree+11.25)/22.5)|int] }}
now_wind_desc: >
{% from 'weather_wind.jinja' import get_wind_description %}
{{ get_wind_description(hourly['weather.tomorrow_io_daily'].forecast[0].wind_speed | float) }}
{% set sensor = (hourly['weather.tomorrow_io_daily'].forecast[0].wind_speed | 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 %}
Schwacher Wind
{% elif sensor > 20 and sensor < 29.99 %}
Mäßiger Wind
{% elif sensor > 30 and sensor < 39.99 %}
Frischer Wind
{% elif sensor > 40 and sensor < 50.99 %}
Starker Wind
{% elif sensor > 51 and sensor < 62.99 %}
Streifer 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 %}
now_temp: "{{ hourly['weather.tomorrow_io_daily'].forecast[0].temperature }}"
now_precipitation: "{{ hourly['weather.tomorrow_io_daily'].forecast[0].precipitation }}"
now_precipitation_probability: "{{ hourly['weather.tomorrow_io_daily'].forecast[0].precipitation_probability }}"
now_humidity: "{{ hourly['weather.tomorrow_io_daily'].forecast[0].humidity }}"
now_wind_speed: "{{ hourly['weather.tomorrow_io_daily'].forecast[0].wind_speed }}"
today_condition: >
{% from 'weather_translate.jinja' import translate_condition %}
{{ translate_condition(daily['weather.tomorrow_io_daily'].forecast[0].condition) }}
today_icon: >
{% set weather = daily['weather.tomorrow_io_daily'].forecast[0].condition %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ '/local/weather_icons/' + weather + '.svg' }}
{% else %}
{{ '/local/weather_icons/' + weather + '_night.svg' }}
{% endif %}
today_wind_direction: >
{% set direction = ['N','NNO','NO','ONO','O','OSO','SO','SSO','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
{% set degree = (daily['weather.tomorrow_io_daily'].forecast[0].wind_bearing | float) %}
{{ direction[((degree+11.25)/22.5)|int] }}
today_wind_desc: >
{% from 'weather_wind.jinja' import get_wind_description %}
{{ get_wind_description(hourly['weather.tomorrow_io_daily'].forecast[0].wind_speed | float) }}
{% set sensor = (hourly['weather.tomorrow_io_daily'].forecast[0].wind_speed | 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 %}
Schwacher Wind
{% elif sensor > 20 and sensor < 29.99 %}
Mäßiger Wind
{% elif sensor > 30 and sensor < 39.99 %}
Frischer Wind
{% elif sensor > 40 and sensor < 50.99 %}
Starker Wind
{% elif sensor > 51 and sensor < 62.99 %}
Streifer 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 %}
today_temp: "{{ daily['weather.tomorrow_io_daily'].forecast[0].temperature }}"
today_precipitation: "{{ daily['weather.tomorrow_io_daily'].forecast[0].precipitation }}"
today_precipitation_probability: "{{ daily['weather.tomorrow_io_daily'].forecast[0].precipitation_probability }}"
today_humidity: "{{ daily['weather.tomorrow_io_daily'].forecast[0].humidity }}"
today_wind_speed: "{{ daily['weather.tomorrow_io_daily'].forecast[0].wind_speed }}"
forc1_datetime: "{{ daily['weather.tomorrow_io_daily'].forecast[1].datetime }}"
forc1_condition: >
{% from 'weather_translate.jinja' import translate_condition %}
{{ translate_condition(daily['weather.tomorrow_io_daily'].forecast[1].condition) }}
forc1_icon: >
{% set weather = daily['weather.tomorrow_io_daily'].forecast[1].condition %}
{{ '/local/weather_icons/' + weather + '.svg' }}
forc1_temp: "{{ daily['weather.tomorrow_io_daily'].forecast[1].temperature }}"
forc1_precipitation: "{{ daily['weather.tomorrow_io_daily'].forecast[1].precipitation }}"
forc2_datetime: "{{ daily['weather.tomorrow_io_daily'].forecast[2].datetime }}"
forc2_condition: >
{% from 'weather_translate.jinja' import translate_condition %}
{{ translate_condition(daily['weather.tomorrow_io_daily'].forecast[2].condition) }}
forc2_icon: >
{% set weather = daily['weather.tomorrow_io_daily'].forecast[2].condition %}
{{ '/local/weather_icons/' + weather + '.svg' }}
forc2_temp: "{{ daily['weather.tomorrow_io_daily'].forecast[2].temperature }}"
forc2_precipitation: "{{ daily['weather.tomorrow_io_daily'].forecast[2].precipitation }}"
forc3_datetime: "{{ daily['weather.tomorrow_io_daily'].forecast[3].datetime }}"
forc3_condition: >
{% from 'weather_translate.jinja' import translate_condition %}
{{ translate_condition(daily['weather.tomorrow_io_daily'].forecast[3].condition) }}
forc3_icon: >
{% set weather = daily['weather.tomorrow_io_daily'].forecast[3].condition %}
{{ '/local/weather_icons/' + weather + '.svg' }}
forc3_temp: "{{ daily['weather.tomorrow_io_daily'].forecast[3].temperature }}"
forc3_precipitation: "{{ daily['weather.tomorrow_io_daily'].forecast[3].precipitation }}"
forc4_datetime: "{{ daily['weather.tomorrow_io_daily'].forecast[4].datetime }}"
forc4_condition: >
{% from 'weather_translate.jinja' import translate_condition %}
{{ translate_condition(daily['weather.tomorrow_io_daily'].forecast[4].condition) }}
forc4_icon: >
{% set weather = daily['weather.tomorrow_io_daily'].forecast[4].condition %}
{{ '/local/weather_icons/' + weather + '.svg' }}
forc4_temp: "{{ daily['weather.tomorrow_io_daily'].forecast[4].temperature }}"
forc4_precipitation: "{{ daily['weather.tomorrow_io_daily'].forecast[4].precipitation }}"
forc5_datetime: "{{ daily['weather.tomorrow_io_daily'].forecast[5].datetime }}"
forc5_condition: >
{% from 'weather_translate.jinja' import translate_condition %}
{{ translate_condition(daily['weather.tomorrow_io_daily'].forecast[5].condition) }}
forc5_icon: >
{% set weather = daily['weather.tomorrow_io_daily'].forecast[5].condition %}
{{ '/local/weather_icons/' + weather + '.svg' }}
forc5_temp: "{{ daily['weather.tomorrow_io_daily'].forecast[5].temperature }}"
forc5_precipitation: "{{ daily['weather.tomorrow_io_daily'].forecast[5].precipitation }}"