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).