Automating Irrigation with ESPHome: A UK Climate Approach

Hi everyone, I wanted to share my journey in creating an automated irrigation system using ESPHome. As someone who loves gardening but struggles with consistent watering, I decided to take matters into my own hands. Here’s how I did it:

The Challenge: I live in the UK, where the weather can be quite unpredictable. I needed a system that could adjust watering durations based on temperature and rainfall forecasts without requiring constant manual adjustments.

The Solution: I set up a simple single-zone irrigation system using an ESPHome-controlled solenoid valve. The system uses data from OpenWeatherMap to automatically adjust watering times. Here’s a breakdown of how it works:

  1. Data Collection: The system pulls temperature and precipitation data from OpenWeatherMap each morning.
  2. Automation Logic: Based on the collected data, the system calculates the optimal watering duration. Here’s the core formula I used:
    python
    {{ [ 0, [((80 - (80 * ((states(‘sensor.openweathermap_forecast_precipitation’)|float / 3.3)))) * (states(‘sensor.openweathermap_forecast_temperature’)|float / 18 ) )|int, 120] | min] | max }}

This formula sets a baseline watering time of 80 minutes, which is then adjusted based on rainfall and temperature.
3. User Experience: I integrated this into Home Assistant with a slider in Lovelace, making it easy to tweak settings if needed.

Key Learnings:

  • Flexibility: The system is designed to be flexible. You can adjust the baseline watering time, temperature threshold, and maximum duration to suit your specific needs.
  • Precision Without Complexity: While I considered more complex calculations like evapotranspiration, I found that a simpler approach was sufficient for my needs and easier to maintain.
  • Testing: I recommend testing the formula in Home Assistant’s developer tools or Excel to see how it responds to different weather conditions before fully committing to it.

Why This Matters: Automating my irrigation system has saved me time and water. It’s also helped my plants thrive by ensuring they get just the right amount of water, even when I’m not around to tend to them.

I hope this helps anyone else looking to automate their irrigation system. If you have questions or suggestions, feel free to reach out! :smile: