How do I control my lawn irrigation using irrigation unlimited integration

It may seem complicated but you can do it, especially with forum help. My only advice is to break it down in pieces. Start with one zone and get that working with an automation. Have it trigger on a hard coded time.

Here is a simple automation that you can set up in the UI.

alias: Water Zone
  description: Water Zone
  trigger:
  - platform: time
    at: '14:05'
condition: []
action:
  - service: switch.turn_on
    target:
      entity_id: switch.rasenbewasserung_hochbeet_nord
  - delay:
      minutes: '1'
  - service: switch.turn_off
    target:
      entity_id: switch.rasenbewasserung_hochbeet_nord

It will water the zone for 1 minutes and shut off. You can then add the next zone and so on until you get everything working. This is brute force and it can leave a zone on but it will help you build and understand exactly what the automation is doing.

Hope this gives you some direction.

gez AllHailJ,

thank you so much for the tip this is exactly what I am looking for easy and understandable to start with the only thing that I figured that I would try to put it into a script rather than into an automation. For that case I put in a input boolean helper called input_boolean rasenbewasserung type is toggle.
So I want to start the sequence you were talking about when I toggle the input boolean switch.
Would that be possible as well?
Anything more fancy will probably go from there.

You will still need an automation to run the script.

If you are doing it from my posted automation you need to change

condition: []

to

condition:
  - condition: state
    entity_id: input_boolean.rasenbewasserung
    state: 'on'

Action will be to just call the script.

Remember Multiple triggers are OR logic

Trigger this time
or
Trigger that time

conditions are and

if trigger true and condition false → No execution

trigger true and condition true —> Execute actions

if you just want to trigger the automation with input boolean

alias: Water Zone
description: Water Zone
trigger:
  platform: state
  entity_id: input_boolean.rasenbewasserung
  from: "off"
  to: "on"
action:
- service: script.turn_on
  data:
  service: script.your_script

Thank you for the help.
Unfortunately I cannot check it at the moment because I’m not home to test it out . It will be the first thing when I’m home at 1700.
But from looking at the the automation it looks rather promising .
The next two goals are to be able to stop the script while still is running. I guess it’s just another automation to stop it all
And also I would like to display the remaining time in my Lovelace when when irrigation automation is running.

So I tested it and work however the triggered with the binary sensor to manually activate doesn’t I can only activate it by manually starting the automation

Bit confused. Which automation did you try?

The modified condition or the one with the input_boolean trigger. Can you post your latest automation.

The count down of time remaining is possible.

You will have to create a sensor

template:
  - sensor:
    - name: "Countdown Water Timer Decimal Minutes"
      unique_id: "Countdown Water Timer Decimal Minutes"
      state: >-
        {{  (( states.input_boolean.rasenbewasserung.last_changed | as_timestamp  -
                utcnow() | as_timestamp  + 
                states('sensor.total_time_watering_seconds') | float(0) ) / 60.0) | round(1) }}

Alternative to AllHailJ’s suggestion, there is a built-in integration called “timer” in Home Assistant. It may help in simplifying your automation. As I’ve mentioned before, I use irrigation_unlimited for the scheduling of my garden watering system. But I also every now and then would want to start watering manually. And I almost always forgotten to switch it off. So, I use the “timer” construct in HA. I define for every drips or sprinklers that I have one corresponding timer eg:

timer:
  hochbeet_nord:
    duration: "00:10:00"
  terrasse:
    duration: : "00:15:00"

Then I set up automation when the corresponding switch is switched on, I start the timer:

- id: hochbeet_nord_start
  alias: Start_Timer_when_hochbeet_nord_turned_on
  trigger:
  - entity_id: switch.rasenbewasserung_hochbeet_nord
    platform: state
    to: 'on'
  action:
  - service: timer.start
    entity_id: timer.switch.hochbeet_nord
    data:
      duration: "00:10:00"

Of course when the timer lapsed, I switch off the corresponding switch:

- id: hochbeet_nord_timer_lapsed
  alias: When_hochbeet_nord_Timer_Lapsed
  trigger:
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.hochbeet_nord
  action:
  - service: switch.turn_off
    entity_id: switch.rasenbewasserung_hochbeet_nord

There are times that I want to manually stop the watering in the middle of it, I need to make sure the timer is reset too:

- id: hochbeet_nords_stop
  alias: reset_timer_when_hochbeet_nord_switch_turned_off
  trigger:
  - entity_id: switch.rasenbewasserung_hochbeet_nord
    platform: state
    to: 'off'
  action:
  - service: timer.cancel
    entity_id: timer.hochbeet_nord

I also put the timer in the dashboard so I could see the remaining time, eg:

type: entities
entities:
  - entity: timer.hochbeet_nord

That’s the gist of it. Hope it is helpful to some if not the immediate OP. Of course I didn’t implement exactly like the above - I have the timers tie to input_numbers and also in dashboard I use a custom:timer-bar-card.

This is my working setup so far.
Automation:

alias: Rasenbewässerung Automatik
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.rasenbewasserung
    from: 'off'
    to: 'on'
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.rasenbewasserung_hochbeet_nord
  - delay:
      minutes: '20'
  - service: switch.turn_off
    target:
      entity_id: switch.rasenbewasserung_hochbeet_nord
    data: {}
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.rasenbewasserung_terrasse
  - delay:
      hours: 0
      minutes: 20
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.rasenbewasserung_terrasse
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.rasenbewasserung_rechts
  - delay:
      hours: 0
      minutes: 20
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.rasenbewasserung_rechts
mode: single

This is the automation to turn it off

alias: Rasenbewässerung Automatik stoppen
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.rasenbewasserung
    from: 'on'
    to: 'off'
condition: []
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.rasenbewasserung_hochbeet_nord
        - switch.rasenbewasserung_terrasse
        - switch.rasenbewasserung_rechts
    data: {}
  - service: switch.turn_off
    data: {}
  - service: switch.turn_off
    data: {}
    target:
      entity_id: input_boolean.tropfbewasserung
mode: single

drip irrigation was a lot easier, because I can run the 3 circles simultneously.
How can I display the remaining time for each zone in lovelace?
And how can I alter the irrigation dutation?

So say I want to use that code - do I have to create an entity within config.yaml?
Or do I paste it somewhere else?

How can I display the remaining time for each zone in lovelace?

The code I posted (below)

template:
  - sensor:
    - name: "Countdown Water Timer Decimal Minutes"
      unique_id: "Countdown Water Timer Decimal Minutes"
      state: >-
        {{  (( states.input_boolean.rasenbewasserung.last_changed | as_timestamp  -
                utcnow() | as_timestamp  + 
                states('sensor.total_time_watering_seconds') | float(0) ) / 60.0) | round(1) }}

would be pasted in config.yaml or in an include file if you use it.

And how can I alter the irrigation dutation?

Create inputs_numbers for the desktop/Lovelace

Input_number:
  rasenbewasserung_hochbeet_nord:
    name: Rasenbewasserung Hochbeet Nord
    icon: mdi:clock-start
    min: 1
    max: 30
    step: 1
    mode: slider
    unit_of_measurement: min

In the automation change the delay for each zone to

- service: switch.turn_on
    target:
      entity_id: switch.rasenbewasserung_nord
  - delay:
      minutes: "{{ states('input_number.rasenbewasserung_nord') | int(0) }}"
  - service: switch.turn_off
    target:
      entity_id: switch.rasenbewasserung_nord

You will need a input number for each zone.

Would that create an entiy or where is it found when included?

I create a new card, put that in.yaml

type: Input_number
  rasenbewasserung_hochbeet_nord:
    name: Rasenbewasserung Hochbeet Nord
    icon: mdi:clock-start
    min: 1
    max: 30
    step: 1
    mode: slider
    unit_of_measurement: min

and I got this as a result:

bad indentation of a mapping entry (2:33)

 1 | type: Input_number
 2 |   rasenbewasserung_hochbeet_nord:
-------------------------------------^
 3 |     name: Rasenbewasserung Hochbeet Nord
 4 |     icon: mdi:clock-start

seems awefully wrong.

should be input_number not Input_number. Mea Culpa!

Thank you for the help again.
I now created two helpers - one for lawn irrigation and one for drip irrigation

input_number.dauer_tropfbewasserung

and

input_number.dauer_rasenbewasserung

how do I change the automation that it takes the specified time for the duration of the irrigation instead of the fixed 20 minutes of zone as of now it’s fine with me that each zone has an equal length and I could easily change it separately from there.

The other issue is with displaying the remaining time. I would like to see the remaining time for each irrigation zone. I posted

template:
  - sensor:
    - name: "Countdown Water Timer Decimal Minutes"
      unique_id: "Countdown Water Timer Decimal Minutes"
      state: >-
        {{  (( states.input_boolean.rasenbewasserung.on | as_timestamp  -
                utcnow() | as_timestamp  + 
                states('sensor.total_time_watering_seconds') | float(0) ) / 60.0) | round(1) }}
  

and added the entity

sensor.countdown_water_timer_decimal_minutes

as a result I get -159.5 and it keeps changing even though the irrigation is off. So something is not right still.

It is running once a minute and is counting down so it will go negative.

Here is a similar sensor that stops at 0.0

template:
  - sensor:
    - name: "Countdown Water Timer Decimal Minutes"
      unique_id: "Countdown Water Timer Decimal Minutes"
      state: >-
        {% set timestamp =  states.input_boolean.rasenbewasserung.on | as_timestamp  %}
        {% set mynow =  utcnow() | as_timestamp %}
        {% set watertime = states('sensor.total_time_watering_seconds') | float(0) %}
        {% if timestamp - mynow + watertime > 0 %}
          {{ ((timestamp - mynow + watertime) / 60.0) | round(1) }}
        {% else %}
           0.0
        {% endif %}

I tested this in the developer tools. I set variables and output the variables for each condition. My zone time is in minutes so that is why it is multiplied by 60. This will updated once a minute.

{% set timestamp =  states.input_boolean.run_irrigation.last_changed | as_timestamp  %}
{% set mynow =  utcnow() | as_timestamp %}
{% set watertime = states('input_number.zone1') | float(0) * 60.0 %}
{% if timestamp - mynow + watertime > 0 %}
  {{ timestamp }}
  {{ mynow }}
  {{ watertime }}
  {{ ((timestamp - mynow + watertime) / 60.0) | round(3) }}
{% else %}
    0.0
  {{ timestamp }}
  {{ mynow }}
  {{ watertime }}
{% endif %}

and got this

after 5 minutes it becomes this

I doesn’t quite work for me - in supervisor I tried

template:
  - sensor:
    - name: "Countdown Water Timer Decimal Minutes"
      unique_id: "Countdown Water Timer Decimal Minutes"
      state: >-
        {% set timestamp =  states.input_boolean.rasenbewasserung.on | as_timestamp  %}
        {% set mynow =  utcnow() | as_timestamp %}
        {% set watertime = states('sensor.total_time_watering_seconds') | float(0) %}
        {% if timestamp - mynow + watertime > 0 %}
          {{ ((timestamp - mynow + watertime) / 60.0) | round(1) }}
        {% else %}
           0.0
        {% endif %}

However, I get this:

UndefinedError: 'homeassistant.helpers.template.TemplateState object' has no attribute 'on'

states.input_boolean.rasenbewasserung.on | as_timestamp

Should be

states.input_boolean.rasenbewasserung.last_changed | as_timestamp

The last_changed is the time the input boolean last changed.

Can something like this work?

alias: Automatic Run
description: “”
trigger:

My Time Condition

condition:

My Weather Condition

action:

controller_zone_entity: 1.0 Sprinkler Valve

controller_sequence_entity: 1.1 Run 1

time_entity: “00:10:00”

  • service: irrigation_unlimited.shim_manual_run
    data:
    controller_zone_entity: input_select.irrigation_unlimited_entities
    controller_sequence_entity: input_select.irrigation_unlimited_sequences
    time_entity: input_datetime.irrigation_unlimited_run_time
  • service: irrigation_unlimited.shim_cancel
    data:
    controller_zone_entity: input_select.irrigation_unlimited_entities
    mode: single

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16