My Garden Irrigation

Would you mind doing the same for
me please? I’m missing something obvious, when I click on irrigation, nothing happens at all.

Would appreciate having a working config to compare to.

Nevermind, I sorted.
If you copy and paste from the translated Italian instructions, then some of the code gets corrupted.

Read the page in English, the convert back to Italian to copy the code, the paste into where it needs to go.

Any help as to why the run times aren’t displaying correctly?

Also, when I manually run cycle 3, it will water as expected, but still not show a total run time.

When using the automatic cycles, it comes on for about a second and switches off again.

Thanks for all the work, Kloggy!

Sorry I’m trying these days to switch to version 2.0 and I’m running into the same error as Itajackass but in the file “item_settings_controller_wifi_signal.yaml” that you suggest to replace the string you indicated is not present and to be more precise I can’t even find the old ie “state_display:” [[[return entity.state == ‘unavailable’? ‘unavailable’: entity.state; ]]] “” do you have any suggestions?

Hello @klogg
Really GREAT project. I’ve setup it correctly, now I’ve a rainfall sensor and a temperature sensor I would use with it but cannot find out where to configure it.
Could someone point me to the right place?
—OK— Sorry, found…
BTW after setting temperature sensor and rain sensor I’ve got layout issues, without doing nothing:

ButtonCardJSTemplateError: TypeError: Cannot read property 'state' of undefined in 'if (states['input_boolean.irrigation_master_control_switch'].state == 'off') return 'SYSTEM IS...'

AND

ButtonCardJSTemplateError: TypeError: Cannot read property 'state' of undefined in 'var statestr = (entity === undefined || entity.state === undefined) ? 'undefined' : entity.state; ...'

Ideas?

Then, the raining sensor is a contact sensor, which is OFF in case of sunny day and ON in case of RAIN. Would be that OK?

Thanks a lot!
Simon

Hello, ok, I’ve found the issue as soon I’ve set up the raonfall sensor. Reverting to defaut, the gui is correct again. What kind of rainfall sensor is expected on the system?

I’ve converted a contact sensor (Xiaomi) connecting to a rainfall sensor to define if it’s raining, i.e. if the contact is closed, there is no rain, if there is rain, the contact is open.

Could it be implemented?

Thanks!

Simon

Hello, thanks @klogg great project.
Finally i made all setup, now i`m trying integrat with accuweather, somenome have done this?

cumps

Would somebody please help me out…?

I’ve been trying to get this going on and off for a few weeks now, and I was hoping that now that my Sonoff 4CH is connected up that the issue would go away, but it hasn’t.

With all cycles off, I get this and everything looks normal:

However, when I turn a cycle on, I get this red card most of the time:

I’ve selected the zone switches here:

I can see my controller signal strength here:

image

This is a copy of the code in the red card

ButtonCardJSTemplateError: TypeError: Cannot read property 'state' of undefined in 'if (states['input_boolean.irrigation_master_control_switch'].state == 'off') return 'SYSTEM IS...'
tap_action:
  action: |
    [[[
      if (states['binary_sensor.irrigation_cycle_start_clash'].state == 'on')
        return 'call-service';
      else
        return 'none';
    ]]]
  service: browser_mod.popup
  service_data:
    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.
    deviceID:
      - this
    style:
      $: |
        .mdc-dialog {
            backdrop-filter: blur(5px);
          }
        .mdc-dialog .mdc-dialog__container .mdc-dialog__surface {
            border-radius: 1em;
            box-shadow: 0em 0em 0.5em;
          }
          
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;
      else if (cycle2_running == 'on')
        return cycle2_name;
      else if (cycle3_running == 'on')
        return cycle3_name;
      else if (cycle1_schedule_enabled == 'on' && cycle1_runs_today && cycle1_start_time > time_now)
          return cycle1_name + ' at ' + cycle1_start_time;
      else if (cycle2_schedule_enabled == 'on' && cycle2_runs_today && cycle2_start_time > time_now)
          return cycle2_name + ' 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

This is my sonoff esphome yaml

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

switch:
  - platform: gpio
    name: "Zone Relay 1"
    pin: GPIO12
  - platform: gpio
    name: "Zone Relay 2"
    pin: GPIO5
  - platform: gpio
    name: "Zone Relay 3"
    pin: GPIO4
  - platform: gpio
    name: "Zone Relay 4"
    pin: GPIO15

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: ESPHome Irrigation Controller Wifi Strength
    update_interval: 60s
  - platform: uptime
    name: ESPHome Irrigation Controller Uptime
    filters:
    - lambda: return x / 60.0;
    unit_of_measurement: minutes

Sorry for the long post, I’m just stuck and don’t know where I’ve gone wrong.
I’d really appreciate some help here, I’m at loss of where to start looking.

it is the same problem that I have, I presented the problem a few posts higher but I have not received help yet, we hope that someone can help us

1 Like

Looks like there’s a bug in the code or some incompatibility with newer HA versions.
I’ve tried everything to get this working and posted a few times with no response.
Oh well.

It’s possible…

But I am really sorry I have almost no time to spend on HA at the moment and probably won’t until the new year at the earliest.

I will look into this if I get any time and will certainly do so as a priority as soon as I am back spending ‘proper’ time on HA.

Sorry again.

(If it is a compatibility issue with a new version then I am sure someone else has seen it. And solved it??)

Just a really quick guess…

Have you tried restarting HA with the system ON?

image

There is some set-up done when HA restarts but if the system is ‘OFF’ the automations that do the setup are disabled.

This is something I need to address as it is a bug but the work around is to restart with the system ‘ON’.

Let me know if that is the issue here…

1 Like

I’ll give it a try, but most of the time I have restarted HA with System ON anyway.
I have noticed that the red box on the left more often appears as soon as I enable the MORNING cycle (but not always) Refreshing the page sometimes makes it go away. But scheduling never works.
I.e. I can set a start time of 08h00 and it will not trigger.
However, if I set a start time for the EVENING cycle, it works as expected, though the “Will end about” time is always wrong.

Also, the time in “Will end about” is always the same as the start time, if that helps.
I checked and I do have sensor.time and sensor.time_date in my config.

Thanks Klogg, I appreciate your time.

Hello someone have telegram working with this?

Hi everyone,
is it possible to create a Blueprint from it?

Yes it’s listed in the prerequisites under notifications HA-Irrigation-Version2/Pre-Requisites_Read_Me.md at 18168f843e0eee4849dc841be5fc48829b9efaaa · kloggy/HA-Irrigation-Version2 · GitHub and it works for me using that setup.

1 Like

Would any of you that are successfully running this without issues please post your HA versions?

I absolutely cannot get it running properly and need to know if it’s me, or the fact that my HA install is running too new a version that is currently incompatible.

Hi i am running 2020.12.1 and it seems to be running fine in test mode, it’s not in production mode due to being winter here in the UK and no need to have it running, my irrigation system has been winterised but i can hear my relays switching as it should do.

Not sure what your issue is but if you post up what is actually wrong i’m sure the kind people on hear will help as much as they can.

Oh, I have… further up but no-one has suggested anything.

OK i understand now, when i had that problem due to issues when i was splitting up my configuration.yaml, i could not work out why it was not loading like your issue, once i checked my config etc i realised that i did not include my sensors.yaml, which contains prerequisites that needed to be loaded separately in the sensor.yaml, and not in the package / lovelace.

anyway do you have the date and time sensor and irrigation weather outlook sensor in your sensor.yaml ? if not include those and it should then work, hopefully this should solve your issue and worth a try.

i just tried to trouble shout the above and can replicate the issue that i had, which is all back to normal now :slight_smile: