Openweathermap forecasts not general daily forecast

Tags: #<Tag:0x00007fc40c3bd710>

When using the weather integration here:, the 5 day forecast gives the weather/temp for the current time plus 24, 48, etc hours. i.e. if I look at my dashboard at 10pm, I see the weather/temp at 10pm on each of the next 5 days. This is not what anyone would want from a forecast, and isn’t the norm for a forecast.

Can anyone tell me if this is all that is available with the free account? Is it a bug? IS there anything that can be done?

The background is that Im in the UK, and just want a sensible multi-day weather forecast on my dashboard (HomeHabit). There seems to be no supported source of weather forecast for the UK, which has more sensible forecast data.


I think you should check the OpenWeatherMap API documentation:

I believe the One Call API was introduced fairly recently. The HA Openweathermap integration does not use this API yet. That is being worked on as you can see here: Convert OpenweatherMap Integration to use "one-call-api"

In the meantime, you can use a REST call to query the One Call API. If you think the forecast in the One Call API better suits your needs, just let me know. I can post my configuration for that if you want it.

1 Like

Thanks for the reply. Will take a look.

I would very much like to see your REST configuration.

Thank you.

Thanks @Emphyrio. I fear as a HomeHabit user, the results of the rest call, probably in a rest sensor, wouldn’t be accessible as a weather forecast in HomeHabit at this point anyway :frowning: //cc @igorz

I think you are correct. Then you will probably have to wait for the One Call info to be put into a proper weather integration.

I wish there was a template weather available :upside_down_face:

1 Like

I just need 2 temperature items so here it goes, I hope it’s useful. If you need other items, just let me know and I’ll try to help out.

  - platform: rest
    name: openweather_report
    json_attributes_path: "$.daily[0]" # 0=today
      - temp
    value_template: "{{ value_json['current']['dt'] | timestamp_custom('%Y-%m-%d %H:%M', true) }}"
    scan_interval: 3600
  - platform: template
        value_template: "{{ states.sensor.openweather_report.attributes.temp.max }}"
        value_template: "{{ states.sensor.openweather_report.attributes.temp.night }}"

Thanks so much! I’m a novice and fighting my way thru things. I needed to see a real world configuration for some json formating and this helped very much in my learning.

thanks for that!
If I want to have a forecast, i have two option.

  1. generate a rest sensor for each day in the array. But that would mean I have seven rest request every 6 minutes
  2. I generate a rest request will like that
  - platform: rest
    name: openweather_report_all
      - daily
    value_template: "{{ value_json['current']['dt'] | timestamp_custom('%Y-%m-%d %H:%M', true) }}"
    scan_interval: 3600

With the last option, I just get every information in a string and can’t distinguish between the days.
Is there a way to get these informations into an proper array?

I’m a newbie at this JSON stuff too, but I wanted to learn :slight_smile:
This seems to work:

  - platform: rest
    name: openweather_report2
      - current
      - daily
    value_template: "{{ value_json['current']['dt'] | timestamp_custom('%Y-%m-%d %H:%M', true) }}"
    scan_interval: 3600
  - platform: template
        value_template: "{{ state_attr('sensor.openweather_report2', 'daily')[0] }}"
        value_template: "{{ state_attr('sensor.openweather_report2', 'daily')[0].temp.night }}"
        value_template: "{{ state_attr('sensor.openweather_report2', 'daily')[1] }}"
        value_template: "{{ state_attr('sensor.openweather_report2', 'daily')[1].temp.night }}"
1 Like

How would I use this to get the feels like and high low forecasts for a week? For weekly forecasts would I just increase the number 0 for today 1 for tomorrow 2 for the day after and so on?

Also do i need to include my api key anywhere?

You are correct: you can increase the number from 0 = today, 1 = tomorrow, 2 = the day after etc.
Feels-like for today would be:

"{{ state_attr('sensor.openweather_report2', 'daily')[0]}}"

Api key goes in the URL where it says: appid=xxxxxx

You can get more information also from the API docs.

Thank you. I will try this! Ive been wanting one call since dark sky got acquired!

It worked! Is there a way to show the unit type like F or % in the template?

Look for ‘unit_of_measurement’:

Thanks that worked. But now I am having an issue calling from current

        value_template: "{{ state_attr('sensor.openweather_report', 'current').current.temp }}"
        unit_of_measurement: "°F"
        value_template: "{{ state_attr('sensor.openweather_report', 'current') }}"
        value_template: "{{ state_attr('sensor.openweather_report', 'current') }}"   

EDIT: I am waiting on a restart but I think I got it. I dont think I was following the convention as closely as I could.

So you got it?

Yup. Thanks

Yeah I got a bunch of them working. The only ones I am having issues with is the item. No matter how I configure it, they wont return a value.

        value_template: "{{ state_attr('sensor.openweather_report', '')[0].description }}"
        value_template: "{{ state_attr('sensor.openweather_report', '')[1].description }}"
        value_template: "{{ state_attr('sensor.openweather_report', '')[2].description }}"
        value_template: "{{ state_attr('sensor.openweather_report', '')[3].description }}"
        value_template: "{{ state_attr('sensor.openweather_report', '')[4].description }}"

I’ve tried this several different ways. Clearly there is something I am missing.

  value_template: "{{ state_attr('sensor.openweather_report', 'daily')[0].weather.description }}"

I think, didn’t test this myself.

Edit: my method is to call the API from the SoapUI program. Then I get the full structured JSON message. This helps a lot to determine the correct JSON paths. Perhaps SoapUI is useful for you too :slight_smile: