My Garden Irrigation

I tried this but no joy, does it look correct ? and yes it came from your gitup which i tried to modify.

  #========================================
  #=== Notify when a cycle starts or stops
  #========================================
  - alias: Irrigation Notify When Cycle Starts Or Stops
    id: irrigation_notify_when_cycle_starts_or_stops
    trigger:
      - platform: state
        entity_id: input_boolean.irrigation_cycle1_running
        id: cycle1

      - platform: state
        entity_id: input_boolean.irrigation_cycle2_running
        id: cycle2

    condition:
      - or:
          - condition: state
            entity_id: input_boolean.irrigation_notify_user1
            state: 'on'
          - condition: state
            entity_id: input_boolean.irrigation_notify_user2
            state: 'on'         

    variables:
      message: >
        {% set cycle_name = states('input_text.irrigation_' ~ trigger.id ~ '_name') %}
        {% if trigger.to_state.state == 'on' %}
          I thought you'd like to know that the {{ cycle_name }} has just started.
          The total watering time should be about {{ (states('sensor.irrigation_' ~ trogger.id ~ '_duration_in_seconds') | int / 60) | int }} minutes but I'll let you know when it has finished.
        {% else %}
          All the {{ cycle_name }} watering is done.
        {% endif %}
    action:
      - if:
          condition: state
          entity_id: input_boolean.irrigation_notify_user1
          state: 'on'
        then:
          - service: >
              notify.mobile_app_{{ states('input_text.notifications_user1_name') | lower }}_phone_7
            data:
              title: 🌼 Irrigation 🌼
              message: >
                {{ message }}      
      - if:
          condition: state
          entity_id: input_boolean.irrigation_notify_user2
          state: 'on'
        then:
          - service: >
              notify.mobile_app_{{ states('input_text.notifications_user1_name') | lower }}iphone_7
            data:
              title: 🌼 Irrigation 🌼
              message: >
                {{ message }} 

Yes but are your notify services correct?

1 Like

Ok im getting there i can recieve a message with this config below with out a message imbedded in the text, it’s when i uncomment the section with variables it stops working, so i guess its the way its formatted / worded in that section maybe, but as stated i’m getting there.

Thanks Klogg for taking time out to help with this :slight_smile:

  - alias: Irrigation Notify When Cycle Starts Or Stops 
    id: irrigation_notify_when_cycle_starts_or_stops
    trigger:
      - platform: state
        entity_id: input_boolean.irrigation_cycle1_running
        id: cycle1

      - platform: state
        entity_id: input_boolean.irrigation_cycle2_running
        id: cycle2

    condition:
      - or:
          - condition: state
            entity_id: input_boolean.irrigation_notify_user1
            state: 'on'
          - condition: state
            entity_id: input_boolean.irrigation_notify_user2
            state: 'on'         

    # variables:
    #   message: >
    #     {% set cycle_name = states('input_text.irrigation_' ~ trigger.id ~ '_name') %}
    #     {% if trigger.to_state.state == 'on' %}
    #       I thought you'd like to know that the {{ cycle_name }} has just started.
    #       The total watering time should be about {{ (states('sensor.irrigation_' ~ trogger.id ~ '_duration_in_seconds') | int / 60) | int }} minutes but I'll let you know when it has finished.
    #     {% else %}
    #       All the {{ cycle_name }} watering is done.
    #     {% endif %}
    action:
      - if:
          condition: state
          entity_id: input_boolean.irrigation_notify_user1
          state: 'on'
        then:
          - service: notify.mobile_app_iphone_7
            data_template:
              title: 🌼 Irrigation 🌼
              message: >
                {{ message }}  

Try something like:

I thought you'd like to know that the {{ states('input_text.irrigation_cycle' ~ trigger.id ~ '_name' }}

You caught me on a good day :slight_smile:

1 Like

No go with that change it throws a wobbly in the config, ill keep on trying as i know i’m near to getting this working, but now for some lunch.

Try I thought you'd like to know that {{ trigger.id }} has finished

If that works, take it from there

Okay here we go for anyone else, i have now got this working in one automation, i just trolled around and put pieces of the code together, at first i was using two automations for user 1 and 2 then breaking the code down from there, not without help firstly from Klogg thanks once again.

And to be honest i’m not sure what it all means in the messages section or how it works, as i’m a copy and paste type of person :slight_smile: but it works fine on my Iphone getting the start and ending notifications (you will need to set up your services the way you receive notifications if not using a iphone), but as stated it works for me.

