Note This is not updated.
Irrigation Estimator custom component for Home Assistant. Based on https://github.com/jeroenterheerdt/HAsmartirrigation. Compared to HAsmartirrigation there are several changes:
- This component does not use reference evapotranspiration values
- It does not interact with OpenWeatherMap API. Simply select proper sensors from a separate OpenWeatherMap integration.
- It does not provide events for starting irrigation.
Bear in mind this is just an evapotranspiration model. It does not take into account:
- Water loss due to other factors, as an example water sinking deeper into the ground.
- Future weather conditions, e.g. if the forecast is it will be raining - it's on you to not schedule watering.
What this component does, is it provides three sensors that are updated at midnight each day:
- Evapotranspiration
- Bucket delta - difference between precipitation and evapotranspiration over the previous day, i.e. moisture lost yesterday
- Bucket - accumulated bucket deltas.
- Run time - the time needed to run your irrigation system to compensate for the moisture loss accumulated in the bucket.
This uses the fao56 model from [lib]. Note this is for the reference crop as specified in [].
https://www.rainbird.com/professionals/irrigation-scheduling-use-et-save-water. The component uses the PyETo module to calculate the evapotranspiration value (fao56). Also, please see the How this works Wiki page.
- Snow and rain fall on the ground add moisture. This is tracked /predicted hourly depending on the operation mode by the
rain
andsnow
attributes Together, this makes up theprecipitation
. - Sunshine, temperature, wind speed, place on earth and other factors influence the amount of moisture lost from the ground(
evapotranspiration
). This is tracked / predicted hourly depending on the operation mode. - The difference between
precipitation
andevapotranspiration
is thenetto precipitation
: negative values mean more moisture is lost than gets added by rain/snow, while positive values mean more moisture is added by rain/snow than what evaporates. - Once a day (time is configurable) the
netto precipitation
is added/substracted from thebucket,
which starts as empty. If thebucket
is below zero, irrigation is required. - Irrigation should be run for
daily_adjusted_run_time
amount of time (which is 0 isbucket
>=0). Afterwards, thebucket
needs to be reset (usingreset_bucket
). It's up to the user of the component to build the automation for this final step.
There are many more options available, see below. To understand how precipitation
, netto precipitation
, the bucket
and irrigation interact, see example behavior on the Wiki.
In order to get the most accurate results using sensors is preferable. You can substitute missing data using a weather component, e.g. OpenWeatherMap.
TODO list sensors needed and options
In this section:
Install the custom component (preferably using HACS) and then use the Configuration --> Integrations pane to search for 'Smart Irrigation'. You will need to specify the following:
- Names of sensors that supply required measurements (optional). Only required in mode 2) and 3). See Measurements and Units for more information on the measurements and units expected by this component.
- Number of sprinklers in your irrigation system
- Flow per spinkler in gallons per minute or liters per minute. Refer to your sprinkler's manual for this information.
- Area that the sprinklers cover in square feet or m2
After setting up the component, you can use the options flow to configure the following:
Option Description Default Maximum duration Maximum duration in seconds for any irrigation, including any lead_time
. -1 means no maximum.-1 Solar Radiation calculation From v0.0.50 onwards, the component estimates solar radiation using temperature, which seems to be more accurate. If for whatever reason you wanted to revert back to the pre v0.0.50 behavior (which used a estimation of sun hours) disable this. True
After successful configuration, you should end up with three entities and their attributes, listed below as well as three services.
For each instance of the component the following services will be available:
Service | Description |
---|---|
smart_irrigation.]instance]_reset_bucket |
Resets the bucket to 0. Needs to be called after done irrigating (see below). |
The number of seconds the irrigation system needs to run assuming maximum evapotranspiration and no rain / snow. This value and the attributes are static for your configuration. Attributes:
Attribute | Description |
---|---|
number of sprinklers |
number of sprinklers in the system |
flow |
amount of water that flows through a single sprinkler in liters or gallon per minute |
throughput |
total amount of water that flows through the irrigation system in liters or gallon per minute. |
area |
the total area the irrigation system reaches in m2 or sq ft. |
precipitation rate |
the output of the irrigation system across the whole area in mm or inch per hour |
The adjusted run time in seconds to compensate for any net moisture lost. Updated approx. every 60 minutes. Attributes:
Attribute | Description |
---|---|
precipitation |
the total precipitation (which is the sum of rain and snow in mm or inch) |
evapotranspiration |
the expected evapotranspiration |
netto precipitation |
the net evapotranspiration in mm or inch, negative values mean more moisture is lost than gets added by rain/snow, while positive values mean more moisture is added by rain/snow than what evaporates, equal to precipitation - evapotranspiration |
adjusted run time minutes |
adjusted run time in minutes instead of seconds. |
The adjusted run time in seconds to compensate for any net moisture lost. Updated every day at 11:00 PM / 23:00 hours local time. Use this value for your automation (see step 3, below). Attributes:
Attribute | Description |
---|---|
bucket |
running total of net precipitation. Negative values mean that irrigation is required. Positive values mean that more moisture was added than has evaporated yet, so irrigation is not required. Should be reset to 0 after each irrigation, using the smart_irrigation.reset_bucket service |
maximum_duration |
maximum duration in seconds for any irrigation, including any lead_time . |
adjusted run time minutes |
adjusted run time in minutes instead of seconds. |
You will use sensor.smart_irrigation_daily_adjusted_run_time
to create an automation (see step 3, below).
Since this component does not interface with your irrigation system directly, you will need to use the data it outputs to create an automation that will start and stop your irrigation system for you. This way you can use this custom component with any irrigation system you might have, regardless of how that interfaces with Home Assistant. In order for this to work correctly, you should base your automation on the value of sensor.smart_irrigation_daily_adjusted_run_time
as long as you run your automation after it was updated (11:00 PM / 23:00 hours local time). If that value is above 0 it is time to irrigate. Note that the value is the run time in seconds. Also, after irrigation, you need to call the smart_irrigation.reset_bucket
service to reset the net irrigation tracking to 0.
The last step in any automation is very important, since you will need to let the component know you have finished irrigating and the evaporation counter can be reset by calling the
smart_irrigation.reset_bucket
service
Here is an example automation that runs when the smart_irrigation_start
event is fired. It checks if sensor.smart_irrigation_daily_adjusted_run_time
is above 0 and if it is it turns on switch.irrigation_tap1
, waits the number of seconds as indicated by sensor.smart_irrigation_daily_adjusted_run_time
and then turns off switch.irrigation_tap1
. Finally, it resets the bucket by calling the smart_irrigation.reset_bucket
service. If you have multiple instances you will need to adjust the event, entities and service names accordingly.
- alias: Smart Irrigation
description: 'Start Smart Irrigation at 06:00 and run it only if the adjusted_run_time is >0 and run it for precisely that many seconds'
trigger:
- event_data: {}
event_type: smart_irrigation_start
platform: event
condition:
- above: '0'
condition: numeric_state
entity_id: sensor.smart_irrigation_daily_adjusted_run_time
action:
- data: {}
entity_id: switch.irrigation_tap1
service: switch.turn_on
- delay:
seconds: '{{states("sensor.smart_irrigation_daily_adjusted_run_time")}}'
- data: {}
entity_id: switch.irrigation_tap1
service: switch.turn_off
- data: {}
service: smart_irrigation.reset_bucket