HomeAssistant
HomeAssistant copied to clipboard
'UV Index & Humidity' with Hourly Forecast from OpenWeatherMap through the One Call API 3.0
Your 'AWTRIX Weather ⛈️ + Forecast +' blueprint is a lot of fun and works nicely! I appreciate the you included data for Europe / Celsius to show the graph in the correct colors. Thanks!
I also tried the 'UV Index & Humidity' blueprint. I don't have a WeatherFlow station, so I created a REST sensor to request the Hourly Forecast (UV index) data every 30 minutes from OpenWeatherMap through the One Call API 3.0. This is free for up to 1000 API calls per day. You can configure a limit of 1000 calls per day so there will be no charges.
The blueprint seems to expect a weather entity instead of a sensor for the hourly forecast. I tried to solve it by creating a weather template from the sensor. Unfortunately the weather template does not support a uv index attribute.
Therefor I changed the forecast selector entity domain from weather to sensor. Unfortunately the automation will still not run. Would you be willing to give this setup a try? Or do you have some suggestions how I could get this to work?
forecast:
selector:
entity:
domain:
- sensor
rest:
- scan_interval: 1800
resource: "https://api.openweathermap.org/data/3.0/onecall?lat=xxx&lon=yyy&exclude=current,minutely,daily,alerts&appid=zzz&units=metric"
timeout: 15
sensor:
- name: "OpenWeatherMap Hourly Forecast"
value_template: "OK"
json_attributes_path: "$.hourly[1]"
json_attributes:
- "dt"
- "temp"
- "feels_like"
- "pressure"
- "humidity"
- "dew_point"
- "uvi"
- "clouds"
- "visibility"
- "wind_speed"
- "wind_deg"
- "wind_gust"
- "weather"
- "pop"
hello i have the Openweathermap hourly via the integration there you can choose hourly function this works perfectly i have the humidity there as the uv index out works perfectly in this blueprint
Did you fix it then?
Hit me up on the discord ... easier to talk :)
So looking deeper I think I need to make a PR to Home Assistant to get the UV Index into the forecast... it seems to be supported in the OneCall API
Hit me up on the discord ... easier to talk :)
Hi Jeef, how do I find you on Discord? My username is: Johan de Jong#5310
I did not get it to work yet. The log file keeps generating the error below. Even though I did not select sensor.weatherflow_uv_index' in the template.
2023-06-15 15:14:20.406 ERROR (MainThread) [homeassistant.components.automation.ulanzi_uv_index] Error rendering variables: ValueError: Template error: round got invalid input 'unknown' when rendering template '{{states('sensor.weatherflow_uv_index') | round}}' but no default was specified
The OpenWeatherMap integration seems to retrieve a hourly Current 'Hourly UV Index' value. But not a 'Hourly UV Forecast Index' value as stated in the Blueprint about the 'Hourly UV Forecast':
- Note that Openweather does not seem to provide UV Index values
Therefor I created a REST sensor to request the Hourly Forecast (UV index) data every 30 minutes from OpenWeatherMap through the One Call API 3.0.
The Blueprint expects a weather entity for the forecast data. I have been unsuccessful in creating a (template) weather entity from the REST sensor data.
I will go ahead and throw away the Blueprint; and automation and try again from scratch.
I tried to configure the automation with the blueprint from scratch.
When I trace the automation and view the 'Automation Config' it includes these unexpected lines. I did not select any weatherflow entities.
uv: '{{states(''sensor.weatherflow_uv_index'') | round}}'
payload: >-
{% set hum = states('sensor.weatherflow_relative_humidity') %}
Want to add a comment here: https://github.com/home-assistant/architecture/discussions/924