My Garden Irrigation

Hmmm… I deleted all zone 9-16 entrys in all package yamls and now the time is calculated correct again…!

But still not starting :frowning:

I also had a problem that the schedules did not start.
I had the wrong time zone. Once set up correctly, the schedules started working.

I have also problem, but because I’m new in home assistant and probably my problem is very simple and stupid. How could I run a manual schedule using the tasmota button? I have button connected to tasmota, after push this button I would like to run manual schedula. Second press would swich-off the schedule. There is a possibility?

Hi Everyone, I am really hoping someone can help me. I installed all the prereqs, I also put in the lovelace dashboard following the google translated page. However, after copying over the package and lovelace folders, I am stuck at this stage. I am not sure what I am doing wrong. Can anyone kindly help? To me it seems like I have to define the switches somewhere. I am using the bhyve integration for my sprinkler system. So i have the switches, but I feel they need to be connected with this integration somewhere.

tap_action:
  action: |
    [[[
      if (states['binary_sensor.irrigation_cycle_start_clash'].state == 'on')
        return 'fire-dom-event';
      else
        return 'none';
    ]]]
  browser_mod:
    command: popup
    title: ❗  CYCLE SCHEDULE CLASH
    card:
      type: markdown
      content: >
        #### WARNING! You have overlapping cycle schedules...


        {{ state_attr('binary_sensor.irrigation_cycle_start_clash',
        'clash_text') }}


        Please check and correct.
type: 'custom:button-card'
group_expand: false
hold_action:
  action: none
double_tap_action:
  action: none
layout: vertical
size: 40%
color_type: icon
show_name: true
show_state: false
show_icon: false
show_units: true
show_label: true
show_entity_picture: false
show_live_stream: false
card_size: 3
entity: input_text.irrigation_current_status
triggers_update:
  - group.irrigation_group_cycle1_every_day
  - group.irrigation_group_cycle1_mon
  - group.irrigation_group_cycle1_tue
  - group.irrigation_group_cycle1_wed
  - group.irrigation_group_cycle1_thu
  - group.irrigation_group_cycle1_fri
  - group.irrigation_group_cycle1_sat
  - group.irrigation_group_cycle1_sun
  - group.irrigation_group_cycle2_every_day
  - group.irrigation_group_cycle2_mon
  - group.irrigation_group_cycle2_tue
  - group.irrigation_group_cycle2_wed
  - group.irrigation_group_cycle2_thu
  - group.irrigation_group_cycle2_fri
  - group.irrigation_group_cycle2_sat
  - group.irrigation_group_cycle2_sun
name: |
  [[[
    if (states['input_boolean.irrigation_master_control_switch'].state == 'off')
      return 'SYSTEM IS OFF';
    else
      var today = new Date();
      var weekday = new Array(7);
      weekday[0] = "sun";
      weekday[1] = "mon";
      weekday[2] = "tue";
      weekday[3] = "wed";
      weekday[4] = "thu";
      weekday[5] = "fri";
      weekday[6] = "sat";

      var day_today = weekday[today.getDay()];
      var day_tomorrow = weekday[(today.getDay() + 1) % 7];

      if (states['group.irrigation_group_cycle1_every_day'].state == 'on' ||
          states['group.irrigation_group_cycle1_' + day_today].state == 'on')
        var cycle1_runs_today = true;
      else
        var cycle1_runs_today = false;

      if (states['group.irrigation_group_cycle2_every_day'].state == 'on' ||
          states['group.irrigation_group_cycle2_' + day_today].state == 'on')
        var cycle2_runs_today = true;
      else
        var cycle2_runs_today = false;

      if (states['group.irrigation_group_cycle1_every_day'].state == 'on' ||
          states['group.irrigation_group_cycle1_' + day_tomorrow].state == 'on')
        var cycle1_runs_tomorrow = true;
      else
        var cycle1_runs_tomorrow = false;

      if (states['group.irrigation_group_cycle2_every_day'].state == 'on' ||
          states['group.irrigation_group_cycle2_' + day_tomorrow].state == 'on')
        var cycle2_runs_tomorrow = true;
      else
        var cycle2_runs_tomorrow = false;

      var time_now = states['sensor.time'].state;
      var cycle1_schedule_enabled = states['input_boolean.irrigation_cycle1_schedule_enabled'].state;
      var cycle2_schedule_enabled = states['input_boolean.irrigation_cycle2_schedule_enabled'].state;
      var cycle1_start_time = states['input_datetime.irrigation_cycle1_start_time'].state.substr(0, 5);
      var cycle2_start_time = states['input_datetime.irrigation_cycle2_start_time'].state.substr(0, 5);
      var cycle1_name = states['input_text.irrigation_cycle1_name'].state;
      var cycle2_name = states['input_text.irrigation_cycle2_name'].state;
      var cycle3_name = states['input_text.irrigation_cycle3_name'].state;

      var cycle1_running = states['input_boolean.irrigation_cycle1_running'].state;
      var cycle2_running = states['input_boolean.irrigation_cycle2_running'].state;
      var cycle3_running = states['input_boolean.irrigation_cycle3_running'].state;

      if (cycle1_running == 'on')
        return cycle1_name + ' cycle';
      else if (cycle2_running == 'on')
        return cycle2_name + ' cycle';
      else if (cycle3_running == 'on')
        return cycle3_name + ' cycle';
      else if (cycle1_schedule_enabled == 'on' && cycle1_runs_today && cycle1_start_time > time_now)
          return cycle1_name + ' cycle at ' + cycle1_start_time;
      else if (cycle2_schedule_enabled == 'on' && cycle2_runs_today && cycle2_start_time > time_now)
          return cycle2_name + ' cycle at ' + cycle2_start_time;
      else if (cycle1_schedule_enabled == 'on' && cycle1_runs_tomorrow)
          return 'Tomorrow at ' + cycle1_start_time;
      else if (cycle2_schedule_enabled == 'on' && cycle2_runs_tomorrow)
          return 'Tomorrow at ' + cycle2_start_time;
      else return 'NOTHING SCHEDULED';
  ]]]
label: |
  [[[
    var cycle1_running = states['input_boolean.irrigation_cycle1_running'].state;
    var cycle2_running = states['input_boolean.irrigation_cycle2_running'].state;
    var cycle3_running = states['input_boolean.irrigation_cycle3_running'].state;

    if (cycle1_running == 'on')
      return 'RUNNING: ';
    else if (cycle2_running == 'on')
      return 'RUNNING: ';
    else if (cycle3_running == 'on')
      return 'RUNNING: ';
    else
      return 'NEXT RUN: ';
  ]]]
styles:
  grid:
    - grid-template-areas: '"l n clash_icon warning"'
    - grid-template-columns: min-content min-content 10% 1fr
    - grid-template-rows: 1fr
  card:
    - font-family: |
        [[[
          return states['input_text.irrigation_ui_font_family'].state
        ]]]
    - background: none
    - box-shadow: none
    - padding: 0.3em 0em 0em 0.5em
  name:
    - justify-self: start
    - align-self: start
    - padding: 0em 0.5em
    - color: |
        [[[
          if (states['input_boolean.irrigation_master_control_switch'].state == 'off')
            return 'rgb(255, 165, 0)';
          else
            return 'var(--secondary-text-color)';
        ]]]
  label:
    - color: var(--primary-text-color)
    - justify-self: start
    - align-self: start
  custom_fields:
    clash_icon:
      - padding: 0em 0.5em
      - color: |
          [[[
            switch(states['binary_sensor.irrigation_cycle_start_clash'].state) {
              case 'on':
                return 'rgb(255, 165, 0)';
              case 'off':
                return 'transparent';
            }
          ]]]
    warning:
      - color: 'rgb(255, 165, 0)'
      - justify-self: end
custom_fields:
  clash_icon: |
    [[[
      return '<ha-icon icon="mdi:alert-rhombus-outline"></ha-icon>';
    ]]]
  warning: |
    [[[
      switch(states['input_boolean.irrigation_master_control_switch'].state) {
        case 'off':
          return '';
        case 'on':
          if (states['input_boolean.irrigation_testing_mode'].state == 'on')
            return '(Testing Mode is On)';
      }
    ]]]
default_color: var(--primary-text-color)
color_off: var(--paper-item-icon-color)
color_on: var(--paper-item-icon-active-color)
lock:
  enabled: false
  duration: 5
  unlock: tap

I also created this template sensor, but this is not fixing the issue.

############## SWITCHES #############   
switch:
  - platform: bhyve
####Switch for Irrigation Inegration
  - platform: template
    switches:
     zone1_valve:
        value_template: "{{ is_state('switch.front_main_zone_2', 'on') }}"
        turn_on:
          service: switch.turn_on
          data:
            entity_id: switch.front_main_zone_2
        turn_off:
          service: switch.turn_off
          data:
            entity_id: switch.front_main_zone_2

Did you ever get to fix your issue? I am stuck at the same issue. binary_sensor.irrigation_cycle_start_clash

What timezone is needed? I hope i can use mine

Fairly confident it should work with any timezone, but you will need to have the timezone set correctly in HA, else it will start randomly.

I think that some of the entities will hang around. Probably need to do a search (after deleting everything) in the developer tools. Also probably worth checking for automations it may generate too (not sure if it does or not, but worth checking).

As someone mentioend above, check your timezone is correct too.

This is real odd - is the error only for zone 9, or does it extend to 16?

I’ll be using a sonoff 4ch pro r3 for this setup.

Can someone please post the esphome yaml they are using.

I’m pretty new to home assistant and esphome so any help would be much appreciated.

Thanks

My time zone was set to UTC as standard, but I live in Poland. I had a good time, but a bad time zone. After changing the time zone to Poland, the schedules started working.
Unfortunately, the length of the schedule is always zero. But that is not the most important thing for me.

Will someone tell me how to program a physical button connected to tasmota to turn on and off the manual schedule? The yaml language is still a mystery to me.

EDIT: Sorry, in my haste I replied to war1000. This should be a general post.


A quick note here that might point to some of the current issues.

I have found that the change to allow more than 8 zones introduced an unexpected bug.
I think at least the following is true: If you have ever reduced the number of cycles from more than 10 the total duration for that cycle will be wrong.

The reason is the group of zones that is created will still include the unused zones as the sensors still exist. The total will only use the correct number of zones in it’s calculation and because of the way the group gets sorted will add up to the wrong total. I hope that makes sense…

There are a couple of ways I can think of to fix this. Probably the best will be to rename all single digit zones to have leading zeros and then sort the group explicitly but that might involve quite a few changes.

I definitely won’t have time to fix this today; maybe tomorrow (but no promises)


As I write this it occurred to me that reversing the sort might work.
If anyone wants to try in my absence then in the files garden_globals_cycle1/2/3.yaml look for the line

{% set durations = expand('group.irrigation_group_cycle1_zone_durations') | map(attribute='state') | map('int') | list %}

and change it to

{% set durations = expand('group.irrigation_group_cycle1_zone_durations') | map(attribute='state') | map('int') | list | sort(reverse=true) %}


In case it helps explain what I think the issue is here is a screenshot to try and explain.

1 Like

After these changes, the finish time is well estimated. It works. Excellent thank you very much.

Hmm i miss the wifi Card. Nothing shows up there where it should be. Could this be the problem?

Edit: Not, that does not solve the problem… Sadly now i have to switch to another iririgation system because it will not run :frowning:

There is not a lot out there. This would be perfect but it doesn’t help when its not starting the cycles :smiley:

I’ll have a look here but i need to check what irrigation unlimited can do for me…

Thanks so far…

Have you tried this:
Hello. I just found why in my case it was skipping schedules, it was the “Ignore schedules if it is raining” that was on, just turn it to off and the schedules work. I haven’t configure the rain sensor and even with the “Adjust for rainfall” set to off it didn’t start. To prevent this maybe the “Ignore schedules if it is raining” should only work with real value (raining true or false) and if it is not configured the status should be unknown and skip this.
Regards

EDIT: It made no sense (to me) to keep this entirely separate so it is now set up from within the normal UI, the extra view isn’t needed. It should make no difference to anyone who isn’t using it except for a new option in the General Settings to turn the remote control on and off.

You set a remote control duration by clicking in a zone. It will only show the remote duration if you have it turned on.

Yes I know, none of this is documented and the readme is getting seriously old and out of date. One day I might have a go at some proper docs…


For anyone that is interested, I just uploaded a single yaml file that I use to run various zones on demand using a cheap four button 433MHz remote control. (It also uses an extra view in Lovelace to set the durations).

Remote control durations are set on the new view and when triggered all of the Cycle3 settings are saved in a scene before the requested zones are run. Then Cycle3 is restored to how it was.

It is uploaded for your reference only - It WILL need to be tailored to your own needs.
But I hope it might be useful for someone.

We use it a lot :slight_smile:

Yes, I have it working.

Anyway you can share your code?

Thanks

Thank you very much,

Maybe I can find the answer to my question. I’m learning slowly, but I hope to learn yaml soon.
You really helped me a lot and encouraged me to use Home Assistant.

Thanks and a virtual beer for you

After switching to the latest version, cycles are always 6, 4 or 5 minutes long. No matter what I put in the schedule settings.
Unfortunately, I had to go back to the previous version.

Sure:

esphome:
  name: esphome_irrigation_controller
  platform: ESP8266
  board: esp8285

substitutions:
  friendly_name: ESPHome Irrigation Controller

wifi:
  ssid: "SSID"
  password: "password"
  ap:
    ssid: "Esphome Irrigation Controller"
    password: "password"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

web_server:
  port: 80


binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "zone 1 button"
  - platform: gpio
    pin:
      number: GPIO9
      mode: INPUT_PULLUP
      inverted: True
    name: "zone 2 button"
  - platform: gpio
    pin:
      number: GPIO10
      mode: INPUT_PULLUP
      inverted: True
    name: "zone 3 button"
  - platform: gpio
    pin:
      number: GPIO14
      mode: INPUT_PULLUP
      inverted: True
    name: "zone 4 button"
  - platform: status
    name: "ESPHome Irrigation Controller Status"

switch:
  - platform: gpio
    name: "zone 1 valve"
    pin: GPIO12
    id: relay1
    restore_mode : ALWAYS_OFF
    interlock: &interlock_group [relay1, relay2, relay3, relay4]
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe
  - platform: gpio
    name: "zone 2 valve"
    pin: GPIO5
    id: relay2
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe
  - platform: gpio
    name: "zone 3 valve"
    pin: GPIO4
    id: relay3
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe
  - platform: gpio
    name: "zone 4 valve"
    pin: GPIO15
    id: relay4
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe
      
  - platform: restart
    name: ${friendly_name} Reboot
    id: reboot

output:
  # Register the blue LED as a dimmable output ....
  - platform: esp8266_pwm
    id: blue_led
    pin: GPIO13
    inverted: True

light:
  # ... and then make a light out of it.
  - platform: monochromatic
    name: "EspHome Irrigation Controller Blue LED"
    output: blue_led
    
sensor:      
  - platform: wifi_signal
    name: Irrigation Controller Wifi Strength
    update_interval: 60s
  - platform: uptime
    name: Irrigation Controller Uptime
    filters:
    - lambda: return x / 60.0;
    unit_of_measurement: minutes
  - platform: homeassistant
    id: failsafe_time
    name: ${friendly_name} Failsafe Time
    entity_id: input_number.irrigation_failsafe_time_in_seconds
    
    
#=== Scripts
script:

  #=== Set failsafe time converted to milliseconds
  - id: failsafe
    then:
      - delay: !lambda |-
          return id(failsafe_time).state * 1000;
      - switch.turn_off: relay1
      - switch.turn_off: relay2
      - switch.turn_off: relay3
      - switch.turn_off: relay4