Weather forecast sensor based on specific time

I am using the Met.no integration for weather forecast and I already made a sensor for the temperature for tomorrow or the day after tomorrow:

- platform: template
    sensors:
      current_temperature:
        friendly_name: "current temperature"
        unit_of_measurement: 'C'
        value_template: "{{ state_attr('weather.home', 'temperature') }}"

but now I want to create a sensor for tomorrow’s temperature at a specific time, like 5:00h in the morning. I cannot find any documentation how to query Met.no with a specific time. Any suggestions?

is a bit more complex, I am assuming your sensor has a section ‘forecast’ with hourly value

{% set x = state_attr('weather.home','forecast')  | count %}
{% set pd = state_attr('weather.home','forecast') %}
{% for i in range(0,x) %}
{% if as_local(as_datetime(pd[i].datetime)) == now().replace(hour=5, minute=00, second=0, microsecond=0) + timedelta(days=1) %}
{{ pd[i].temperature }}
{% endif %}
{% endfor %}
3 Likes

Thanks! I will try this next weekend, for hourly weather I have to use weather.home_hourly

It took a while but it’s working! Thanks again!

Clearly :slight_smile: then please mark my post for ‘solution’ to it can be seen by others searching for similar…thx

Unfortunately this solution does not work anymore since the service weather.get_forecasts was introduced. The template editor gives me:

TypeError: object of type 'NoneType' has no len()

I found this, but don’t know how to get it working again: