Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'UV Index & Humidity' with Hourly Forecast from OpenWeatherMap through the One Call API 3.0 #3

Open
johan-de-jong opened this issue Jun 10, 2023 · 8 comments

Comments

@johan-de-jong
Copy link

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"
@jrspowers
Copy link

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

@jrspowers
Copy link

image

@jeeftor
Copy link
Owner

jeeftor commented Jun 14, 2023

Did you fix it then?

@jeeftor
Copy link
Owner

jeeftor commented Jun 14, 2023

Hit me up on the discord ... easier to talk :)

@jeeftor
Copy link
Owner

jeeftor commented Jun 14, 2023

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

@johan-de-jong
Copy link
Author

johan-de-jong commented Jun 15, 2023

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.

@johan-de-jong
Copy link
Author

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') %}
    

@jeeftor
Copy link
Owner

jeeftor commented Jun 15, 2023

Want to add a comment here: home-assistant/architecture#924

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants