Imagine your home anticipating a heatwave before it hits, automatically pre-cooling your living spaces during the cheapest energy hours and then coasting on thermal mass through the afternoon peak. Picture your HVAC system responding not just to indoor temperature, but to humidity, UV index, and even the “feels like” temperature outside. This isn’t futuristic fantasy—it’s the power of weather-based automation in Home Assistant, and it’s transforming how smart homes manage climate control.
Weather-based automations represent the next evolution beyond simple schedule-based or motion-triggered climate systems. By integrating real-time meteorological data, your home becomes predictive rather than reactive, optimizing for both comfort and energy efficiency in ways that were impossible just a few years ago. In this comprehensive guide, we’ll dive deep into creating intelligent, responsive climate systems that leverage weather intelligence to maximize comfort, minimize energy costs, and reduce your carbon footprint. You’ll walk away with downloadable YAML recipes you can customize, along with the expert knowledge to build your own sophisticated automations from scratch.
Why Weather Data is a Game-Changer for Smart Climate Control
Traditional smart thermostats operate in a vacuum, reacting only to indoor sensors and predetermined schedules. They don’t know that a cold front is moving in at 3 PM or that tomorrow’s UV index will turn your south-facing rooms into greenhouses. Weather-based automation bridges this information gap, creating a holistic control system that understands the relationship between your home’s thermal envelope and the external environment.
The real magic happens when you combine multiple weather parameters. Temperature alone is insufficient—humidity affects perceived comfort, wind speed influences heat loss, and solar radiation drives passive heating. By orchestrating these data points, you can implement strategies like predictive pre-cooling, dynamic setback scheduling, and intelligent window covering management that reduce HVAC runtime by 20-40% while improving occupant comfort. This approach transforms your climate control from a simple feedback loop into a forward-looking optimization engine.
Understanding the Core Components of Weather-Based Automations
Every weather-aware automation in Home Assistant rests on three foundational pillars: reliable data acquisition, intelligent condition evaluation, and precise device control. The data acquisition layer pulls information from weather services through integrations like OpenWeatherMap, AccuWeather, or the Norwegian Meteorological Institute. These services provide different data points—some offer minute-by-minute forecasts, others excel at hyper-local conditions.
The evaluation layer is where your automation logic lives. This involves template sensors that calculate derived values (like “feels like” temperature or cooling potential), binary sensors that trigger when conditions meet thresholds, and automation scripts that orchestrate responses. The control layer interfaces with your climate entities—thermostats, mini-splits, boilers, or even smart vents and window coverings. Understanding how these layers interact is crucial for building robust automations that fail gracefully when APIs go down or devices become unavailable.
Essential Weather Integrations for Home Assistant
Your automation is only as good as your data source. The built-in Meteorologisk institutt (Met.no) integration offers excellent free forecasts for most regions without API key requirements, making it ideal for beginners. For more granular data, OpenWeatherMap provides minute-by-minute precipitation forecasts, UV index, and “feels like” temperatures through its free tier, though you’ll need to monitor API call limits.
AccuWeather delivers detailed hourly forecasts and severe weather alerts but has stricter API limitations. For hyper-local conditions, consider WeatherFlow if you own a personal weather station, or Ambient Weather for integrating your own sensors. Each integration exposes different sensor entities—some provide temperature forecasts as strings (“partly cloudy”), others as numeric values. Always check the Developer Tools > States panel to understand exactly what data your chosen integration makes available before building automations around it.
YAML 101: Reading and Customizing Automation Recipes
YAML’s whitespace-sensitive structure intimidates many newcomers, but mastering a few key concepts unlocks unlimited customization potential. The alias field names your automation for the UI, while id provides a unique identifier. The trigger section defines what starts your automation—this could be a time pattern, state change, or numeric threshold crossing.
condition blocks act as gatekeepers, ensuring automations only fire when all criteria are met. This is where you’ll place most weather-related logic. The action section contains the actual commands—setting thermostat temperatures, adjusting covers, or sending notifications. Pay special attention to template syntax: {{ states('sensor.weather_temperature') | float(0) }} safely converts sensor states to numbers with a default fallback. Understanding these building blocks lets you modify any recipe to match your specific entities and comfort preferences.
Recipe 1: Dynamic Temperature Adjustments Based on “Feels Like” Temperature
Standard thermostats ignore humidity and wind, but your body doesn’t. This automation adjusts your indoor setpoint based on the apparent temperature rather than dry-bulb temperature, maintaining consistent comfort during muggy summers or windy winters.
The core logic creates a template sensor that calculates the difference between actual and “feels like” temperature, then applies an offset to your climate entity. During high humidity, you’ll maintain comfort at a higher dry temperature, saving cooling energy. In windy cold conditions, the system compensates by raising the heating setpoint automatically.
template:
- sensor:
- name: "Temperature Offset"
unique_id: temperature_offset_feels_like
unit_of_measurement: "°F"
state: >
{% set feels_like = states('sensor.openweathermap_feels_like_temperature') | float(0) %}
{% set actual = states('sensor.openweathermap_temperature') | float(0) %}
{{ ((feels_like - actual) * 0.5) | round(1) }}
automation:
- alias: "Adjust Thermostat for Feels Like Temperature"
id: feels_like_climate_adjust
trigger:
- platform: state
entity_id: sensor.temperature_offset
condition:
- condition: state
entity_id: climate.main_thermostat
state: "heat"
action:
- service: climate.set_temperature
target:
entity_id: climate.main_thermostat
data:
temperature: "{{ 72 + states('sensor.temperature_offset') | float(0) }}"
Recipe 2: Automated Window Blind Management for Passive Cooling
South-facing windows can add 2,000+ BTUs per hour during peak sun. This automation uses solar elevation, UV index, and outdoor temperature to deploy blinds as a first line of defense before your HVAC engages. The strategy prioritizes free cooling over mechanical cooling, dramatically reducing energy consumption.
The automation tracks the sun’s position and closes blinds when solar gain would overheat occupied rooms. It integrates with your climate system’s operation—if the AC is already running, it closes blinds more aggressively. An override input_boolean lets occupants manually control blinds without automation interference.
input_boolean:
blind_auto_override:
name: "Disable Blind Automation"
automation:
- alias: "Close Blinds During Peak Solar Gain"
id: solar_gain_blind_control
trigger:
- platform: numeric_state
entity_id: sensor.openweathermap_uv_index
above: 6
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
above: 45
condition:
- condition: numeric_state
entity_id: sensor.openweathermap_temperature
above: 75
- condition: state
entity_id: input_boolean.blind_auto_override
state: "off"
- condition: state
entity_id: binary_sensor.occupancy_living_room
state: "on"
action:
- service: cover.set_cover_position
target:
entity_id: cover.south_facing_blinds
data:
position: 30
Recipe 3: Smart HVAC Pre-Cooling and Pre-Heating Strategies
Time-of-use electricity rates can double during peak hours. This automation uses tomorrow’s temperature forecast to pre-cool your home during cheap overnight hours, storing “coolness” in your home’s thermal mass. The system calculates the optimal pre-cooling duration based on forecasted high temperature and your home’s thermal inertia.
The automation triggers at 10 PM, checking the next day’s forecast. If temperatures will exceed 85°F, it calculates a pre-cooling schedule: the hotter the forecast, the earlier and longer it runs. A temperature sensor inside a representative wall helps gauge thermal mass saturation, preventing over-cooling and wasted energy.
automation:
- alias: "Pre-Cool Based on Tomorrow's Forecast"
id: predictive_pre_cool
trigger:
- platform: time
at: "22:00:00"
condition:
- condition: numeric_state
entity_id: sensor.openweathermap_forecast_high
above: 85
action:
- variables:
forecast_high: "{{ states('sensor.openweathermap_forecast_high') | float(0) }}"
pre_cool_hours: "{{ ((forecast_high - 75) / 5) | round(0) }}"
- service: climate.set_temperature
target:
entity_id: climate.main_thermostat
data:
temperature: 68
- delay: "00:{{ '%02d' % (pre_cool_hours | int) }}:00"
- service: climate.set_temperature
target:
entity_id: climate.main_thermostat
data:
temperature: 78
Recipe 4: Humidity Control Using Forecast Data
Humidity management is often an afterthought, yet it dramatically impacts comfort and mold risk. This automation uses forecasted dew point and precipitation probability to proactively manage dehumidifiers and ventilation, preventing moisture issues before they start.
The system monitors outdoor absolute humidity and compares it to indoor levels. When incoming air would increase indoor humidity beyond 60% RH, it locks down ventilation and activates dehumidification. During dry winter days with low absolute humidity, it increases ventilation to naturally lower indoor humidity, saving dehumidifier energy.
template:
- sensor:
- name: "Outdoor Absolute Humidity"
unique_id: outdoor_abs_humidity
unit_of_measurement: "g/m³"
state: >
{% set temp = states('sensor.openweathermap_temperature') | float(0) %}
{% set rh = states('sensor.openweathermap_humidity') | float(0) %}
{{ (6.112 * 2.1674 * rh * 10 ** ((7.5 * temp) / (237.7 + temp))) | round(1) }}
automation:
- alias: "Manage Humidity Based on Weather"
id: humidity_weather_control
trigger:
- platform: numeric_state
entity_id: sensor.outdoor_absolute_humidity
above: 14
condition:
- condition: numeric_state
entity_id: sensor.indoor_humidity
above: 55
action:
- service: switch.turn_on
target:
entity_id: switch.bathroom_dehumidifier
- service: climate.set_hvac_mode
target:
entity_id: climate.erv_system
data:
hvac_mode: "off"
Recipe 5: Weather-Responsive Ventilation and Air Quality Management
Energy recovery ventilators (ERVs) and heat recovery ventilators (HRVs) run on fixed schedules, wasting energy during poor outdoor air quality or extreme temperatures. This automation integrates AQI, pollen count, and temperature differentials to ventilate only when beneficial.
The system checks multiple conditions: outdoor temperature must be within 15°F of indoor temperature for efficient heat exchange, AQI must be below 50, and pollen count must be low if occupants have allergies. During wildfire season, it automatically disables ventilation when smoke is detected, regardless of temperature, protecting indoor air quality.
automation:
- alias: "Smart ERV Control with Weather"
id: erv_weather_intelligence
trigger:
- platform: time_pattern
minutes: "/15"
condition:
- condition: numeric_state
entity_id: sensor.openweathermap_aqi
below: 50
- condition: template
value_template: "{{ (states('sensor.indoor_temperature') | float(0) - states('sensor.openweathermap_temperature') | float(0)) | abs < 15 }}"
- condition: numeric_state
entity_id: sensor.pollen_index
below: 4
action:
- service: climate.set_hvac_mode
target:
entity_id: climate.erv_system
data:
hvac_mode: "fan_only"
Recipe 6: Seasonal Mode Switching for Climate Systems
Manually switching between heating and cooling modes is tedious and error-prone. This automation uses forecasted temperatures over the next 48 hours to automatically set your HVAC system to the optimal mode, preventing the classic spring/fall problem of waking up to a cold house because the system stayed in cooling mode overnight.
The system calculates a weighted average of upcoming temperatures, giving more weight to daytime hours when comfort matters most. When the average exceeds 70°F, it switches to cooling; below 60°F, heating; and in between, it enables auto mode if available or sets a wider deadband to minimize system switching.
automation:
- alias: "Auto-Switch HVAC Seasonal Mode"
id: seasonal_mode_switch
trigger:
- platform: time
at: "06:00:00"
action:
- variables:
forecast_temps: "{{ state_attr('weather.openweathermap', 'forecast')[:12] | map(attribute='temperature') | list }}"
weighted_avg: "{{ (forecast_temps[:6] | sum * 1.5 + forecast_temps[6:] | sum) / (6 * 1.5 + 6) }}"
- choose:
- conditions:
- condition: template
value_template: "{{ weighted_avg > 70 }}"
sequence:
- service: climate.set_hvac_mode
target:
entity_id: climate.main_thermostat
data:
hvac_mode: "cool"
- conditions:
- condition: template
value_template: "{{ weighted_avg < 60 }}"
sequence:
- service: climate.set_hvac_mode
target:
entity_id: climate.main_thermostat
data:
hvac_mode: "heat"
Recipe 7: Storm Preparation and Severe Weather Automations
Severe weather can threaten your home’s climate control infrastructure. This automation prepares your system for incoming storms by adjusting setpoints, securing outdoor units, and notifying you of potential risks. It monitors the weather entity’s forecast attribute for condition strings containing “thunderstorm,” “hail,” or “severe.”
When triggered, it raises cooling setpoints by 2°F to reduce compressor load during power fluctuations, closes all smart windows and vents, and sends actionable notifications. If you have a whole-house generator, it can preemptively switch to generator power before the storm hits to protect against damaging power spikes.
automation:
- alias: "Storm Preparation Protocol"
id: storm_preparation
trigger:
- platform: template
value_template: "{{ 'thunderstorm' in (state_attr('weather.home', 'forecast')[0]['condition'] | default('')).lower() }}"
condition:
- condition: state
entity_id: binary_sensor.away_mode
state: "off"
action:
- service: climate.set_temperature
target:
entity_id: climate.main_thermostat
data:
temperature: "{{ states('climate.main_thermostat') | float(0) + 2 }}"
- service: cover.close_cover
target:
entity_id: cover.all_exterior_covers
- service: notify.mobile_app
data:
message: "Storm detected. Climate system secured and setpoints adjusted."
Recipe 8: Energy-Saving Temperature Setbacks During Optimal Conditions
Some days are perfect for open windows and natural ventilation. This automation identifies these opportunities by monitoring outdoor temperature, humidity, and wind speed, then aggressively sets back your HVAC system while prompting you to open windows. It calculates an “open window score” that considers multiple comfort factors.
The system only suggests setbacks when conditions will remain optimal for at least three hours, preventing short cycling between mechanical and natural cooling. It integrates with window sensors to confirm windows are actually open before fully disabling HVAC, and automatically resumes climate control if conditions deteriorate or windows remain closed after 15 minutes.
template:
- sensor:
- name: "Open Window Opportunity Score"
unique_id: window_opportunity_score
state: >
{% set temp = states('sensor.openweathermap_temperature') | float(0) %}
{% set humidity = states('sensor.openweathermap_humidity') | float(0) %}
{% set wind = states('sensor.openweathermap_wind_speed') | float(0) %}
{% set temp_score = 10 - (temp - 72) | abs %}
{% set humidity_score = 10 - (humidity - 45) | abs %}
{% set wind_score = wind * 2 %}
{{ (temp_score + humidity_score + wind_score) | round(0) }}
automation:
- alias: "Natural Ventilation Opportunity Alert"
id: natural_ventilation_opportunity
trigger:
- platform: numeric_state
entity_id: sensor.open_window_opportunity_score
above: 20
for: "00:15:00"
action:
- service: climate.set_temperature
target:
entity_id: climate.main_thermostat
data:
temperature: 85
- service: notify.mobile_app
data:
message: "Perfect weather for open windows! HVAC set back to save energy."
Recipe 9: Multi-Zone Climate Coordination with Microclimate Data
Single-zone thermostats treat your home as one uniform space, ignoring that upstairs rooms gain heat while basements stay cool. This automation uses outdoor conditions to predict which zones need attention, preemptively adjusting dampers or mini-split setpoints before temperature imbalances occur.
The system tracks solar azimuth to predict which side of your house will receive sun, adjusts north and south zones differently, and uses forecasted overnight lows to determine if morning warm-up is needed. It creates a “thermal load prediction” sensor that informs your zone controller, enabling proactive rather than reactive balancing.
template:
- sensor:
- name: "South Zone Solar Load"
unique_id: south_zone_solar_load
state: >
{% set solar_azi = state_attr('sun.sun', 'azimuth') | float(0) %}
{% set solar_elev = state_attr('sun.sun', 'elevation') | float(0) %}
{% set cloud_cover = states('sensor.openweathermap_cloud_coverage') | float(0) %}
{% if 90 < solar_azi < 270 and solar_elev > 20 %}
{{ (solar_elev * (100 - cloud_cover) / 100) | round(0) }}
{% else %}
0
{% endif %}
automation:
- alias: "Pre-Cool South Zone Before Solar Gain"
id: south_zone_solar_prevention
trigger:
- platform: numeric_state
entity_id: sensor.south_zone_solar_load
above: 30
condition:
- condition: time
after: "09:00:00"
before: "17:00:00"
action:
- service: climate.set_temperature
target:
entity_id: climate.south_zone_mini_split
data:
temperature: "{{ states('climate.south_zone_mini_split') | float(0) - 2 }}"
Recipe 10: Vacation Mode Enhanced with Weather Intelligence
Standard vacation modes maintain a fixed setback temperature, wasting energy when outdoor conditions are favorable. This enhanced version monitors forecasted temperatures and dynamically adjusts your away setpoints, saving up to 30% more energy during mild weather while ensuring your home never drops below freeze protection or overheats.
The automation calculates daily heating/cooling degree days from the forecast and adjusts setback depth accordingly. During a mild spring week, it might allow indoor temperatures to drift to 65°F (heating) or 80°F (cooling). During a polar vortex, it maintains a minimum of 55°F to protect pipes while still saving energy compared to occupied settings.
automation:
- alias: "Dynamic Vacation Setback"
id: dynamic_vacation_setback
trigger:
- platform: time
at: "00:00:00"
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: "on"
action:
- variables:
forecast_low: "{{ state_attr('weather.home', 'forecast')[0]['temperature'] | float(0) }}"
forecast_high: "{{ state_attr('weather.home', 'forecast')[0]['templow'] | float(0) }}"
heating_setback: "{{ 55 if forecast_low < 20 else 60 if forecast_low < 40 else 65 }}"
cooling_setback: "{{ 85 if forecast_high < 90 else 80 if forecast_high < 95 else 78 }}"
- service: climate.set_temperature
target:
entity_id: climate.main_thermostat
data:
temperature: "{{ heating_setback if forecast_low < 60 else cooling_setback }}"
Troubleshooting Common Weather-Based Automation Issues
Weather automations can fail silently when APIs change or rate limits are exceeded. The most frequent issue is template errors causing automations to never trigger. Always use the | float(0) or | int(0) filters to provide defaults when sensor data is unavailable. Check the Logs > Home Assistant Core section for template rendering errors.
Another common problem is automations firing too frequently due to sensor jitter. Add for: conditions to triggers to ensure conditions persist for several minutes before acting. For API rate limits, use scan_interval in your integration configuration to reduce update frequency, and consider using throttle in your automations. If your weather service goes down, create fallback automations that revert to time-based control using the availability_template condition to detect offline sensors.
Advanced Customization: Combining Multiple Weather Conditions
Real-world comfort depends on synergistic conditions, not single metrics. This section explores building composite sensors that weight multiple factors. Create a “Comfort Index” that combines temperature, humidity, wind, and solar radiation into a single 0-100 score, then build automations that respond to this holistic metric rather than juggling multiple conditions.
Use template sensors with weighted coefficients: temperature might contribute 40%, humidity 30%, wind 20%, and solar 10%. Adjust these weights based on your climate zone and personal preferences. The resulting sensor simplifies automation logic and provides a single, intuitive metric for dashboards. You can even expose this custom sensor to voice assistants, asking “What’s today’s comfort score?” to get a natural language summary of outdoor conditions.
Security and Privacy Considerations for Weather Integrations
Every external API call exposes your IP address and location data. Free weather services often have vague privacy policies, and some sell aggregated location data. Consider using a local personal weather station if privacy is paramount—integrations like WeatherFlow keep all data on your local network. For cloud services, review their data retention policies and consider using a VPN for API calls.
Never include API keys directly in YAML files if you share configurations. Use Home Assistant’s built-in secrets management: store keys in secrets.yaml and reference them with !secret openweathermap_api_key. Be cautious with location precision—most integrations only need city-level coordinates, so don’t provide your exact home GPS location. For enterprise-level privacy, run your weather automation through a separate, isolated Home Assistant instance that only handles climate control.
Performance Optimization: Reducing API Calls and System Load
Aggressive polling can exhaust free API tiers and slow down your Home Assistant instance. Use scan_interval: 600 (10 minutes) for most weather integrations, as conditions don’t change faster than that. For forecast data, poll once per hour since forecasts update infrequently. Implement a throttle wrapper in template sensors to prevent recalculation on every state change.
Create a single “weather summary” template sensor that consolidates multiple data points, then have your automations trigger from this consolidated sensor rather than individual weather entities. This reduces template processing overhead. Use mode: queued or mode: restart in automations to prevent race conditions when multiple triggers fire simultaneously. For large installations, consider running weather data collection on a separate Raspberry Pi that publishes to your main instance via MQTT, isolating the API load from your primary automation engine.
Frequently Asked Questions
1. How accurate do weather forecasts need to be for effective automation?
Forecasts don’t need perfect accuracy to provide value. Even 80% accurate predictions enable significant energy savings through predictive pre-cooling and setback optimization. Focus on trends rather than exact numbers—knowing it will be “hotter than today” is often sufficient. Use current conditions as a reality check: if forecasted high is 90°F but it’s already 85°F at 10 AM, your automation should adjust accordingly.
2. Can I use weather automation without a paid API key?
Absolutely. The built-in Met.no integration provides excellent free forecasts globally without API keys. For US users, the National Weather Service integration is also free. These services work perfectly for most automations, though they may lack minute-by-minute precipitation forecasts. The free tier of OpenWeatherMap (60 calls/minute) is sufficient for typical home use if you optimize polling intervals.
3. What happens if my internet goes down?
Weather automations will stop receiving updates, but you can build resilience. Create fallback automations that trigger when weather sensors become unavailable for 30+ minutes, reverting to time-based schedules or indoor sensor-only control. Use the availability_template condition to detect offline sensors: {{ states('sensor.weather_temperature') not in ['unknown', 'unavailable'] }}. Consider a local weather station as backup for critical functions like freeze protection.
4. How do I handle microclimates around my property?
Your weather integration reports regional conditions, but your home experiences unique microclimates. Install temperature/humidity sensors in key locations (north side, south side, under trees) and use template sensors to create weighted averages. For example: south_side_temp * 0.6 + regional_temp * 0.4 for south-facing room automations. This hybrid approach combines accurate regional forecasts with hyper-local real-time corrections.
5. Will weather automations work with any smart thermostat?
Most integrations work with any thermostat Home Assistant can control, but effectiveness varies. Wi-Fi thermostats with local API access (like Ecobee or Honeywell Lyric) respond faster and more reliably than cloud-dependent devices. For basic on/off control of mini-splits or boilers, smart switches work fine. The key is ensuring your climate entity supports set_temperature and set_hvac_mode services, which most do.
6. How much energy can I realistically save?
Savings depend on your climate, home efficiency, and current automation level. Users typically see 15-30% reductions in HVAC runtime through predictive strategies. Pre-cooling during off-peak rates can cut electricity costs by 40% even if total consumption stays similar. The biggest gains come from preventing unnecessary heating/cooling during mild weather and using free solar gain or natural ventilation when conditions permit.
7. Can I integrate personal weather station data?
Yes, and it’s highly recommended for precision. Integrations like WeatherFlow, Ambient Weather, or a custom MQTT setup feed local sensor data directly into Home Assistant. This eliminates API calls, provides real-time updates every few seconds, and captures microclimates. The trade-off is hardware cost ($150-300) and maintenance. For ultimate reliability, combine personal station data for current conditions with free API forecasts for prediction.
8. How do I prevent automations from conflicting with each other?
Use mode: single to prevent concurrent runs of the same automation. For inter-automation conflicts, create input_select helpers that track system state: climate_mode: normal | pre_cool | storm | vacation. Have each automation check this state before firing and update it as part of their actions. This creates a simple state machine that prevents race conditions and ensures only one high-level climate strategy runs at a time.
9. What’s the best way to test weather automations?
Use Home Assistant’s Developer Tools > States to manually set weather sensor values and observe automation responses. For time-based triggers, change your system clock temporarily (in a test environment). Create input_datetime helpers to simulate forecast data without making actual API calls. Always test failure modes: set sensors to unavailable and verify fallbacks activate. Use the automation trace feature to step through execution and identify logic errors.
10. How do I balance comfort vs. energy savings?
Start conservatively: implement 1-2°F setbacks during mild weather, then gradually increase based on occupant feedback. Create input_number sliders for “aggressiveness” that multiply your offsets—start at 0.5 for gentle adjustments, increase to 1.0 for maximum savings. Use presence detection to enable aggressive setbacks only when unoccupied. The sweet spot is typically 80% of maximum possible savings while maintaining 95% of comfort—found through iterative tuning over 2-3 weeks.