Thanks! I will try it and change something about the values
Yes, itâs implied that it goes into configuration.yaml as-is. All examples are under the assumption that you place them into configuration.yaml unless otherwise specified. And in many cases, it will just say âit goes in configuration.yamlâ.
Because you canât put any yaml into the UI (outside automation/script yaml mode in UI). The UI is for UI adjustments, not yaml adjustments. This is why I linked the difference between jinja and yaml above. You canât put yaml into the UI but you can put Jinja into the template fields in the UI.
And thatâs why you should use the documentation as full examples and treat all posts on the forums as âpotentially old or incomplete informationâ. His post is showing an automation or script action section.
Once more, thank you @petro, for tying together the lose ends of my understanding!
I now understand why you posted the links before, thank you for clarifying your intention.
Here is what tripped me up: I did already understand the difference between yaml and Jinja. Missing from my understanding was that a template helper will only accept a much smaller subset of what is stored inside a âfullâ configuration.yaml
template entry.
That used to be the assumption under which I worked, but I stopped being so sure about the implied meaning when I sensed a shift to the UI. I have thought about where this feeling came from and I think this makes little sense from a more advanced perspective. It came from the following two, independent factors:
- functionality that was previously
configuration.yaml
-only is increasingly incorporated into the UI, occasionally with a push to prefer UI, and - some of my integrationâs configuration that were previously
configuration.yaml
-only are being moved to the UI, with removingconfiguration.yaml
support entirely.
In conjunction, they gave me the impression that there was an overall shift from configuration.yaml
to the UI, so I expected new UI items to have the intent of replacing the existing configuration.yaml
way of doing things.
With the additional knowledge from this conversation, I understand now that there is no such overall shift and that general rule is standing as strong as always.
Agreed. I always prefer the documentation over a forum post from any user with an unknown proficiency level for that exact reason.
In this instance however, it was difficult to find the right starting spot in the documentation, as the documentation does not aim to provide a solution to my question. The documentation is trying to convey the fact that forecasts are no longer available as attributes, but can be retrieved through a service call.
The mismatch between what the documentation conveys (there will be no more attributes) and my question (how do I get attributes back) is so vast that the documentation was simply not helpful for me to determine the best next step.
All that being said, I am well aware of the tremendous amount of work that goes into maintaining the documentation on the level that you do provide it, and I truly appreciate all of it. All I wanted was to point out that the documentation is â by design â not going to be a guide through the complicated change processes ahead of everyone.
If there was one thing that I could suggest going forward, it would be to extend the alerts inside HA going out for deprecated functionality. This would greatly increase the time that users have to adopt before the breaking change occurs.
itâs already a 6 month period, that isnât enough?
Apologies, I was not expressing myself all too clearly here.
If I observed the current behaviour correctly, it alerts of upcoming service call depreciations. For example, I have received the following alerts in the past:
- The counter configure service is being removed
- Detected use of deprecated service
weather.get_forecast
The removal of attributes does not appear to be checked for and alerted about, though.
While I do understand there are good reasons for this change in data architecture, and I do not oppose it at all, I am conscious that for many users with automations their removal will be of similar impact as the removal of service calls, hence my suggestion.
so how do you make something like this now work?
properties:
"text": >
{%- if not is_state('weather.barb_s_place_hourly','unavailable') %}
{%- set update = states('sensor.date') %}
{%- set midnight = now().replace(hour=0, minute=0, second=0, microsecond=0).timestamp() %}
{%- set event = as_timestamp(strptime(state_attr('weather.barb_s_place_hourly','forecast')[1]['datetime'], '%Y-%m-%dT%H:%M:%S%z', default='2020-01-00T00:00:00+00:00')) %}
{%- set delta = ((event - midnight) // 86400) | int %}
{%- if delta == 0 %}
Today
{%- elif delta == 1 %}
Tomorrow
{%- endif %}
{{- event | timestamp_custom(" %-I %p") }}
{%- endif %}
Try using the solution I posted above, and then also change weather.barb_s_place_hourly
to sensor.weather_hourly
in both places inside your code.
The code above is the original way.
I have been playing with the service calls and templates but canât seem to get it to work in developer tools.
Even using the exact example code on the weather documentation in get errors about hourly.
I will keep poking around
It will help if you share what you have tried and what your results have been so far.
Without that knowledge, I can only guess, so the first question would be: Do you know whether you have any entity that contains hourly weather information?
You can check in developer tools under âstateâ whether you can find any (from your code, I assume you previously had one named weather.barb_s_place_hourly
and from my guesswork I assume that is now gone).
Let me know what you find (or do not find), ideally also include more context on what you are experiencing and we will be happy to help.
As a side note, if you are trying some of the suggestions above, and would like to do so in developer tools alone, be advised this might required a multi-step approach as outlined before.
Sure I will share more details later but I donât really remember what I tried because Iâm a idiot
I have not been home all day or I would have shared .
The barbs weather {part of met.no} does show the hourly attributes and datetime stamps just like before the changes. I think
I also have AccuWeather if that is something I can extract hourly forcast from.
Iâm not not that up to speed in how to use template with service calls . Not a true geekâ:joy:
Once I seen how something is done then I am normally able to learn how to tweek and adjust by using others examples.
Why I was asking for help.
Not a big deal if I canât get it to work
Just using on a several wall panel to show hourly forecast
Like this (the only old screen shot I could find)
This is the attributes available showing in developer tools states.
dew_point: 46
temperature_unit: °F
humidity: 82
cloud_coverage: 97.7
pressure: 30.02
pressure_unit: inHg
wind_bearing: 10.9
wind_speed: 4.72
wind_speed_unit: mph
visibility_unit: mi
precipitation_unit: in
forecast:
- condition: partlycloudy
datetime: "2024-03-10T19:00:00+00:00"
wind_bearing: 10.9
temperature: 51
templow: 43
wind_speed: 6.71
precipitation: 0
humidity: 82
- condition: partlycloudy
datetime: "2024-03-11T19:00:00+00:00"
wind_bearing: 251.5
temperature: 56
templow: 41
wind_speed: 8.08
precipitation: 0.04
humidity: 68
- condition: cloudy
datetime: "2024-03-12T19:00:00+00:00"
wind_bearing: 212.6
temperature: 53
templow: 41
wind_speed: 7.15
precipitation: 0.16
humidity: 84
- condition: partlycloudy
datetime: "2024-03-13T19:00:00+00:00"
wind_bearing: 267.1
temperature: 53
templow: 32
wind_speed: 7.83
precipitation: 0
humidity: 66
- condition: partlycloudy
datetime: "2024-03-14T19:00:00+00:00"
wind_bearing: 330.8
temperature: 58
templow: 45
wind_speed: 13.17
precipitation: 0
humidity: 40
- condition: sunny
datetime: "2024-03-15T19:00:00+00:00"
wind_bearing: 199.6
temperature: 58
templow: 41
wind_speed: 6.03
precipitation: 0
humidity: 49
attribution: >-
Weather forecast from met.no, delivered by the Norwegian Meteorological
Institute.
friendly_name: Forecast Barb's Place
supported_features: 3
And in service call
And in entity information
And thanks for trying to help this dumb ass
all I have done so far because I have a day job. LOL is the templet for sensor.weather_hourly
#weather forcast hourly sensor
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: weather.home
response_variable: hourly
sensor:
- name: Weather Hourly
state: "{{ states('weather.home') }}"
attributes:
temperature: "{{ state_attr('weather.home', 'temperature') }}"
dew_point: "{{ state_attr('weather.home', 'dew_point') }}"
temperature_unit: "{{ state_attr('weather.home', 'temperature_unit') }}"
humidity: "{{ state_attr('weather.home', 'humidity') }}"
cloud_coverage: "{{ state_attr('weather.home', 'cloud_coverage') }}"
pressure: "{{ state_attr('weather.home', 'pressure') }}"
pressure_unit: "{{ state_attr('weather.home', 'pressure_unit') }}"
wind_bearing: "{{ state_attr('weather.home', 'wind_bearing') }}"
wind_speed: "{{ state_attr('weather.home', 'wind_speed') }}"
wind_speed_unit: "{{ state_attr('weather.home', 'wind_speed_unit') }}"
visibility_unit: "{{ state_attr('weather.home', 'visibility_unit') }}"
precipitation_unit: "{{ state_attr('weather.home', 'precipitation_unit') }}"
forecast: "{{ hourly['weather.home'].forecast }}"
Hi,
Iâm not sure I understand what you want to do. But I donât see why you created another weather sensor. To obtain hourly forecasts, you can proceed as follows:
template:
# Obtenir les pévisions horaire
- trigger:
- platform: time_pattern
hours: /1
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id:
- weather.forecast_shawinigan_sud
response_variable: previsionshoraire
sensor:
# Date et heure
- name: "def_heure_date_h0"
unique_id: "def_heure_date_h0"
state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].datetime }}"
# Conditions
- name: "def_previsions_condition_h0"
unique_id: "def_previsions_condition_h0"
state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].condition }}"
# Temperature
- name: "def_previsions_temperature_h0"
unique_id: "def_previsions_temperature_h0"
unit_of_measurement: "°C"
state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].temperature }}"
# Vitesse du vent
- name: "def_vitesse_vent_h0"
unique_id: "def_vitesse_vent_h0"
unit_of_measurement: "km/h"
state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].wind_speed }}"
# precipitation probability
- name: "def_previsions_precipitation_probability_h0"
unique_id: "def_previsions_precipitation_probability_h0"
unit_of_measurement: "%"
state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].precipitation_probability }}"
# Precipitation
- name: "def_previsions_precipitation_h0"
unique_id: "def_previsions_precipitation_h0"
unit_of_measurement: "mm"
state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].precipitation }}"
yhaa I got it thanks. the forums would not let me post a update I guess I was flooding LOL
- obj: "p5b51" # Forecast time +8h
properties:
"text": >
{%- if not is_state('sensor.weather_hourly','unavailable') %}
{%- set update = states('sensor.date') %}
{%- set midnight = now().replace(hour=0, minute=0, second=0, microsecond=0).timestamp() %}
{%- set event = as_timestamp(strptime(state_attr('sensor.weather_hourly','forecast')[8]['datetime'], '%Y-%m-%dT%H:%M:%S%z', default='2020-01-00T00:00:00+00:00')) %}
{%- set delta = ((event - midnight) // 86400) | int %}
{%- if delta == 0 %}
Today
{%- elif delta == 1 %}
Tomorrow
{%- endif %}
{{- event | timestamp_custom(" %-I %p") }}
{%- endif %}
- obj: "p5b52" # Forecast temp +8h
properties:
"text": "{{ state_attr('sensor.weather_hourly','forecast')[8]['temperature'] if not is_state('sensor.weather_hourly','unavailable') else '-' }}"
- obj: "p5b53" # Forecast condition +8h
properties:
"src": >
{%- if not is_state('sensor.weather_hourly','unavailable') %}
L:/w-32-{{ state_attr('sensor.weather_hourly','forecast')[8]['condition'] }}.png
{%- endif %}
May I ask, what are âobj:â and âpropertiesâ? Iâm not familiar with these.
Itâs for Json.
To display and actions on a display panel
if I want to retrieve one specific value via the template way using response_variable = mydata, Iâm not sure about the syntaxâŠ
How can I simulate that in developper tool ?
{% set cond0 = mydata['weather.house'].forecast[1].condition %}
{% set cond0_time = as_timestamp(mydata['weather.house'].forecast[1].datetime) %}
Edit: Iâm answering myself: in template, it works.
Still I didnât find the way to simulate or provide example data in dev tool.
Hi all, I have updated to the April HA release and found out that my Apex graph that plots meteogram of the forecast does not work. Following discussion in this thread, I created a template sensor that should substitute the original weather. I did this as follows:
template:
- trigger:
- platform: time_pattern
minutes: "*"
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
action:
- variables:
weather: weather.domov
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id: "{{ weather }}"
response_variable: response
- variables:
forecast: "{{ response[weather].forecast }}"
start: "{{ today_at('00:00') }}"
sensor:
- name: Weather Forecast Hourly
unique_id: weather_forecast_hourly
state: "{{ states('weather.domov') }}"
attributes:
temperature: "{{ state_attr('weather.domov', 'temperature') }}"
dew_point: "{{ state_attr('weather.domov', 'dew_point') }}"
temperature_unit: "{{ state_attr('weather.domov', 'temperature_unit') }}"
humidity: "{{ state_attr('weather.domov', 'humidity') }}"
cloud_coverage: "{{ state_attr('weather.domov', 'cloud_coverage') }}"
pressure: "{{ state_attr('weather.domov', 'pressure') }}"
pressure_unit: "{{ state_attr('weather.domov', 'pressure_unit') }}"
wind_bearing: "{{ state_attr('weather.domov', 'wind_bearing') }}"
wind_gust_speed: "{{ state_attr('weather.domov', 'wind_gust_speed') }}"
wind_speed: "{{ state_attr('weather.domov', 'wind_speed') }}"
wind_speed_unit: "{{ state_attr('weather.domov', 'wind_speed_unit') }}"
visibility: "{{ state_attr('weather.domov', 'visibility') }}"
visibility_unit: "{{ state_attr('weather.domov', 'visibility_unit') }}"
precipitation: "{{ state_attr('weather.domov', 'precipitation') }}"
precipitation_unit: "{{ state_attr('weather.domov', 'precipitation_unit') }}"
forecast: {{ forecast }}
However, the resulting sensor looks like this:
friendly_name: Weather Forecast Hourly
temperature: 11.7
temperature_unit: °C
humidity: 80
cloud_coverage: 52
pressure: 1018.2
pressure_unit: hPa
wind_bearing: 224.65
wind_gust_speed: 29.52
wind_speed: 15.84
wind_speed_unit: km/h
visibility_unit: km
precipitation_unit: mm
forecast: >-
[{'datetime': datetime.datetime(2024, 4, 5, 10, 0), 'condition':
'partlycloudy', 'cloud_coverage': 68, 'wind_bearing': 228.86, 'temperature':
13.6, 'apparent_temperature': 10.1, 'pressure': 1017.8, 'wind_gust_speed':
28.44, 'wind_speed': 17.64, 'precipitation': 0.0, 'humidity': 75},
{'datetime': datetime.datetime(2024, 4, 5, 11, 0), 'condition':
'partlycloudy', 'cloud_coverage': 87, 'wind_bearing': 228.47, 'temperature':
15.3, 'apparent_temperature': 11.8, 'pressure': 1017.5, 'wind_gust_speed':
30.6, 'wind_speed': 18.72, 'precipitation': 0.0, 'humidity': 71}, {'datetime':
datetime.datetime(2024, 4, 5, 12, 0), 'condition': 'cloudy', 'cloud_coverage':
92, 'wind_bearing': 243.53, 'temperature': 16.3, 'apparent_temperature': 12.8,
'pressure': 1017.6, 'wind_gust_speed': 30.6, 'wind_speed': 18.72,
'precipitation': 0.0, 'humidity': 67}, {'datetime': datetime.datetime(2024, 4,
5, 13, 0), 'condition': 'cloudy', 'cloud_coverage': 67, 'wind_bearing':
249.09, 'temperature': 17.1, 'apparent_temperature': 13.6, 'pressure': 1017.2,
'wind_gust_speed': 32.76, 'wind_speed': 17.28, 'precipitation': 0.0,
'humidity': 64}, {'datetime': datetime.datetime(2024, 4, 5, 14, 0),
'condition': 'partlycloudy', 'cloud_coverage': 65, 'wind_bearing': 235.9,
'temperature': 18.1, 'apparent_temperature': 14.6, 'pressure': 1016.7,
'wind_gust_speed': 28.8, 'wind_speed': 17.64, 'precipitation': 0.0,
'humidity': 63}, {'datetime': datetime.datetime(2024, 4, 5, 15, 0),
'condition': 'partlycloudy', 'cloud_coverage': 55, 'wind_bearing': 242.57,
'temperature': 18.9, 'apparent_temperature': 14.4, 'pressure': 1016.3,
'wind_gust_speed': 32.4, 'wind_speed': 19.8, 'precipitation': 0.0, 'humidity':
59}, {'datetime': datetime.datetime(2024, 4, 5, 16, 0), 'condition':
'partlycloudy', 'cloud_coverage': 66, 'wind_bearing': 245.22, 'temperature':
19.3, 'apparent_temperature': 17.9, 'pressure': 1015.6, 'wind_gust_speed':
32.4, 'wind_speed': 16.2, 'precipitation': 0.0, 'humidity': 57}, {'datetime':
datetime.datetime(2024, 4, 5, 17, 0), 'condition': 'partlycloudy',
'cloud_coverage': 54, 'wind_bearing': 223.14, 'temperature': 19.6,
'apparent_temperature': 19.0, 'pressure': 1015.1, 'wind_gust_speed': 26.28,
'wind_speed': 12.6, 'precipitation': 0.0, 'humidity': 58}, {'datetime':
datetime.datetime(2024, 4, 5, 18, 0), 'condition': 'partlycloudy',
'cloud_coverage': 18, 'wind_bearing': 212.25, 'temperature': 19.5,
'apparent_temperature': 18.1, 'pressure': 1014.9, 'wind_gust_speed': 24.48,
'wind_speed': 14.4, 'precipitation': 0.0, 'humidity': 59}, {'datetime':
datetime.datetime(2024, 4, 5, 19, 0), 'condition': 'partlycloudy',
'cloud_coverage': 38, 'wind_bearing': 214.57, 'temperature': 18.4,
'apparent_temperature': 17.9, 'pressure': 1015.2, 'wind_gust_speed': 22.68,
'wind_speed': 12.24, 'precipitation': 0.0, 'humidity': 65}, {'datetime':
datetime.datetime(2024, 4, 5, 20, 0), 'condition': 'cloudy', 'cloud_coverage':
100, 'wind_bearing': 187.52, 'temperature': 17.5, 'apparent_temperature':
14.9, 'pressure': 1015.0, 'wind_gust_speed': 22.68, 'wind_speed': 15.12,
'precipitation': 0.0, 'humidity': 63}, {'datetime': datetime.datetime(2024, 4,
5, 21, 0), 'condition': 'cloudy', 'cloud_coverage': 97, 'wind_bearing':
200.34, 'temperature': 17.3, 'apparent_temperature': 13.8, 'pressure': 1015.2,
'wind_gust_speed': 26.28, 'wind_speed': 17.64, 'precipitation': 0.0,
'humidity': 60}, {'datetime': datetime.datetime(2024, 4, 5, 22, 0),
'condition': 'partlycloudy', 'cloud_coverage': 83, 'wind_bearing': 217.1,
'temperature': 16.8, 'apparent_temperature': 13.3, 'pressure': 1015.5,
'wind_gust_speed': 28.44, 'wind_speed': 18.72, 'precipitation': 0.0,
'humidity': 60}, {'datetime': datetime.datetime(2024, 4, 5, 23, 0),
'condition': 'partlycloudy', 'cloud_coverage': 61, 'wind_bearing': 243.0,
'temperature': 16.3, 'apparent_temperature': 12.8, 'pressure': 1016.2,
'wind_gust_speed': 29.16, 'wind_speed': 18.0, 'precipitation': 0.0,
'humidity': 60}, {'datetime': datetime.datetime(2024, 4, 6, 0, 0),
'condition': 'partlycloudy', 'cloud_coverage': 53, 'wind_bearing': 252.37,
'temperature': 15.7, 'apparent_temperature': 11.2, 'pressure': 1016.7,
'wind_gust_speed': 31.32, 'wind_speed': 20.16, 'precipitation': 0.0,
'humidity': 68}, {'datetime': datetime.datetime(2024, 4, 6, 1, 0),
'condition': 'partlycloudy', 'cloud_coverage': 90, 'wind_bearing': 250.04,
'temperature': 15.4, 'apparent_temperature': 11.9, 'pressure': 1017.1,
'wind_gust_speed': 30.6, 'wind_speed': 18.0, 'precipitation': 0.0, 'humidity':
72}, {'datetime': datetime.datetime(2024, 4, 6, 2, 0), 'condition': 'cloudy',
'cloud_coverage': 86, 'wind_bearing': 247.55, 'temperature': 14.9,
'apparent_temperature': 11.4, 'pressure': 1017.2, 'wind_gust_speed': 27.36,
'wind_speed': 16.92, 'precipitation': 0.0, 'humidity': 71}, {'datetime':
datetime.datetime(2024, 4, 6, 3, 0), 'condition': 'cloudy', 'cloud_coverage':
93, 'wind_bearing': 245.44, 'temperature': 14.2, 'apparent_temperature': 10.7,
'pressure': 1017.1, 'wind_gust_speed': 25.92, 'wind_speed': 16.2,
'precipitation': 0.0, 'humidity': 73}, {'datetime': datetime.datetime(2024, 4,
6, 4, 0), 'condition': 'cloudy', 'cloud_coverage': 89, 'wind_bearing': 231.21,
'temperature': 13.7, 'apparent_temperature': 10.2, 'pressure': 1017.2,
'wind_gust_speed': 28.08, 'wind_speed': 19.08, 'precipitation': 0.0,
'humidity': 75}, {'datetime': datetime.datetime(2024, 4, 6, 5, 0),
'condition': 'cloudy', 'cloud_coverage': 97, 'wind_bearing': 254.25,
'temperature': 13.8, 'apparent_temperature': 11.2, 'pressure': 1018.0,
'wind_gust_speed': 30.96, 'wind_speed': 14.4, 'precipitation': 0.0,
'humidity': 75}, {'datetime': datetime.datetime(2024, 4, 6, 6, 0),
'condition': 'cloudy', 'cloud_coverage': 94, 'wind_bearing': 251.38,
'temperature': 13.3, 'apparent_temperature': 12.2, 'pressure': 1018.1,
'wind_gust_speed': 23.04, 'wind_speed': 7.56, 'precipitation': 0.0,
'humidity': 78}, {'datetime': datetime.datetime(2024, 4, 6, 7, 0),
'condition': 'cloudy', 'cloud_coverage': 85, 'wind_bearing': 207.4,
'temperature': 12.9, 'apparent_temperature': 11.8, 'pressure': 1018.7,
'wind_gust_speed': 12.6, 'wind_speed': 7.56, 'precipitation': 0.0, 'humidity':
83}, {'datetime': datetime.datetime(2024, 4, 6, 8, 0), 'condition': 'cloudy',
'cloud_coverage': 99, 'wind_bearing': 209.69, 'temperature': 13.4,
'apparent_temperature': 11.6, 'pressure': 1019.0, 'wind_gust_speed': 13.68,
'wind_speed': 9.36, 'precipitation': 0.0, 'humidity': 82}, {'datetime':
datetime.datetime(2024, 4, 6, 9, 0), 'condition': 'cloudy', 'cloud_coverage':
95, 'wind_bearing': 228.77, 'temperature': 14.5, 'apparent_temperature': 12.7,
'pressure': 1019.2, 'wind_gust_speed': 18.36, 'wind_speed': 11.52,
'precipitation': 0.0, 'humidity': 77}, {'datetime': datetime.datetime(2024, 4,
6, 10, 0), 'condition': 'cloudy', 'cloud_coverage': 99, 'wind_bearing': 264.6,
'temperature': 15.0, 'apparent_temperature': 13.9, 'pressure': 1019.9,
'wind_gust_speed': 20.88, 'wind_speed': 9.0, 'precipitation': 0.0, 'humidity':
75}, {'datetime': datetime.datetime(2024, 4, 6, 11, 0), 'condition': 'cloudy',
'cloud_coverage': 42, 'wind_bearing': 218.84, 'temperature': 17.0,
'apparent_temperature': 16.6, 'pressure': 1019.6, 'wind_gust_speed': 17.28,
'wind_speed': 10.08, 'precipitation': 0.0, 'humidity': 71}, {'datetime':
datetime.datetime(2024, 4, 6, 12, 0), 'condition': 'partlycloudy',
'cloud_coverage': 45, 'wind_bearing': 232.78, 'temperature': 19.1,
'apparent_temperature': 18.5, 'pressure': 1019.2, 'wind_gust_speed': 19.08,
'wind_speed': 10.8, 'precipitation': 0.0, 'humidity': 63}, {'datetime':
datetime.datetime(2024, 4, 6, 13, 0), 'condition': 'partlycloudy',
'cloud_coverage': 50, 'wind_bearing': 228.53, 'temperature': 20.7,
'apparent_temperature': 20.1, 'pressure': 1018.7, 'wind_gust_speed': 20.52,
'wind_speed': 9.72, 'precipitation': 0.0, 'humidity': 59}, {'datetime':
datetime.datetime(2024, 4, 6, 14, 0), 'condition': 'partlycloudy',
'cloud_coverage': 59, 'wind_bearing': 244.94, 'temperature': 22.4,
'apparent_temperature': 21.7, 'pressure': 1018.3, 'wind_gust_speed': 20.16,
'wind_speed': 10.8, 'precipitation': 0.0, 'humidity': 54}, {'datetime':
datetime.datetime(2024, 4, 6, 15, 0), 'condition': 'partlycloudy',
'cloud_coverage': 50, 'wind_bearing': 249.14, 'temperature': 23.1,
'apparent_temperature': 22.3, 'pressure': 1018.0, 'wind_gust_speed': 22.68,
'wind_speed': 12.24, 'precipitation': 0.0, 'humidity': 50}, {'datetime':
datetime.datetime(2024, 4, 6, 16, 0), 'condition': 'partlycloudy',
'cloud_coverage': 48, 'wind_bearing': 253.46, 'temperature': 23.3,
'apparent_temperature': 22.5, 'pressure': 1017.7, 'wind_gust_speed': 21.6,
'wind_speed': 11.16, 'precipitation': 0.0, 'humidity': 49}, {'datetime':
datetime.datetime(2024, 4, 6, 17, 0), 'condition': 'partlycloudy',
'cloud_coverage': 57, 'wind_bearing': 222.53, 'temperature': 23.1,
'apparent_temperature': 22.3, 'pressure': 1017.8, 'wind_gust_speed': 19.8,
'wind_speed': 11.88, 'precipitation': 0.0, 'humidity': 51}, {'datetime':
datetime.datetime(2024, 4, 6, 18, 0), 'condition': 'partlycloudy',
'cloud_coverage': 43, 'wind_bearing': 209.56, 'temperature': 22.4,
'apparent_temperature': 21.7, 'pressure': 1017.5, 'wind_gust_speed': 19.08,
'wind_speed': 10.44, 'precipitation': 0.0, 'humidity': 55}, {'datetime':
datetime.datetime(2024, 4, 6, 19, 0), 'condition': 'partlycloudy',
'cloud_coverage': 33, 'wind_bearing': 215.93, 'temperature': 20.9,
'apparent_temperature': 20.3, 'pressure': 1017.4, 'wind_gust_speed': 16.2,
'wind_speed': 9.36, 'precipitation': 0.0, 'humidity': 62}, {'datetime':
datetime.datetime(2024, 4, 6, 20, 0), 'condition': 'clear-night',
'cloud_coverage': 12, 'wind_bearing': 209.09, 'temperature': 18.7,
'apparent_temperature': 18.9, 'pressure': 1017.6, 'wind_gust_speed': 12.96,
'wind_speed': 8.28, 'precipitation': 0.0, 'humidity': 67}, {'datetime':
datetime.datetime(2024, 4, 6, 21, 0), 'condition': 'clear-night',
'cloud_coverage': 26, 'wind_bearing': 194.42, 'temperature': 17.0,
'apparent_temperature': 16.6, 'pressure': 1018.2, 'wind_gust_speed': 11.88,
'wind_speed': 9.0, 'precipitation': 0.0, 'humidity': 68}, {'datetime':
datetime.datetime(2024, 4, 6, 22, 0), 'condition': 'clear-night',
'cloud_coverage': 21, 'wind_bearing': 178.52, 'temperature': 15.8,
'apparent_temperature': 14.0, 'pressure': 1018.5, 'wind_gust_speed': 12.6,
'wind_speed': 9.72, 'precipitation': 0.0, 'humidity': 74}, {'datetime':
datetime.datetime(2024, 4, 6, 23, 0), 'condition': 'clear-night',
'cloud_coverage': 28, 'wind_bearing': 193.53, 'temperature': 14.9,
'apparent_temperature': 13.1, 'pressure': 1018.3, 'wind_gust_speed': 14.4,
'wind_speed': 10.8, 'precipitation': 0.0, 'humidity': 81}, {'datetime':
datetime.datetime(2024, 4, 7, 0, 0), 'condition': 'clear-night',
'cloud_coverage': 5, 'wind_bearing': 196.75, 'temperature': 14.2,
'apparent_temperature': 12.4, 'pressure': 1018.2, 'wind_gust_speed': 15.84,
'wind_speed': 11.16, 'precipitation': 0.0, 'humidity': 82}, {'datetime':
datetime.datetime(2024, 4, 7, 1, 0), 'condition': 'clear-night',
'cloud_coverage': 1, 'wind_bearing': 181.62, 'temperature': 13.5,
'apparent_temperature': 11.7, 'pressure': 1018.6, 'wind_gust_speed': 15.48,
'wind_speed': 9.72, 'precipitation': 0.0, 'humidity': 79}, {'datetime':
datetime.datetime(2024, 4, 7, 2, 0), 'condition': 'clear-night',
'cloud_coverage': 1, 'wind_bearing': 173.52, 'temperature': 13.0,
'apparent_temperature': 11.2, 'pressure': 1018.9, 'wind_gust_speed': 12.96,
'wind_speed': 9.0, 'precipitation': 0.0, 'humidity': 76}, {'datetime':
datetime.datetime(2024, 4, 7, 3, 0), 'condition': 'clear-night',
'cloud_coverage': 0, 'wind_bearing': 178.96, 'temperature': 12.8,
'apparent_temperature': 11.0, 'pressure': 1019.1, 'wind_gust_speed': 15.12,
'wind_speed': 11.16, 'precipitation': 0.0, 'humidity': 73}, {'datetime':
datetime.datetime(2024, 4, 7, 4, 0), 'condition': 'clear-night',
'cloud_coverage': 6, 'wind_bearing': 176.45, 'temperature': 12.6,
'apparent_temperature': 10.8, 'pressure': 1019.0, 'wind_gust_speed': 15.12,
'wind_speed': 10.44, 'precipitation': 0.0, 'humidity': 76}, {'datetime':
datetime.datetime(2024, 4, 7, 5, 0), 'condition': 'clear-night',
'cloud_coverage': 20, 'wind_bearing': 178.65, 'temperature': 12.3,
'apparent_temperature': 10.5, 'pressure': 1018.8, 'wind_gust_speed': 14.4,
'wind_speed': 10.08, 'precipitation': 0.0, 'humidity': 75}, {'datetime':
datetime.datetime(2024, 4, 7, 6, 0), 'condition': 'partlycloudy',
'cloud_coverage': 54, 'wind_bearing': 176.78, 'temperature': 11.9,
'apparent_temperature': 10.1, 'pressure': 1018.8, 'wind_gust_speed': 14.76,
'wind_speed': 9.72, 'precipitation': 0.0, 'humidity': 73}, {'datetime':
datetime.datetime(2024, 4, 7, 7, 0), 'condition': 'partlycloudy',
'cloud_coverage': 67, 'wind_bearing': 153.28, 'temperature': 11.0,
'apparent_temperature': 9.9, 'pressure': 1019.4, 'wind_gust_speed': 13.68,
'wind_speed': 6.12, 'precipitation': 0.0, 'humidity': 77}, {'datetime':
datetime.datetime(2024, 4, 7, 8, 0), 'condition': 'partlycloudy',
'cloud_coverage': 71, 'wind_bearing': 130.91, 'temperature': 12.0,
'apparent_temperature': 11.5, 'pressure': 1019.8, 'wind_gust_speed': 9.72,
'wind_speed': 5.04, 'precipitation': 0.0, 'humidity': 76}]
The forecast attribute is different to what it used to be (not formated datetime, attribute is a string instead of an iterable object; e.g., forecast[1] is a single character).
In the plotting part (apex) I have entries like this
- entity: sensor.weather_forecast_hourly
name: Teplota pĆedpovÄÄ
yaxis_id: temp
unit: °C
type: line
color: '#FFBF00'
data_generator: |
return entity.attributes.forecast.map((entry) =>
{
var date = new Date(entry.datetime);
return [date, entry.temperature];
});
show:
datalabels: false
extremas: true
Does anyone have an idea how to fix it? Many thanks in advance and sorry if I failed to find a post that might have addressed this (but I tried).
Your weather provided uses datetime.datetime objects in the forecast, instead of datetime strings. This makes your template weather entity fail rendering itâs forecast attribute and it puts it all in a big string.
You need to iterate over all the forecast data, and replace the datetime.datetime objects with a datetime isoformat string. Or you need ot use another weather provider which already uses strings