Automation that sets heating and cooling depending on forecast

Surely this exists already right?

At (time), check the weather forecast. If the forecast is above X then turn on cooling, if the forecast is below Y then turn on heating.

Seems like simple logic but I can’t find a blueprint that does it. Could somebody point me in the right direction?

I’ve been thinking about this topic, and it appears to be pretty complex. Temperature and humidity changes have an immediate effect - depending on sunshine/cloudiness and on humidity, but also a delayed effect. The delay depends on insulation and mass (there’s some term for it). The heating system itself has a lag, depending on how it works and the mass of the building; compare massive concrete floor heating with direct air heating. The system is hard to create, and each building is unique, so generalizing is even harder. Then you might decide to turn on the sauna or the fireplace, or cook some food - further complicating the system. I would also like to base the target temperature on the electricity price for the coming hours.

I wonder if the characteristics of a building can be inferred from outside/inside temperature history and electricity consumption. All consumption contributes to heating. Cooling would flip this upside down.

I think you’re overcomplicating it.

All I want it to do is look at the day’s forecast temperature and either heat or cool.

Haha, that’s probably true, but in that case you are too :slight_smile: . You can look at current inside temperature and decide whether or not to heat or cool. If your heating system has enough power, it can react faster than weather ever changes. Anyway, in my case, the case for predictive heating is to spend electricity when it is cheaper, and avoid when it is more expensive. It changes by the hour. By looking forward, I could heat my home a little extra when the prediction is that more heating is necessary in the next few hours and the price will rise, and a little less when the price will drop and temperature forecast allows for it. However to do it properly, I must figure out at least the natural lag of my house. I already know the base consumption, which is about 1kW, which heats the house about 13 degrees over the outside temperature. The more granular one wants to get, the more aspects must be taken into account. If it was simple, we would have this figured out by someone else ages ago.

2 Likes

I’ve been thinking about doing this but with the fan. If the high outside is, say, 75 I dont need to circulate air to keep the different levels even but if its hotter I do.

If forecast is above x or below y temperature run HVAC fan for next z hours.

I appreciate you replying to my post but I still think you’re overcomplicating it.

I have rarely in my life experienced a case where the weather forecast in the morning was not pretty close to accurate for the day.

All I really want to do is have it poll the weather service for the max temperature predicted. If the max temperature is above a certain value, turn on cooling. If it’s below that temperature, turn on heating. The air conditioner units themselves regulate the temperature on their own.

In reality it is a complex system. I’ve been thinking of this and will probably take a stab at it - that’s why I’ve tried to get to the bottom of it and understand what’s going on. If the model (in my mind) doesn’t represent reality, I will fail without knowing why, or at least end up unsatisfied. I agree that a very simplistic system can reap the lowest hanging fruits, but the engineer in me wants to do it properly. It can still be represented to the user in a simple way.

Why exactly do you want a predictive system? Is it to have a more stable temperature inside?

I found this thread as I’m looking for something broadly similar (but not the same).
I haven’t found a blueprint that does this either. However, the automation to do this is relatively simple and would only take a few minutes to set-up.

My interpretation of the requirement is:
At time X, look at the forecast temperature.
If forecast temperature is > Y then turn off heating and turn on cooling
elseif forecast temperatuer is < Z then turn off cooing and turn on heating

Assuming the heater and cooler have their own thermostats then this will serve to control the room temperature. If there’s no thermostats then the room temperature will likely be very unstable due to over-cooling/heating.

It needs weather forecast data. Getting data from the OpenWeatherMaps integration is easy and will expose sensors with forecast data. Create a simple automation in the GUI to use the data and switch devices on/off.

@nilux I agree, getting the HVAC to provide “perfectly controlled” heating and cooling is very complex and unique to every room in a house. Thermal inertia, solar gain, wind chill, ambient temperatures, energy losses through roof & walls & floors & windows, heat transfer coefficients… etc. “should” all be taken into account. I am looking at this just now for storage heater control in my house. I envisage an “energy balance” approach where I calculate the gains/losses in the room and calculate the energy required to input to the storage heaters to balance the heat loss.
I need a predictive system as the storage heaters only charge up at certain times of night & day. If tomorrow is going to be warm and sunny then I don’t want the heaters to charge up unnecessarily tonight.
If anyone has any experience or links to share I’d be super grateful.

Here’s something that might be useful once it’s included in a stable version. It is for adjusting the heating as the outside temperature changes.

As every house is different and the heating and cooling systems are different, you need to know by yourself what kind of heating/ cooling output you need to keep acceptable temperature inside your house. That is why there prolly is no “blueprint” available.

I live in northen Europe, Finland, and I have in my area outside temp from +35 to
-35ºC. I’ve tinkered my own 2 story house heating/ cooling with two air heatpumps, many room temperature sensors and weather prediction to conserve energy with “predictive” automations. Conservation comes mainly on the times when the pumps do not actually need to heat/ cool.