#========================================
  #=== Notify when a cycle starts or stops
  #========================================
  - alias: Irrigation Notify When Cycle Starts and stops
    id: irrigation_notify_when_cycle_starts
    trigger:
      - platform: state
        entity_id: input_boolean.irrigation_cycle1_running
        id: cycle1

      - platform: state
        entity_id: input_boolean.irrigation_cycle2_running
        id: cycle2

    condition:
      - or:
          - condition: state
            entity_id: input_boolean.irrigation_notify_user1
            state: 'on'
          - condition: state
            entity_id: input_boolean.irrigation_notify_user2
            state: 'on'  
    variables:
      message: >
        {% if trigger.entity_id == 'input_boolean.irrigation_cycle1_running' %}
          {% set cycle = 'cycle1' %}
        {% else %}
          {% set cycle = 'cycle2' %}
        {% endif %}

        {% set cycle_name = states('input_text.irrigation_' ~ cycle ~ '_name') %}

        {% if trigger.to_state.state == 'on' %}
          {% set ns = namespace(total_time = 0) %}
          {% for zone in states.input_number if zone.entity_id.startswith('input_number.irrigation_' ~ cycle ~ '_zone') and
                                                zone.entity_id.endswith('_duration') %}
            {% if is_state('input_boolean.irrigation_' ~ cycle ~ '_zone' ~ loop.index ~ '_skip', 'off') %}
                {# Adjust for rainfall #}
                {% if is_state('input_boolean.irrigation_' ~ cycle ~ '_adjust_for_rainfall', 'on') %}
                  {% set ns.total_time = ns.total_time * states('input_number.irrigation_rainfall_multiplier') | float %}
                {% elif is_state('input_boolean.irrigation_' ~ cycle ~ '_adjust_for_temperature', 'on') %}
                  {% set ns.total_time = ns.total_time * states('input_number.irrigation_temp_multiplier') | float %}
                  {% else %}
                  {% set ns.total_time = ns.total_time + states(zone.entity_id) | float %}
                {% endif %}
              {% endif %} 
          {% endfor %}
          
          I thought you'd like to know that the {{ cycle_name }} cycle has just started.


        The total watering time should be about {{ (ns.total_time * 60) | timestamp_custom('%H:%M', false) }} but I'll let you know when it has finished.
        {% else %}
          All the {{ cycle_name }} cycle watering is done.
        {% endif %}


    action:
      - if:
          condition: state
          entity_id: input_boolean.irrigation_notify_user1
          state: 'on'
        then:
          - service: notify.mobile_app_iphone_7
            data_template:
              title: 🌼 Irrigation 🌼
              message: >
                {{ message }}
      - if:
          condition: state
          entity_id: input_boolean.irrigation_notify_user2
          state: 'on'
        then:
          - service: notify.mobile_app_iphone_7
            data_template:
              title: 🌼 Irrigation 🌼
              message: >
                {{ message }}

Hi everyone, unfortunately I can’t get the automatic irrigation programming to work.
Nothing happens at the scheduled time, while if I activate the sprinklers manually everything works as it should.
Could someone help me understand why the automatic programming isn’t working?
Thank you very much!

Alessandro

At the right of every zone, you have to check the option “Every Day” if you want to irrigate every day, otherwise you have to check the day under the name of the zone when you want to irrigate.
Like in “Retro Zona A”.
Let me know if it works.

Hi @shakin89,
i wanted to irrigate only Retro Zona A that’s why I selected “Sat”. When it arrives at the set time, it does nothing. But is there a project log file to understand where the error is?

Do you have a sensor for rain? if yes, then if it’s raining, the irrigation won’t start.
You can look in the system logs. It should logs all the events there.
Other reason for not watering, doesn’t come in mind.
If it works in manual mode, then it should even work in scheduled mode.

Yes, I have that sensor but disabling the “adjust with rain” option should still make it work. This situation is incredible. Everything works if I launch the manual mode. Nothing works if I launch the schedule function.
I also tried deleting and reinstalling everything but without success.
Same problems.
Thank you anyway for your support.
Regards,

Alessandro

@klogg

Finally, I have found my problem.
I hadn’t created the binary_sensor related to my rain sensor.

The issue is that the file uses the off/on condition to start watering but this related file (input_text.irrigation_external_sensor_raining_now) shows as the image below:

and not on or off.

The question is:
How should i do to make the result on or off?

Thanks in advance.
Regards,

Alessandro

The option adjust for rainfall only adjust the quantity of water if will rain or has rained.
If you don’t have a physical rain sensor, then leave the field blank. The binary_sensor.raining_now should have no effect if it doesn’t exist.
Or from the helpers menu, create a binary_sensor.raining_now that you adjust manually.

I’ve a weather station on my roof and i’ve also rain sensor.
I’ve already created a binary sensor for it but the result isn’t on or off but the name of the sensor …and watering doesn’t start!
Look the image above.

Regards,

Alessandro

The image above reports the results of the input_text.irrigation_external_sensor_raining_now, which should be exactly the name of your binary sensor.
You have to create a binary_sensor from the weather station, if you still don’t have it. A binary sensor can have only two values, on, or off.
in the text box, you have to put the name of the sensor you created, mine is called binary_sensor.stazione_meteo_raining
Check from the developer tools if the binary sensor has a value of on or off and then try to irrigate.

I’ve already done it:

and its results is correct: OFF.

but if i put the name of binary sensor in own field like this image:

the results of related input_text file is not “off” but the name of sensor.

This results blocked watering because the condition below is not “off”, “unknow” or “unavailable” but the name of sensor :slight_smile:

I hope I have explained myself well.
Regards,

Alessandro

Yes, you explained well.
First of all, raining_now should be under “binary_sensor:” not “sensor:”

try to change it and se if it works, otherwise we’ll try something different.

Hi @klogg and all!
I’m succesfully using the great irrigation system, but still have some minor issues. Let me explain the first one, to start with.
On the GENERAL tab I’ve a problem with output I cannot understand which variable is not initialized correctly. The page error is:

tap_action:
  action: toggle
type: custom:button-card
group_expand: false
hold_action:
  action: None
double_tap_action:
  action: None
layout: vertical
size: 50%
color_type: icon
show_name: true
show_state: false
show_icon: true
show_units: true
show_label: false
show_entity_picture: false
show_live_stream: false
card_size: 3
entity: input_boolean.logging_irrigation
name: Logging
icon: null
lock:
  enabled: false
  duration: 5
  unlock: tap
styles:
  grid:
    - grid-template-areas: '"i n check_box"'
    - grid-template-columns: |
        [[[
          var columns = '2';
          if (columns == '1')
            {
              var icon_size = '10%';
              var check_box_size = '8%';
            }
          else
            {  
              var icon_size = '20%';
              var check_box_size = '16%';
            }
          return icon_size + ' auto ' + check_box_size;
        ]]]
    - grid-template-rows: 1fr
  img_cell:
    - padding: 0em
  card:
    - font-family: |
        [[[
          return states['input_text.irrigation_ui_font_family'].state
        ]]]
    - padding: 0em
    - padding-right: |
        [[[
          var columns = '2';
          if (columns == '1')
            return '1em';
        ]]]
    - padding-left: |
        [[[
          var columns = '2';
          if (columns == '1')
            return '1em';
        ]]]
    - height: 2.5em
    - font-size: 14px
    - border-radius: 5px
  name:
    - justify-self: start
  custom_fields:
    check_box:
      - padding: 0.4em
      - justify-self: null
custom_fields:
  check_box: |
    [[[
      if (entity.state == 'on')
          return '<ha-icon icon="mdi:checkbox-marked"></ha-icon>';
      else
          return '<ha-icon icon="mdi:checkbox-blank-outline"></ha-icon>';
    ]]] 
state:
  - value: 'on'
    name: null
    icon: mdi:notebook-check
    styles:
      card:
        - background-color: var(--primary-background-color)
        - border: 1px solid var(--accent-color)
  - value: 'off'
    name: null
    icon: mdi:notebook-remove-outline
    styles:
      card:
        - color: var(--secondary-text-color)
        - box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.19)
      icon:
        - color: var(--secondary-text-color)
default_color: var(--primary-text-color)
color_off: var(--paper-item-icon-color)
color_on: var(--paper-item-icon-active-color)

And a screen as well:

Ideas why?

Same for “Rainfall today” (SOLVED - IT WAS CAUSED BY THE “Using SmartWeather (show stations)” ENABLED. DIABLING IT, THE PROBLEM WENT AWAY. MAYBE I NEED TO CHECK THOSE SETTINGS):

In this case I have the variable defined:

Second issue:

If I enable the “Adjust for temperature” it never starts. Is there a way to debug? I.e. as soon it starts, it shows in the logs what it’s happening and why it starts or not?
Forecast is showing me always ZERO so set to highest instead:

Thanks!

Simon

Hello,
Nothing works for me, I have reinstalled several times and I have all the integrations

Ideas

Steph