2024.4 Will lose my min/max temp sensors due to deprecation of forecast attribute

Currently I use two template sensors to display the forecasted minimum and maximum temperature on a couple of inkplate dashboards and my watch. As I understand the forecast attribute of the weather entity is going away.

How do I create entities to store mimimum and maximum temperatures? I cannot use the templates anymore as I can’t call a service from a template. I probably have te solve this using a script and input_numbers, but the response variable from a service wont hold a dictionary.

e.g. this won’t work:

alias:  Temp min and max
sequence:
  - service: weather.get_forecast
    target:
      entity_id: weather.myweather
    data:
      type: daily
    response_variable: forecast
  - service: input_number.set_value
    target: 
      entity_id: input_number.minimum_temperatuur
      value: “{{ forecast[0].templow|float|round(1) }}”
    data: {}
mode: single
icon: mdi:thermometer-lines

How to solve this?

It does hold a dictionary, and for get_forecast, the dictionary has one key in it called “forecast” with the value being a list of forecasts for different time periods. You can see by calling the service from the dev tools page.

So your script looks good to me, except you’d need to make one minor change to the template:

    value: "{{ forecast.forecast[0].templow|float|round(1) }}"

However, get_forecast is deprecated and you’ll want to use get_forecasts which puts the forecast key nested under the name of the weather entity. So after changing to that service, I think your template would be:

    value: "{{ forecast['weather.myweather'].forecast[0].templow|float|round(1) }}"

Thanks! This works.