Find out lowest predicted temperature for tonight?

I would like to achieve a “use some extra blankets tonight” indicator. Based on the expected lowest temperature for this night. I think the best indicator would be the forecasted temperature just before sunrise the next morning.

Anyone got some hints for this? Which weather forecast API / service could provide this information? I am located in the Netherlands.

For now, the best I could find was OpenWeatherMap ‘temp_tonight’. But this is the temperature at 00:00. So it’s not the lowest temperature of the coming night.

1 Like

Have a look to see if you can find an Integration that provides hourly forcasts for you area (e.g. Climacall or Meteorologisk institutt ( I live in the UK and the latter provides an entity that gives an hourly forcast in the Front End:


Presumably the temperature for the time you require could be extracted using a suitable template (note that there is a ‘templow’ attribute but I am unsure of what this actually is).

Something simillar could be done with the precipitation to notify if you need a raincoat for the following day.

It is going to require an interesting template… I will try!

Edit: the OpenWeatherMap hourly forecast contains the hourly temperatures for the next 48 hours. I was able to add it through the Integration page (not without a little struggle but so be it).

This template sensor does the job:

  - sensor:
    - name: temp_nextsunrise
      device_class: temperature
      icon: 'mdi:thermometer'
      unit_of_measurement: '°C'
      availability: >
        {{ not is_state('weather.openweathermap', 'unavailable') }}
      state: >
        {% set trise = as_timestamp(state_attr('sun.sun', 'next_rising')) | timestamp_custom('%H', true) | int %}
        {% set tnow = as_timestamp(now()) | timestamp_custom('%H', true) | int %}
        {% set hforecast = 24 - tnow + trise %}
        {{[hforecast].temperature }}

Thanks for your input!

1 Like

But actually, the temperature could be lower at a different time than at sunrise.
You could just loop over all the values and grab the lowest and the time that is and have that presented.

And I’m not sure your template is doing what you are expecting.

24 - 13 (currently 13:09)+ 7 (in my sun it says 7:00) = 18.
So you get the temperature at 18:00 tonight.

I believe I am getting the temperature at +18 hours in the future. So that’s about time of sunrise.

Doesn’t have to be very exact for this purpose “throw on an extra blanket” :grinning:

Posting for anyone else that might find this thread (I didn’t find much else on the topic that was newer).

I was able to tweak @Emphyrio 's template and loop it like @Hellis81 suggested.

state: >
  {% set trise = as_timestamp(state_attr('sun.sun', 'next_rising')) | as_datetime | as_local %}
  {{ (state_attr('weather.home_hourly', 'forecast') | selectattr('datetime', 'lt', trise.isoformat() )) | map(attribute='temperature') | list | min}}
1 Like

Hi all, I’m trying to do something not quite dissimilar :slight_smile:
We’re in the south-west US and pool-season is upon us. I have a sensor for pool water temperature which records ever 5 minutes. I keep a 14 day recorder trail.

Wifey asked if I could set up a sensor which could estimate when the pool water would be at it’s highest temperature today and tomorrow.

Based on the data I have available and what I’m seeing above, it seems possible?

I am not sure what is causing the pool water to heat, is this just sunshine?