OpenWeatherMap version 3.0

I just did a direct API call, and the word “forecast” does not appear anywhere in the resulting JSON.

Time to abandon OpenWeatherMap I think……

I personally don’t have any issues with the forecast entities, they’re all working fine, but I do see weird behaviour on the temperature entity:

No idea if that’s related to 3.0, or my location, or the HA integration? It was like this on both 2024.6 and 2024.7, and using different api keys (in case that made a difference, which it did not).

Forecast sensors where specifically implemented in the OWM integration. When the whole get_forecasts shenanigans started (main reason being reduction of state size that is transferred to the frontend), someone also deemed these forecast-sensors to be obsolete (which they 100% are not in my opinion).

Long story short after an hour or two I came up with template sensors that basically are a super complicated custom way of recreating the nice default sensors from before. I only need two (min and max temp forecast), so I only added these two template sensors to my yaml:

template:
  - trigger:
      - platform: time_pattern
        minutes: /15
      - platform: homeassistant
        event: start
      - platform: event
        event_type: event_template_reloaded
    action:
      - service: weather.get_forecasts
        target:
          entity_id: weather.openweathermap
        data:
          type: daily
        response_variable: forecast_result
      - variables:
          forecast_today: "{{ forecast_result['weather.openweathermap'].forecast[0] }}"
    sensor:
      - name: Openweathermap Forecast Temperature
        unique_id: openweathermap_forecast_temperature
        state: "{{ forecast_today.temperature }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"
        icon: mdi:thermometer
        unit_of_measurement: "°C"
        device_class: temperature

      - name: Openweathermap Forecast Temperature Low
        unique_id: openweathermap_forecast_temperature_low
        state: "{{ forecast_today.templow }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"
        icon: mdi:thermometer
        unit_of_measurement: "°C"
        device_class: temperature

weather.openweathermap is the entity id of my OWM weather entity and needs to be replaced with whatever yours is.

As you can see removing those obsolete sensors and replacing them with dozens of lines of yaml code is super easy, barely an inconvenience… :unamused:

1 Like

Thanks @chammp - my sensor was very similar (and it didn’t work) so I’ll make the changes you suggest and try again.

Can you elaborate on what you mean by “my OWM weather entity” - not sure where that name is specified (outside this template)

It’s the entity_id of the open weather map entity that is created by the open weather map integration. Left is the weather entity in the dashboard, right is the config view of that entity where you get the entity id.

Thanks @chammp - your suggested template seems to work. Thank you for creating it!

I added some more (wind, uv etc ) →

      - platform: time_pattern
        minutes: /15
      - platform: homeassistant
        event: start
      - platform: event
        event_type: event_template_reloaded
     action:
      - service: weather.get_forecasts
        target:
          entity_id: weather.openweathermap
        data:
          type: daily
        response_variable: forecast_result
      - variables:
          forecast_today: "{{ forecast_result['weather.openweathermap'].forecast[0] }}"
     sensor:
      - name: Openweathermap Forecast Temperature
        unique_id: openweathermap_forecast_temperature
        state: "{{ forecast_today.temperature }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"
        icon: mdi:thermometer
        unit_of_measurement: "°C"
        device_class: temperature

      - name: Openweathermap Forecast Temperature Low
        unique_id: openweathermap_forecast_temperature_low
        state: "{{ forecast_today.templow }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"
        icon: mdi:thermometer
        unit_of_measurement: "°C"
        device_class: temperature

      - name: Openweathermap Forecast Condition
        unique_id: openweathermap_forecast_condition
        state: "{{ forecast_today.condition }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"

      - name: Openweathermap Forecast Cloud Coverage
        unique_id: openweathermap_forecast_cloud_coverage
        state: "{{ forecast_today.cloud_coverage }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"
        unit_of_measurement: "%"  

      - name: Openweathermap Forecast Wind Speed
        unique_id: openweathermap_forecast_wind_speed
        state: "{{ forecast_today.wind_speed }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"
        icon: mdi:weather-windy
        unit_of_measurement: "km/h"
        device_class: wind_speed        
      
      - name: Openweathermap Forecast Wind Bearing
        unique_id: openweathermap_forecast_wind_bearing
        state: "{{ forecast_today.wind_bearing }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"

      - name: Openweathermap Forecast UV Index
        unique_id: openweathermap_forecast_uv_index
        state: "{{ forecast_today.uv_index }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"

      - name: Openweathermap Forecast Precipitation Probability
        unique_id: openweathermap_forecast_precipitation_probability
        state: "{{ forecast_today.precipitation_probability }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"

      - name: Openweathermap Forecast Precipitation
        unique_id: openweathermap_forecast_precipitation
        state: "{{ forecast_today.precipitation }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"  
        icon: mdi:weather-pouring
        unit_of_measurement: "mm"
        device_class: precipitation

      - name: Openweathermap Forecast Humidity
        unique_id: openweathermap_forecast_humidity
        state: "{{ forecast_today.humidity }}"
        attributes:
          timestamp: "{{ forecast_today.datetime }}"  
        icon: mdi:weather-fog
        unit_of_measurement: "%"
        device_class: humidity
1 Like

Hello,

I have already subscribed to the API v3, but it is still not working. When I try to make the API call, I get the following error:

{"cod":401, "message": "Please note that using One Call 3.0 requires a separate subscription to the One Call by Call plan. Learn more here https://openweathermap.org/price. If you have a valid subscription to the One Call by Call plan, but still receive this error, then please see https://openweathermap.org/faq#error401 for more info."}

How long does it take to become available?