I’ve also thought about writing a little tutorial about my prediction controlled system and some scientific studies behind predictive heat/ cool controlling in domestic housing. As it will take a bit of time to write the tutorial, you @WangDangler is the perfect person to ask: would that kind of tutorial help you go forward tinkering your own system? Or are/ were you just looking for ready made complex blueprint?

2 Likes

Hi
I"m seeking for a similar solution.

On one part I have the climate integration allowing to start, stop, set my airconditioning of Panasonic through the Panasonic Comfort Cloud.

Depending on the forecast, example tomorow it will be 27°C I would like to start my airco already in the early morning setting it to keep 22°C in the rooms.

So we can breakdown the problem to programming
IF (tomorrow > 25°C) THEN “start climate with some settings”

I did see this channel How to automate based on weather temperature forcast for current day? - #14 by Tom7320

I will give that a try, if I succeed I come back on this :slight_smile:

Since the forecast and the actual temperature at a given time of the day can be slightly off, I think that an external and an internal temperature sensor combined with a trend sensor could be more effective.

In my experience there’s no need for predictive heating based on weather forecast. It takes a while for outside changes to affect indoor air anyway, so heating simply based on current temperature is proactive enough. I have good insulation. However, an hourly electricity pricing would be a reason to heat/cool in advance - to reduce energy usage when price is high. That would work independent of weather forecast.

I started to think about this too, glad I found this thread, but sad to see no solution. I’d like to do as many people posting here say: at X time if temp tomorrow > Y do something.

The reason for this is because many smart heating systems begin heating the property to bring it to desired temperature by a set time. This is really nice to have. However if it’s going to be a warm day, it’s a waste of energy to heat up the house that the weather would have. A bonus here would be when the peak temperature is. Although most of the times peak is around noon which would be fine.

This does it with default Met.no, you can enable hourly forecast too in the entity:

{{ states.weather.home.attributes.forecast[0]['temperature'] }}

I’m going to set a helper to chose the temp at which to change at. It’d be good to know when Met.no makes updates to the forecast and trigger it at the time closest to around 3/4am which is the earliest time the predictive heating came on during the winter months.

This. Simple yet effective. The mere difference between direct sunlight and cloudy can change the temperature outside my patio by 10°C above forecast.

No weather forecast accounts for this and cloudcover forecast is rarely reliable for me.

In addition to this. I don’t know how one would forecast latent heat. I have patio stones outside the patio door. So if the sun beats on them for hours, they warm the incoming air far above ambient temps.

Likewise if a spot rain shower happens, the temp drops way below some weather station miles away where it can be sunny.

A trend sensor has been great in my experience. While most thermostats are on/off at a threshold. A trending up/down near that threshold allows me to prematurely turn on heating/cooling if so desired.

Had a stab at this:

# In configuration.yaml this gets the max temp of the day
sensor:
  - platform: template
      max_temp_today:
        value_template: >
          {% set tomorrow = (as_timestamp(now().date() + timedelta(days=1)) | timestamp_utc).replace(' ', 'T') ~ '+00:00' %}
          {% set today = state_attr('weather.home_hourly', 'forecast')| selectattr('datetime', 'lt', tomorrow) | map(attribute='temperature') | list %}
          {{ today | max }}
        unit_of_measurement: "°C"
        friendly_name: "Max Temp Today"

#Create a input_number helper called input_number.heating_off_temperature to set the temperature reference point and the below is the automation

- id: '1650223997365'
  alias: Set Heating Based on Weather
  description: ''
  trigger:
  - platform: state
    entity_id: input_number.heating_off_temperature
  - platform: state
    entity_id: sensor.max_temp_today
  condition: []
  action:
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ states.input_number.heating_off_temperature.state|float
          >= states.sensor.max_temp_today.state|float  }}'
      sequence:
      - service: climate.set_hvac_mode
        data:
          hvac_mode: auto
        target:
          device_id: 66a4489be4d12bd022c7f9e75262617a
      - device_id: 0675e7fd3964eee711b68abcdfb72d75
        domain: mobile_app
        type: notify
        message: Turned Heating on due to max temperature today
    - conditions:
      - condition: template
        value_template: '{{ states.input_number.heating_off_temperature.state|float
          < states.sensor.max_temp_today.state|float  }}'
      sequence:
      - service: climate.set_hvac_mode
        data:
          hvac_mode: 'off'
        target:
          device_id: 66a4489be4d12bd022c7f9e75262617a
      - device_id: 0675e7fd3964eee711b68abcdfb72d75
        domain: mobile_app
        type: notify
        message: Turned Heating off due to max temperature today
    default: []
  mode: single
1 Like