My Garden Irrigation

Ok, this is also something for the readme!

The notification is sent in the scripts,

irrigation_notify_irrigation_start and
irrigation_notify_irrigation_end

I have a script called ‘notify’ that handles all my notifications so the parameter tell is the name of the person that gets the Telegram message.

You should be able to easily change the two irrigation notify scripts to suit whatever you use. Instead of calling script.notify just use whatever messaging service you like. the message itself will not change.

1 Like

from what I understood reading the garden_notification file is that notifications are sent when cycle 1 or 2 starts or ends but only when the “holiday” mode is activated, how is this activated? if I always wanted to send them?

Just remove the condition,

  - alias: Irrigation Notify About Irrigation Events When On Holiday
    trigger:
      - platform: state
        entity_id:
        - input_boolean.irrigation_cycle1_running
        - input_boolean.irrigation_cycle2_running

    condition:
      - condition: state
        entity_id: binary_sensor.holiday_mode
        state: 'on'

I thought the implementation was more complicated. Now work, but I don’t find any “holiday_mode” in the package.

I can’t understand why I get this error, the valves open but don’t close.


What do you get if you put the template in the Dev Tools Template page?

This, it’s right! But the don’t work

You have two ‘unknown’ switches.
I think that might be stopping it work.

If that I am right then you need to remove

input_text.irrigation_zone7_switch_entity_id and
input_text.irrigation_zone8_switch_entity_id

from `garden_globals_zones.yaml

Or you can try replacing the loop with this:

{% for switch_name in states.input_text if switch_name.object_id.startswith('irrigation_zone') and
                                           switch_name.object_id.endswith('switch_entity_id') -%}
  {% if states(switch_name.entity_id) != 'unknown' or
        states(switch_name.entity_id) != 'none' -%}
    {{ 'switch.irrigation_dummy_switch' ~ loop.index }}
  {%- else %}
    {{ states(switch_name.entity_id) }}
  {%- endif %}
  {%- if not loop.last %}, {% endif %}
{%- endfor %}

Which might also fix it as it will always return a valid list of switches even if they don’t exist.

So, I tried this template and there is the result, which does not seem correct.

So, I create this new template:

{% for switch_name in states.input_text if 'switch_entity_id' in switch_name.entity_id 
              and states(switch_name.entity_id) != 'unknown' and states(switch_name.entity_id) != 'none' -%}
    {{ states(switch_name.entity_id) }}
    {%- if not loop.last %}, {% endif %}
{%- endfor %}

and, this is the result:


But by running the cycle without adjusting it to the conditions, the valves do not turn off.

In the log I get the error:

  • Irrigation System Reset: Error executing script. Invalid data for call_service at pos 2: not a valid value for dictionary value @ data[‘entity_id’]

Sorry that is a typo left over from my testing…
Should be…

            {% if states(switch_name.entity_id) == 'unknown' or
                  states(switch_name.entity_id) == 'none' -%}

Regarding PulseTime.

I have just seen this thread which shows how to use a PulseTime equivalent in ESPHome. This means I will be removing the use of a Sonoff switch to power the the ESP32 and Relay Board as it looks like it is not necessary.

If by any chance this will cause you a problem I suggest you make sure you have a copy of the code that uses the Sonoff before I remove it.

hi @klogg, these days I have solved many things and now it works, I have also added pulsetime in each valve. Today, however, I get this error that I can’t solve, I found a post where it happened to you, how did you solve it?

Hi @klogg,
I’m using your garden irrigation (v1 - as i understand) since last summer and it worked flawlessly - so thanks a lot for making my garden and wife happy :wink:
One of the last HA updates seems to have broken one tiny bit of the configuration, resulting in the following error.
When starting one of the cycles, “Zone being watered” will switch to “Initialising…” and remains there without switching pump or valves.

Log Details (ERROR)
Logger: homeassistant.components.automation
Source: helpers/service.py:378
Integration: Automation (documentation, issues)
First occurred: 9:03:11 PM (2 occurrences)
Last logged: 9:03:11 PM

Irrigation Failsafe - master control switch: Error executing script. Unexpected error for call_service at pos 1: 'switch.zone1_valve'
Irrigation Failsafe - HA start: Error executing script. Unexpected error for call_service at pos 1: 'switch.zone1_valve'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 154, in _async_step
    self, f"_async_{cv.determine_script_action(self._action)}_step"
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 624, in _async_call_service_step
    *self._prep_call_service_step(), blocking=True, context=self._context
  File "/usr/src/homeassistant/homeassistant/core.py", line 1232, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1255, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 86, in async_handle_turn_service
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/core.py", line 1232, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1255, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 378, in entity_service_call
    entity_ids.remove(entity.entity_id)
KeyError: 'switch.zone1_valve'

I followed the changes for 0.103 posted by @Barmalej, haven’t touched anything in the configuration since last summer - sadly the error remains ;-(

Is there perhaps another change, i have missed?
Thanks in advance!!

Not that I am aware of and I am still using v1 until I have v2 finalised (mostly waiting to configure the hardware).

Your error seess to be pointing to the failsafe scripts which is a bit strange if you say it is happening when you try to runa cycle. Also the last line of the error log is
KeyError: 'switch.zone1_valve'

I am not sure exactly what that means but I assume your switches still have the same names?

I don’t recognise the error. Can you link the post where I had it so that I can remind myself?

this: Stack-In-Card: Drop-in replacement for vertical-stack-in-card - #82 by klogg

Ah yes…
I never found a solution and RomRider advised that it was nothing he could fix. It wasn’t actually causing any problems except to generate the error and only when I did a refresh.

What version of HA are you on? I don’t recall seeing that error recently so maybe it was fixed in 108?
(Although I may just have not noticed the error in my log)

I’m running Hassio 108.5, but this error also occurs on 108.4. it arrived so suddenly this morning and I can’t understand how to solve it

The problem is that error cause this:

What version were you on before 108.4?
I am on 108.3 and it seems to work ok for me.

I wonder if something changed between 108.3 and 108.4?

i didn’t know what to do, i took another sd and i restored the backup two days ago when i didn’t have this problem, it was on 108.3 and it worked. Then I updated to 108.5 and it worked anyway. In my opinion something had become corrupt, but I don’t know

That sounds very strange indeed.
Let me know if it happens again.

For the record, I still get the error in the log if I refresh as per the original post but it doesn’t seem to be causing me any problems.

At some point I might look into it a bit deeper and see if I can rework the Lovelace yaml to stop it happening.