petergridge / Irrigation-V5

Irrigation custom component for Home Assistant
GNU General Public License v3.0
61 stars 11 forks source link
hacs-integration home-assistant irrigation

hacs_badge my_badge

GitHub Workflow Status (with branch) GitHub Workflow Status (with branch) GitHub release (latest by date)

Would you like more language support? Can you help with a translation? Contact me!

Create a PR, contact me using the community link above, or raise and issue on github, tutorial.

V5.4.16 - coming soon

Irrigation Component V5 drawing

The driver for this project is to provide an easy-to-use interface for the gardener of the house. The goal is that once the initial configuration is done all the features can be modified using the custom lovelace card.

This program is essentially a scheduling tool, one user has used this to schedule the running of his lawn mower, so the use is far broader than I anticipated.

Watering can occur in an ECO mode where a water/wait/repeat cycle is run to minimise run off by letting water soak in using several short watering cycles. Great for pots.

Supports watering by time or volume.

A number of sensor inputs are available to stop or modify the watering based on external inputs.

The program issues Home Assistant events so you can undertake other automations if required.

There is also support for a pump or master solenoid, running programs or zones sequentially or concurrently.

The custom card renders the program configuration as a card ans is installed automatically. It exposes in addition to the state of each of the configured helpers:

This tutorial will get a basic setup running.

INSTALLATION

HACS installation

Important

Config Flow

Basic Configuration

You need to define the entities that allow you to control the features you want. I have have moved away from defining the helpers in YAML and create them via the Helpers tab in the Settings, Devices and services paged, I find it easier and there is no need to restart HA when you add new ones. Create the following for a basic setup.

For the Program create these helpers:

For each Zone create these helpers:

This tutorial will get a basic setup running, have a read of the notes below and try a few of the other features.

Test configuration

testhelpers.yaml provides the helper configuration to support all the objects for three zones. A set of template switches for the zones and pump as well as inputs to emulate rain and flow sensors.

This allow me to test the program without triggering any 'real' solenoids, and will allow you to mimic your configuration in new versions to ensure an operational configuration after coming out your winter hinernation.

Be aware this is a sumulation, variatons in latency or behaviour of indivdual implementations will have an impact.

Debug

Add the following to your logger section configuration.yaml

logger:
    default: warning
    logs:
        custom_components.irrigationprogram: debug

The following services support testing and debugging:

Rain Sensor feature

If a rain sensor is defined the zone will be ignored when the value of the sensor is True.

If the irrigation program is run manually the rain sensor value is ignored and all zones will run.

The rain sensor is defined in each zone. You can:

If the rain sensor (or other sensor) prevents scheduled watering the program will retry the next day.

Time or Volume based watering

Watering is by default time based, that is, will run for the minutes set in the water entity.

You can define a flow sensor on a zone that provides a volume/minute rate. eg litres per minute. Once defined the water attribute will be read as volume eg 15 litres not 15 minutes.

Start time

You can define the start time using two methods.

image

image

Run Days and Run Frequency

Run frequency allows the definition of when the program will run. This can be provided as dropdown helper or a sensor, see OpenWeatherMap History

Frequency can be set on the zone or program. If both are set the zone level frequency is used. If no frequency is provided the program will run every day at the specified start time. Application at the zone level allows different zones to execute at the same time of day but use varying frequencies. for example: Vege Patch every two days and the Lawn once a week.

The values provided can be:

For Australians you can select to water on specific days of the week to support water restriction rules.

Defining a Dropdown helper to use with the run_freq attribute, for example:

    options:
      - off
      - 1
      - 2
      - 3
      - Wed, Sat
      - Mon, Wed, Fri
      - Mon, Tue, Wed, Thu, Fri, Sat, Sun

Unscheduled execution of a zone or program

When a program or zone is triggered manually the following rules are applied:

If the Program is disabled it can still be initiated manually to run all enabled zones.

If the Zone is disabled it will not run until it is enabled.

These sensors will be defaulted:

ECO feature

The ECO feature allows multiple short watering cycles to be configure for a zone in the program to minimise run off and wastage. Setting the optional configuration of the Wait, Repeat attributes of a zone will enable the feature. Perfect for pots and can reduce water used by 50%.

Pump or master solenoid

You can optionally define a pump/master soleniod to turn on concurrently with the zone. The pump class then monitors the zones that require it and will remain active during zone transitions. The pump will shut off a few seconds after a zone has completed alowing a smooth transition between zones. The pump is only started and monitored when water in started by the custom control.

Water source monitoring

You can define a binary sensor that monitors the availability of the water source. For example if your well can run low on water this will have the following impact:

Zone Group

You can optionally configure zones to run concurrently. Create a switch group, group helper. This feature allows you to group switches together to operate as a single switch.

You can use this 'new' switch to define a zone in the program.

Monitor Controller Feature

If you have binary binary sensor that indicates the status of the watering system hardware, you can use this to prevent this system from initiating watering until the system is active.

For example I use an ESPHome implementation to control the hardware it exposes a status sensor, should the controller lose power or connectivity to Wi-Fi the custom control will not initiate the watering. There is also be a visual indication on the custom card of the status of the controller.

Additionaly, zone switches that are not in a known (on, off) state will not be executed, and a warning message will be logged.

Watering Adjuster feature

As an alternative to the rain sensor you can use the watering adjustment feature. With this feature the integrator is responsible to provide a multiplier value using a input_number or sensor component. I imagine that this would be based on weather data or a moisture sensor.

If a program or zone is run manually the adjustment is ignored and executed with the adjuster value of 1.

See the https://github.com/petergridge/openweathermaphistory for a companion custom sensor that may be useful.

Setting water_adjustment attribute allows a factor to be applied to the watering time.

Interlock

Turn off running programs when a new program is started, this is the default.

Note Change this on all program configurations to get consistent behaviour.

With interlock enabled:

With interlock disabled:

Events

The program_turned_on event provides the following:

An automation can then use this data to fire on the event you can refine it by adding specific event data.

alias: irrigation_program_starts
description: "do something when the program is initiated on schedule, not manually"
trigger:
  - platform: event
    event_type: irrigation_event
    event_data:
      action: program_turned_on
      scheduled: true
action: ---- Put your action here ----
mode: single

CONFIGURATION

CONFIGURATION VARIABLES

The definition of the YAML configuration: Attribute Type Mandatory Description
    start_time input_datetime, input_text Required Entity to set the start time of the program. From V5.4 a list of times from an input_text helper will allow the program to run multiple times e.g. 10:00:00, 12:00:00, 14:30:00. Format must be HH24:MM:00
    run_freq input_select Optional Indicate how often to run. If not provided will run every day
    controller_monitor binary_sensor Optional Detect if the irrigation controller is online. Schedule will not execute if offline
    irrigation_on input_boolean Optional Allows the entire program to be suspend, winter mode
    inter_zone_delay input_number Optional Allows provision for a delay, in seconds, between a zone completing and the next one starting.
    zones data for setting up a zone
      - zone switch Required This is the switch that represents the solenoid to be triggered
        water input_number, sensor Required The time to run or volume to supply for this zone
        water_adjustment sensor, input_number Optional A factor, applied to the watering time to decrease or increase the watering time
        wait input_number Optional Wait time,in minutes, of the water/wait/repeat ECO option. The effective irrigation time of a zone is water * repeat. Example : If 5 minutes is define in wait and repeat = 2, the final watering duration will be 10 minutes but the run time will be 15 minutes
        repeat input_number Optional The number of cycles to run water/wait/repeat
        pump switch Optional Define the switch that will turn on the pump or master soleniod
        water_source_active binary_sensor Optional Sensor to monitor if the water source, e.g. well has water
        flow_sensor sensor Optional Provides flow rate per minute. The water value will now be assessed as volume
        rain_sensor binary_sensor Optional True or On will prevent the irrigation starting
        ignore_rain_sensor input_boolean Optional Ignore rain sensor allows a zone to run even if the rain sensor is active
        zone_group input_text Optional Zone Group supports running zones concurrently.
        frequency input_select Optional Indicate how often to run. If not provided will default to the program level value
        enable_zone input_boolean Optional Disabling a zone, prevents it from running in either manual or scheduled executions, adding 'Off' or similar text value to the run_freq helper will have the same result
        interlock input_boolean Optional If set, the default, the program will stop other running programs when triggered

SERVICES

stop_programs:
  description: Stop any running programs and zones.

run_zone:
  description: run a specific zone.
  fields:
    entity_id:
      name: Irrigation Program
      description: The irrigation program to run
      required: true
      selector:
        entity:
            integration: irrigationprogram
    zone:
      name: Zone
      description: Zones to run
      required: true
      selector:
          entity:
            domain: switch
            multiple: true

reset_runtime:
  description: reset the runtime back to none for the program supports testing.
  fields:
    entity_id:
      name: Entity ID
      description: The irrigation program to run
      required: true
      selector:
        entity:
            integration: irrigationprogram

run_simulation:
  description: Simulate running a program, exectution logic is not called, the functions are and results shown in the log.
  fields:
    entity_id:
      name: Entity ID
      description: The irrigation program to test
      required: true
      selector:
        entity:
            integration: irrigationprogram

list_config:
  description: List current configuration to the log.

REVISION HISTORY

V5.4.15

5.2.10