Automation action based on weather forecast

Hi all,
I want to automate my golf heat system. I have installed a motor valve that controls the heat that goes into the floor heating system. In general that is fair enough without the need to control each single heat circle. The motor valve is controlled by a Shelly2.5 in Roller shutter mode.
I have created a custom sensor that pulls the temperature forecast into HA. E.g. I have one for 6h and another one for 12H as a side note.
Now want I want do is:
If temperature forecast is between -10 and -5 bring Shelly2.5 in position x
If temperature forecast is between -5 and -0 bring Shelly2.5 in position y
and so on…
I am looking for assistance to do the “action” part of that automation as the trigger is time (run every 6h).
Any help is much appreciated. And let me know if you need any additional information.

Try something like this:

  - choose:
      - conditions:
          - "{{ -10 < states('sensor.temperature_forecast') | int < -5 }}"
          - service: ....
      - conditions:
          - "{{ -5 < states('sensor.temperature_forecast') | int < 0 }}"
          - service: ....

Thanks for the reply!
Didn´t know about the “Choose” possibility. Really great. Could I also use “<=” or what would be the correct way to make sure the edge cases like “-5” do not fall between the sheets?

Yes, you can.

1 Like

That’s awesome guys.
Thanks for this thread.

How to access the HA built-in forecast values then?

Is this even possible?

To my knowledge, the Weather data come from an integration. I use AccuWeather and OpenWeatherMap, but others are also available depending on your country.

You should be able to do something like:


This should give you the temperature forecast for tomorrow. For the day after you do:


This works as long as we can assume that the first entry (0) in the forecast object is tomorrow and 1 is the day after and so on.

Great - thank you, Alexander.
I will try that :smiley:

This works in a telegram message:

message: "Achtung! Es wird morgen kalt: {{}}"

How to use this in an if-then check?
This does not work:

condition: numeric_state
entity_id: weather.openweathermap
attribute: forecast.3.templow
below: 0

Never mind - I got it:

  - condition: template
    value_template: >-
      {{ state_attr('weather.openweathermap','forecast')[3].templow <= 0 }}