bremor / bureau_of_meteorology

Custom component for retrieving weather information from the Bureau of Meteorology.
MIT License
177 stars 31 forks source link

.get_forecasts returning uv not uv_index as per documentation #217

Open homeassistant-fyffehouse opened 3 months ago

homeassistant-fyffehouse commented 3 months ago

I am using the forecast from the bureau_of_meteorology integration (both daily and hourly) along with my weather station data (ecowitt 2553) to create a weather platform template.

image

The bom integration when calling weather.get_forecasts on it, returns the wrong key for the uv index.

Example:

returns

weather.upper_brookfield_hourly: forecast:

The correct uv key should be uv_index as per the documentation at https://www.home-assistant.io/integrations/weather/ The response data field is a mapping of called target entities, each containing the forecast field. forecast is a list of forecasted conditions at a given point in time:

The table describes the uv index key as: uv_index | The UV index. | 3

When using the returned forecast in a weather platform template, the forecast_hourly_template assignment will fail.

from template 'Template<template=({{ state_attr('sensor.hourly_forecasts_for_upper_brookfield','forecast') }}) renders=4>' for attribute '_forecast_hourly' in entity weather.ecowitt_weather_station validation message 'Only valid keys in Forecast are allowed, unallowed keys: ({'uv'}), see Weather documentation https://www.home-assistant.io/integrations/weather/'

A simple regular expression on the data is a work around: forecast_hourly_template: "{{ state_attr('sensor.hourly_forecasts_for_upper_brookfield','forecast') |regex_replace(find='uv', replace='uv_index', ignorecase=False) }}"

homeassistant-fyffehouse commented 3 months ago

This might be related to #216