My Garden Irrigation

Thanks, tried follow the tutorial and when i include the package in the code and the theme, but when i save the code and see if is correct in verfication of the server i do nothing.

#################################################################
## Home Assistant - Core Configuration
#################################################################

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

homeassistant:
  
  packages: !include /config/packages/my_package

browser_mod:

lovelace_gen:

lovelace:
  mode: yaml

frontend:
  themes: !include /config/themes/

lovelace:
  mode: yaml
  resources:
    - type: module
      url: browser_mod.js
    - type: module
      url: /hacsfiles/mini-graph-card/mini-graph-card-bundle.js
    - type: module
      url: /hacsfiles/lovelace-card-mod/card-mod.js
    - type: module
      url: /hacsfiles/button-card/button-card.js
    - type: module
      url: /hacsfiles/config-template-card/config-template-card.js
    - type: module
      url: /hacsfiles/lovelace-layout-card/layout-card.js
    - type: module
      url: /hacsfiles/lovelace-state-switch/state-switch.js
    - type: module
      url: /hacsfiles/lovelace-hui-element/hui-element.js
    - type: module
      url: /hacsfiles/lovelace-time-picker-card/time-picker-card.js
    - url: https://fonts.googleapis.com/css?family=Oswald
      type: css
    - url: https://fonts.googleapis.com/css?family=Dosis
      type: css. ```

Hi Robrtofz1981,

I’m not an expert at reading yaml and my config looks a little different from what’s posted at a quick glance I can see you have defined Lovelace twice

maybe hash out the first one and see if that makes a difference

#lovelace:
 # mode: yaml

frontend:
  themes: !include /config/themes/

lovelace:
  mode: yaml
  resources:
    - type: module
      url: browser_mod.js
    - type: module
      url: /hacsfiles/mini-graph-card/mini-graph-card-bundle.js
    - type: module
      url: /hacsfiles/lovelace-card-mod/card-mod.js
    - type: module
      url: /hacsfiles/button-card/button-card.js
    - type: module
      url: /hacsfiles/config-template-card/config-template-card.js
    - type: module
      url: /hacsfiles/lovelace-layout-card/layout-card.js
    - type: module
      url: /hacsfiles/lovelace-state-switch/state-switch.js
    - type: module
      url: /hacsfiles/lovelace-hui-element/hui-element.js
    - type: module
      url: /hacsfiles/lovelace-time-picker-card/time-picker-card.js
    - url: https://fonts.googleapis.com/css?family=Oswald
      type: css
    - url: https://fonts.googleapis.com/css?family=Dosis
      type: css. ```

If I’m giving incorrect advice please pick me up as I’m still getting my head around home assistance

Thanks

1 Like

It’s possible you share your configuration file with me and the folder structure? My email is [email protected].

Hi All,

Further to my earlier post, I was going over the logs and found the following

Logger: homeassistant.components.automation.irrigation_triggered
Source: components/automation/__init__.py:395
Integration: Automation (documentation, issues)
First occurred: 10:37:26 PM (1 occurrences)
Last logged: 10:37:26 PM
Error rendering variables: UndefinedError: 'dict object' has no attribute 'now'

I’m thinking this could be the reason why my weekday and weekend schedules are not working as intended

Any ideas on how to solve this?

Thanks, Nick

Hi Robertofz1981,

I have sent you an email, one with the config and the other with screenshots, hopefully this helps

Thanks, Nick

hey @cjj sorry for my late replay. My component (Smart Irrigation - save water by precisely watering your lawn/garden) calculates evapotranspiration, and that can take either weather forecasts, actual sensor measurements or any mixture of those.

HA newb here I setup all perquisites but now am lost as to what to do next. I am using hass.io and installed everything via hacs I can see the .yaml files in file editor but dont know how to apply the changes setup lovelace etc. Is there a guide for getting from prerequisites to working setup

Hassio verson 0.118.2

Have any of you had the problem of irrigation starting on the correct time but not on the correct day selected? I had Mondays wednesdays and Fridays selected however this morning saw the garden has been watered.

Any ideas please?

@nixdat

Question - Is your setup watering on the days you select?

If yes, perhaps a lenghty request. Can you tell me which HA version you are on as well as the versions of the HACS integrations please?

Hi IrishInsani Ty,

@IrishInsaniTy

Sorry but I too have the same issue.

I’ve tried to set my irrigation cycle to start 1 hour before sunset and 1 hour after sunset every day but it doesn’t work the watering cycles won’t turn on. I’ve spent a few weeks trying to resolve this out, but as my coding skills are minimal, I’m still working through this. I did find the following in the logs which may explain why the automatic schedules are not starting as required, but as of yet I have not found a solution

2020-11-21 17:09:00 ERROR (MainThread) [homeassistant.components.automation.irrigation_triggered] Error rendering variables: TypeError: 'datetime.datetime' object is not callable

I’m thinking this error is related to the ‘garden_irrigation_tiggered.yaml’ file where there is a variable set which calls the time but it seems the variable is not liked

  - alias: Irrigation Triggered

    variables:
      trigger_time: "{{ trigger.now().strftime('%H:%M:00') }}"

Maybe someone with more experience then I might be able to shed some light on the issue

I’m currently running the latest version of Hassio

Thanks, Nick

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.