Agricultural patterns · Home Assistant

Weather Data.

Reading time
~10 min · 2,049 words
Section
All Home Assistant pages

Weather data drives many agricultural automations. Frost warnings pause irrigation. Rain forecasts skip scheduled watering. High winds restrict overhead spraying. Heat index alerts trigger additional ventilation. A Home Assistant deployment that knows tomorrow's weather can make better decisions than one that only reacts to current indoor conditions. The sources run from free government weather services and commercial APIs with free tiers to a personal weather station reporting directly to the operation's own Home Assistant. The right weather source depends on location, accuracy requirements, and whether the operation wants hyperlocal data that only an on-site weather station provides.

Weather service options.

Several categories of weather data source are relevant.

Government weather services.

Free. Funded by taxpayers. Available through specific APIs and integrations.

  • National Weather Service (US). Free API covering the United States. Integration via Home Assistant's NWS integration. Point-forecast resolution for specific locations. Good accuracy for the continental US. No API key required.
  • Met.no (Norway). Free global weather service. Used by many apps and services. High-quality forecasts. Integration via Home Assistant's Met.no integration. No API key required. Rate limits apply for high-volume use.
  • Environment Canada. Canadian equivalent, free API.
  • UK Met Office. UK service with both free and paid tiers.

These services are reliable, free, and appropriate for most agricultural needs. The Home Assistant integrations are mature and well-maintained.

Commercial weather services with free tiers.

  • OpenWeatherMap. Global coverage, free tier with reasonable limits, paid tiers for higher-volume use. Widely used. Integration via Home Assistant's OpenWeatherMap integration. Requires a free API key.
  • AccuWeather. Free tier available; commercial tiers for more features. Home Assistant integration available.
  • Tomorrow.io (formerly Climacell). Commercial service with agricultural-specific features. Free tier limited; paid tiers for serious use. Home Assistant integration available.
  • Visual Crossing Weather. Historical and forecast data. Paid-focused with free tier for small deployments.

Commercial services often provide more detailed forecasts, agricultural-specific parameters, and more frequent updates than free government services. Whether the improvements justify the cost depends on the operation.

Personal weather stations.

On-site weather stations provide hyperlocal data that no remote service matches. Typical parameters: temperature, humidity, wind speed and direction, precipitation, barometric pressure, solar radiation, UV index. Some stations add soil moisture and temperature, leaf wetness, specific agricultural sensors.

Options:

  • Davis Instruments Vantage Pro2 / Vantage Vue. Professional-grade, $350-800. Long-established, accurate, integrates with Home Assistant through WeatherLink or the locally-running weewx service.
  • Ecowitt (GW1100, GW2000, and sensor arrays). $100-400 for various configurations. Consumer to prosumer pricing with decent accuracy. Native Home Assistant integration.
  • Ambient Weather. $100-500 for various stations. Cloud-based with Home Assistant integration.
  • WeatherFlow Tempest. Solid-state weather station with cellular or Wi-Fi backhaul. $300-400. Clean integration with Home Assistant.
  • DIY stations. ESPHome-based weather stations built from individual sensors. Most flexible, most work.

Personal stations provide current conditions at the specific location, which is particularly valuable for:

  • Accurate frost detection (temperatures vary by tens of degrees across a farm)
  • Actual rainfall at the operation (forecasts predict; rain gauges measure)
  • Wind at the application height (wind at the weather-station reporting site differs from wind at the spray boom or at the greenhouse vents)

For operations with specific microclimates or requirements for actual-conditions data, a personal weather station is often the right addition.

Hybrid approach.

Most operations use both: a government or commercial forecast service for forward-looking data, plus a personal station for current on-site conditions. The two complement each other rather than compete.

Weather data entities in Home Assistant.

Weather integrations create entities with specific data.

Current conditions entity.

A single entity representing current weather (typically named like weather.home or weather.openweathermap). Shows current temperature, humidity, pressure, wind, and overall condition (sunny, cloudy, rain). The condition is categorical; specific numeric values are in attributes.

Forecast entities.

Hourly and daily forecast data, retrieved on demand from the weather entity with the weather.get_forecasts action; current Home Assistant no longer exposes forecasts as entity attributes. Forecasts include predicted temperature ranges, precipitation probability, wind forecasts, and condition descriptions.

Individual sensor entities (for some integrations).

Some integrations expose individual sensors in addition to or instead of the composite weather entity. sensor.temperature_outdoor, sensor.humidity_outdoor, sensor.wind_speed, sensor.rain_last_hour, and so on. These are easier to reference in automations than extracting values from the composite weather entity.

Personal weather station entities.

Personal stations typically expose each sensor as its own entity. Direct access to rain gauge readings, solar radiation measurements, and so forth.

Agricultural applications.

Specific uses of weather data in agricultural automations.

Irrigation skip on rain.

Scheduled irrigation skips when significant rain is forecast or occurring. The threshold depends on crop and substrate: 0.25" for indoor supplemental, higher amounts for outdoor field.

Logic: an automation's condition checks whether rain in the last 24 hours or forecast rain in the next 6 hours exceeds a threshold; if so, skip the cycle.

Freeze protection.

Overnight low below a threshold triggers freeze-protection automations: turn off irrigation (to prevent line freezing), turn on freeze-protection heating, send alerts.

Logic: a sensor or attribute showing predicted overnight low drops below 35°F (typical threshold); automations activate protective responses.

Heat advisories.

High temperatures forecast or occurring trigger cooling responses: increased ventilation, activation of shading, increased irrigation frequency.

Logic: predicted high above 95°F triggers additional ventilation schedule; actual temperature above 100°F triggers emergency response.

Wind restrictions.

High wind disrupts overhead irrigation (water drift wastes supply) and spraying (drift reduces efficacy and creates environmental concerns). Wind speed thresholds suspend these operations.

Logic: current wind speed above 10-15 mph pauses overhead irrigation; above specific thresholds pauses all spraying. Thresholds depend on equipment and what's being applied.

DLI forecasting.

Expected daylight for supplemental lighting decisions. A forecast of sunny weather means less supplemental lighting needed; cloudy forecast means more.

Logic: a template sensor calculates expected DLI based on forecast cloud cover; supplemental lighting adjusts.

Frost point warning.

Dew point combined with current temperature trend predicts when frost will form. Early warning allows protective action before ice damage occurs.

Storm warnings.

Severe weather alerts from government services (tornado, severe thunderstorm, hail) trigger specific protections: close vents, bring in portable equipment, notify the grower to take action.

Growing degree days.

Running sum of daily temperature exposure above a base temperature, used for phenology predictions (when specific plants or pests will reach specific life stages). Template sensors can calculate GDD from daily temperature data.

Pest and disease models.

Specific agricultural models predict disease or pest pressure based on weather conditions. Apple scab, grape downy mildew, and many other diseases have well-characterized weather-condition models. For operations with access to the model parameters, weather data feeds these calculations.

Using weather data in automations.

Patterns for weather-based automation logic.

State-based conditions.

Current weather state can be a condition on automations. state_attr('weather.home', 'temperature') > 85 triggers heat response. weather.home state of "rainy" triggers rain response.

Forecast-based conditions.

Forecast data is fetched from the weather entity on demand rather than read from attributes. Accessing forecast temperature for the next 24 hours, or precipitation probability, means calling the forecast service and parsing the response with template expressions.

Home Assistant's weather.get_forecasts service returns the forecast data that automations can parse. The exact structure varies by integration.

Threshold-based triggers.

Automations trigger when weather parameters cross specific thresholds. Outdoor temperature below 35°F triggers freeze protection. Wind speed above 15 mph pauses irrigation.

Time-of-day combined.

Weather conditions combined with time or sun position. "Cloudy AND during photoperiod" triggers supplemental lighting. "Cold AND nighttime" triggers heating.

Aggregate triggers.

Accumulated rainfall over the last 24 hours, or expected in the next 48 hours. Aggregate weather conditions drive decisions that single snapshots don't capture.

Personal weather station setup.

Specific considerations for on-site weather stations.

Placement.

Siting matters substantially. Standard practice:

  • Thermometer/hygrometer in a white radiation shield, 5-6 feet above the ground, away from buildings and concrete (which hold heat).
  • Rain gauge in an open area away from obstructions, at least two tree heights away from tall trees.
  • Anemometer (wind) at least 30 feet up and 30 feet clear of obstructions. This is often impractical for home installations, and wind readings from roof-mounted stations are typically lower-bound.
  • Solar radiation sensor with unobstructed view of the sun's path.

Compromised placement produces compromised data. A weather station in a bad location reports different conditions from what's actually happening; agriculture decisions based on it are similarly compromised.

Integration methods.

Vendor cloud. Most commercial stations report to the vendor's cloud service; Home Assistant integration pulls data from there. Requires internet; adds cloud dependency.

Local protocol. Some stations (Ecowitt, specific Davis configurations) support local protocols. Home Assistant can read directly without cloud. Preferred for operations wanting local-only operation.

MQTT bridge. Some integrations use a bridge tool (weewx, specific MQTT exporters) that reads from the station and publishes to MQTT. Home Assistant subscribes.

Direct sensor reading via ESPHome. For DIY stations, ESPHome reads each sensor and exposes values directly.

Maintenance.

Personal weather stations need maintenance:

  • Rain gauges clean periodically (debris clogs them).
  • Anemometers check for free rotation.
  • Radiation shields clean as dust accumulates.
  • Sensors calibrate periodically against references.
  • Batteries replace on the schedule each specific model needs.

A neglected weather station reports inaccurate data that drives bad decisions.

Weather data failure modes.

Specific problems.

The API key that expired. Commercial weather service API key expired; integration stopped working. Fix: monitor for integration failures; renew keys proactively; prefer services without arbitrary expiration.

The free tier that got exceeded. High-volume polling hit the free tier limit; service started returning errors. Fix: respect rate limits, reduce polling frequency, or upgrade to paid tier.

