petergridge / irrigation_V5

Version 5 of irrigation program - significant breaking change from v4
GNU General Public License v3.0
0 stars 0 forks source link
hacs home-assistant homeassistant irrigation

This repository has been replaced by https://github.com/petergridge/Irrigation-V5.

Irrigation Component V5.1 drawing

This release is a significant change in the configuration from Version 4. While the functionality remains the same the configuration is now available through the settings Devices & Services.

The custom card https://github.com/petergridge/irrigation_card V5.1 will render the program options specified in the configuration.

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 inital configuration is done all the features can be modified using the custom lovelace card. With this upgrade the component is also simple to configure.

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

The information provided by the configuraton is evaluated to trigger the irrigation action according to the inputs provided.

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. The wait and repeat configuration is optional.

The rain sensor is implemented as a binary_sensor, this allows practically any combination of sensors to suspend the irrigation. This can be defined at the zone level to allow for covered areas to continue watering while exposed areas are suspended.

Implemented as a switch, you can start a program using the schedule, manually or using an automation. Manually starting a program by turning the switch on will not evaluate the rain sensor rules it will just run the program, as there is an assumption that there is an intent to run the program regardless of sensors.

Only one program can run at a time to prevent multiple solenoids being activated. If program start times result in an overlap the running program will be stopped. Zones can be configured to run concurrently or sequentially using the grouping funtionality.

INSTALLATION

HACS installation

Will be available on HACS soon but you can add it as a custom repository.

Important

Config Flow

Pre-requisite

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:

Time or Volume based watering

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

Zone Group

You can optionally group zones to run concurrently or sequentially. The helper will be created automatically to support this. Blank groups or where a zone_group is not defined will be sequential zones. Zones are grouped by having the same text value, for example each zone with a value of 'A' will run concurrently.

Monitor Controller feature

If this binary sensor is defined it will not execute a schedule if the controller is offline. This is ideal for ESP Home implementations.

Watering Adjuster feature

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

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

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

The following automation is an example of how a input_number.adjust_run_time could be maintained using template calculation.

automation:
- id: '1553507967550'
  alias: rain adjuster
  mode: restart
  trigger:
  - platform: time_pattern
    minutes: "/1"
  action:
    - service: input_number.set_value
      entity_id: input_number.rain_adjuster
      data:
        value: "{{ value template calculation }}"

Run Days and Run Frequency

Run frequency allows the definition of when the program will run. If no frequency input_select is provided a default one will be generated.

This can be a specific set of days or the number of days between watering events and can be defined at the Program or zone level. Application at the zone level allows different zones to execute at the same time but using varying frequencies. for example: Vege Patch every two days and the Lawn once a week.

Defining a Dropdown helper to use with the run_freq attribute, .

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

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.

Events

The zone_turned_on event provides this information:

event_type: irrigation_event
data:
  device_id: afternoon
  action: zone_turned_on
  zone: zone_1
  pump: switch.dummy_pump
origin: LOCAL
time_fired: "2022-08-15T23:33:36.358814+00:00"
context:
  id: 01GAHXP1F6KQWTM6Z6PEJ69KDM
  parent_id: null
  user_id: null

An automation can then use this data to fire on the event, in this example it the automation would run only when the pump event data is 'switch.pump'. but you could refine it more to include a specific zone or remove the event data clause and it would run every time the event is triggered. Other triggers can be added if there is a use case for them. Let me know.

alias: pump_keep_alive
description: "Let the pump device know that HA is still alive so it does not time out and shut down"
trigger:
  - platform: event
    event_type: irrigation_event
    event_data:
      pump: switch.pump
      action: zone_turned_on
action: ---- Put your action here ----
mode: single

CONFIGURATION

CONFIGURATION VARIABLES

The definition of the YAML configuration: Attribute Type Mandatory Description
    start_time input_datetime Required entity to set the start time of the program
    show_config input_boolean Optional 'Show configuration' used to show/hide the configuration in the companion card
    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 Display name for the auto generated helper, this item will created if not defined with a display value of 'Enable irrigation'
    inter_zone_delay input_number Optional Display name for the auto generated helper, for example 'Inter zone Delay'
    zones data for setting up a zone
      - zone switch Required This is the switch that represents the solenoid to be triggered
        water input_number 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 Display name for the auto generated helper, for example 'Wait'. Wait time of the water/wait/repeat ECO option
        repeat input_number Optional Display name for the auto generated helper, for example 'Repeat'. The number of cycles to run water/wait/repeat
        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
        run_freq 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

SERVICES

irrigationprogram.stop_programs:
    description: Stop any running program.

REVISION HISTORY

5.1.15