Closed slecram closed 10 months ago
I have the same problem with Home Assistants 'Clock Weather Card'. It doesn't work any more, because the forecast attribute is missing.
Unfortunately it had to be removed due to changes in HA: Forecast Attribute
I primarily suggest, that you inform the developer of your custom card to adapt as well. However I could provide the forecast as a separate sensor if requested.
I reopen this for reference until most of the weather cards have been updated.
The forecast attribute was a very useful feature for me. I've used this by the following code:
template:
- sensor:
- name: "Temperatur DWD Waltrop Heute Min"
unique_id: temperatur_dwd_waltrop_forecast_0_temp_min
state: "{{state_attr('weather.waltrop_abdinghof','forecast')[0]['templow'] | float(0) }}"
unit_of_measurement: "°C"
device_class: temperature
Could anybody supply a code example, how to get current day's min and max expected temperature from DWD prediction?
Greetings Heiko
template:
- trigger:
- platform: time_pattern
hours: "/1"
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
action:
- service: weather.get_forecast
data:
type: daily
target:
entity_id: weather.salzuflen_bad_salzuflen_bad
response_variable: forecast
sensor:
- name: wetter_temp_vorhersage_heute_max
unique_id: wetter_temp_vorhersage_heute_max
state: "{{ forecast.forecast[0].temperature}}"
unit_of_measurement: "°C"
- name: wetter_temp_vorhersage_heute_min
unique_id: wetter_temp_vorhersage_heute_min
state: "{{ forecast.forecast[0].templow}}"
unit_of_measurement: "°C"
Sorry for the code format but the "code" function doesn't work for me...?
Edit Now it works. First paste the code and after that mark it as code ;-)
Thanks a lot. That works!
Here, you can find the code:
template:
- trigger:
- platform: time_pattern
hours: "/1"
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
action:
- service: weather.get_forecast
data:
type: daily
target:
entity_id: weather.dwd_waltrop_abdinghof
response_variable: forecast
sensor:
- name: "DWD Waltrop-Abdinghof Vorhersage Heute Max"
unique_id: dwd_waltrop_abdinghof_forecast_today_max
state: "{{ forecast.forecast[0].temperature}}"
unit_of_measurement: "°C"
- name: "DWD Waltrop-Abdinghof Vorhersage Heute Min"
unique_id: dwd_waltrop_abdinghof_forecast_today_min
state: "{{ forecast.forecast[0].templow}}"
unit_of_measurement: "°C"
Greetings, Heiko
Version of home_assistant
2023.9.2
Where do I find the forecasts after update to the current version?