The forecast that was just wrong. A specific forecast predicted rain that didn't come; automations skipped irrigation unnecessarily. Fix: no real fix. Weather forecasts have inherent uncertainty. For critical operations, either accept occasional wrong decisions or use real-conditions triggers (actual rain gauge rather than rain forecast).

The weather station that drifted. Temperature sensor in a personal weather station drifted 3°F over two years. Readings were systematically off. Fix: periodic calibration against a reference sensor.

The rain gauge that was clogged. Debris clogged the rain gauge; stopped reporting rain even during heavy storms. Automations relying on rainfall data made wrong decisions. Fix: periodic rain gauge inspection, especially after heavy foliage seasons.

The cloud service that went down. Weather service had an outage; Home Assistant weather data became unavailable. Cloud-dependent automations affected. Fix: if critical, use multiple weather sources so one outage doesn't eliminate data; use local stations where possible.

The location that wasn't quite right. Geocoded location for a weather service was slightly wrong; forecasts were for a nearby town's conditions rather than the farm's. Fix: verify location precision; use coordinate-based lookups rather than address-based.

The forecast format that changed. An integration's forecast attribute structure changed between Home Assistant versions; template expressions broke. Fix: test automations after Home Assistant updates; adapt templates to new structures when they change.

The weather station that stopped reporting. Personal weather station's Wi-Fi or cellular connection broke; data stopped arriving. Home Assistant showed stale data without alerts. Fix: automation that alerts if weather data hasn't updated in a specified time.

The dependency on a single forecast. Critical automations depended on a single weather service's forecast. When that service had a bad forecast, automations made bad decisions. Fix: use conservative thresholds; cross-check multiple sources for critical decisions.

What not to do.

Don't depend on a single weather source for critical decisions. Weather is uncertain; using multiple sources and conservative thresholds reduces the impact of any single bad forecast.

Don't use cloud-dependent weather services for critical monitoring without backup. A cloud outage affects decisions; a local station provides backup data.

Don't skip personal weather station maintenance. Rain gauges clog, sensors drift, anemometers bind. Annual inspection and calibration matter.

Don't assume forecast precipitation equals actual rainfall. Forecasts are probabilistic predictions; rain gauges measure reality. For decisions like irrigation skip, measured rainfall is more reliable than forecast rainfall.

Don't let weather automations go unmonitored. Weather data arrives; automations respond; occasionally something goes wrong. Periodic review confirms the automations are doing what they should.

Don't overload free-tier API limits. Free services impose limits; respect them. Exceeding limits typically breaks the integration until usage resets.

Don't neglect the weather station location. A station in a bad location produces bad data. Siting matters more than station quality.

Don't set thresholds once and forget. Operational tolerances and crop requirements change. Review weather-threshold automations seasonally.

Frequently asked questions.

Is there a free weather API for home automation?

Yes. The National Weather Service offers a free API covering the United States with no API key required, and Met.no from Norway provides free global forecasts. Environment Canada and the UK Met Office serve their regions. Home Assistant has mature integrations for all of these. Commercial services such as OpenWeatherMap and AccuWeather add free tiers with rate limits, plus paid plans with more detailed forecasts.

Are personal weather stations worth it for a farm?

Often, yes. An on-site station measures conditions no remote service can match: actual frost temperatures, which can vary widely across a single property, measured rainfall instead of forecast rainfall, and wind at the height where spraying or irrigation happens. Most operations pair a personal station for current conditions with a forecast service for forward-looking data. Expect roughly $100 to $800 depending on the station grade.

How do you automate irrigation to skip watering when it rains?

A common pattern checks measured rain over the last 24 hours and forecast rain for the next 6 hours before each scheduled cycle, and skips the cycle when either exceeds a threshold. The threshold depends on the crop and substrate; around 0.25 inches suits supplemental indoor watering, with higher amounts for outdoor fields. Measured rainfall from a rain gauge is more reliable than a forecast, which is only a probability.

Where should a weather station be placed for accurate readings?

Put the temperature and humidity sensor in a white radiation shield 5 to 6 feet above the ground, away from buildings and concrete that hold heat. Place the rain gauge in the open, at least two tree heights from tall trees. Mount the anemometer 30 feet up with 30 feet of clearance where practical; roof-mounted wind readings run low. Poor siting produces misleading data no matter how good the station is.

What temperature should trigger frost protection for plants?

A predicted overnight low below about 35°F is a typical trigger for freeze protection. That margin above freezing allows time to shut off irrigation lines before they freeze, start protective heating, and alert the grower. Dew point combined with the current temperature trend gives earlier warning of frost formation. Because temperatures vary across a property, an on-site sensor catches frost that a regional forecast can miss.

Why is my weather station giving inaccurate readings?

Debris-clogged rain gauges are a common cause; a clogged gauge reports no rain even during heavy storms. Temperature sensors can drift a few degrees over a couple of years without periodic calibration against a reference. Bad siting, such as a sensor near heat-holding concrete or a roof-mounted anemometer, skews readings from day one. Regular cleaning, calibration, and an alert for stale data catch most of these problems.