My Garden Irrigation

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.

Dear Klogg, I’m quite new on hass and meanwhile I had a need to Smart plug
my garden; i found your project very interesting.

I’ve installed the code on my Qnap Docker 0.65 and on Raspberry 0.108, I
found an error related to the automation
“following components and platforms could not be set up: automation”

Do you have the possibility to share the main config yaml
file (configuration. yaml / customize / groups)

to have a look either how you realize the beautiful user interface and to understand if I make some error on those main files ?
Thanks

I would also like to know how to implement it.
I guess it should be done by custom lovelace in configuration.yaml

lovelace:
mode: yaml

but what else should be there and where to place your folders in /config.

Thanks

@CHRIS_CC, @thoky,

If I understand your problems correctly you need to understand that this is a ‘package’. Packages are documented here. In a nutshell this allows you to keep everything to do with one function (in this case, Irrigation) in a seperate folder all of its own.

So in this case, once you have defined packages in your config (following the docs) it should be clear how everything in the folder packages/garden_v2 should be copied to your config. These files are the ones that do the ‘work’.

As for Lovelace, yes, I use mode: yaml.

It might not be clear but the views folder is for v1. (I will change the Github at some point to make that clearer.)

I hope that helps.

My case is not package. I am using v1 since last year and btw perfect code :+1:t3:
I have made all the cards manually and want to use your lovelace design now with v2. I am struggling how to do it. Where should I copy lovelace folder and what should I add under mode: yaml in configuration.yaml in order to work.

Thanks

To be honest it is hard for me to advise you regarding yaml mode in Lovelace. I have never used the UI to configure it so I am not sure how to convert.

It is documented here: https://www.home-assistant.io/lovelace/yaml-mode/ but I think you need to be careful if you currently use the UI and want to change to yaml mode so as not to spoil what you already have. As far as I know there is no reason why my Lovelace config can’t be added to a config created using the UI (but I could be wrong!).

I’d rather not offer guidance in case I tell you something wrong, but follow the docs and you should be ok.

Of course once you have it configured I will help if you have any specific questions.

I am sorry for going back to v1, but I have a question.
I have noticed, the script in entity_id: timer.cycle{{ cycle }}_zone_duration (garden_irrigation.yaml), lines 459 and 464 have cycle1 hardcoded.
like:

              {% set adj_duration = states('input_number.adjusted_cycle1_zone1_duration') | float %}

and

              {% set duration = states('input_number.cycle1_zone1_duration') | float %}

Shouldn’t it be converted to + cycle + to match selected cycle like in:

              {% set adj_duration = states('input_number.adjusted_cycle' + cycle + '_zone1_duration') | float %}

I am asking, but having an issue today, where I have run only cycle2 and Zone 1 set to 20 min, 2 to 10 min, 3 to 10 min and 4 to 10 min and I got the 1st one running for 10 min, 2nd for 10 min and then the valve was closed and timer was still going (from 20 min to 0), 3rd running for 30 min and 4th for 20 min.

I have no idea, what else could have caused that (I did not amend the code other than as I am asking above).

Yes, I you are right, this was first seen in December in this post here - My Garden Irrigation.

I’m not sure how that bug crept in to the code on Github. I never experienced it and even the person who found it wasn’t sure if it had always been there.

Sorry about that.

I will try to get around to changing it on gitHub tomorrow but what you are suggesting does seem to be correct.

Thank you for the immediate response and big thank you for preparing such a nic script.
I have decided to start with v1 to understand your logic, need to see tomorrow, why the counters run from 20 minutes, if they should do it only from 10. Any ideas are more than welcome.

I used a second dashboard for irrigation with yaml mode, but my default dashboard with storange Lovelace mode.