My Garden Irrigation

I use the BOM service, but i cant get the forecast chance of rain bit. are you able to help with that code.

also I found there are 4 input_boolean that are not set and are not visible, by displaying them and flicking it to on the script worked.

input_boolean.retic_program1_start_time1_enable
input_boolean.retic_program1_start_time2_enable
input_boolean.retic_program2_start_time1_enable
input_boolean.retic_program2_start_time2_enable

Which BOM integration are you using? I’m using the custom_component. You can find it in HACS.

These are in my Lovelace code however you need the custom card to display them. ‘Lovelace multiple entity row’, also in HACS

Love the code - thanks very much KLOGG!!

I’ve altered the code slightly (i’ve 3 values) but i think i found 2 issues -
One, when i schedule for anything other than 00 minutes, it doesn’t schedule i.e. if i schedule for 05:30 - it doesnt work, but if i go for 05:00 it does. Manual runs are fine. I’ve not been able to work it out, potentially its just my setup.

Also,
I’ve noticed on a run where it uses adjustments, its using the same duration for each zone in the cycle (zone 1).
I think this is due to garden_irrigation.yaml - lines 458 to 468. Its hard coded to zone1. I’ve not double checked this but it looks like its incorrect.
Having said that, i feel like i have seen it complete durations as per frontend values for scheduled.
(for definite, i’ve seen a scheduled run with adjusted values ran zone1 durations for all zones)

thanks again for sharing an awesome project,
Cheers

I’m glad you like it.

Yes, strange as it may seem I think it must have been designed like that. Not because I would have thought it was a good design but I think as I was new to HA I wanted to keep it fairly simple and decided I would never care if my irrigation could only run only on the hour (remember I never even considered at that time that anyone else would be using it). It wi

You are absolutely right!
It’s deepest winter here so I won’t be testing it for a while but I am pretty sure those lines should be:

{% if is_state('input_boolean.cycle' + cycle + '_use_weather_adjustment', 'on') %}
  {% set adj_duration = states('input_number.adjusted_cycle + cycle + '_zone' + zone + '_duration') | float %}
  {% set mins = (adj_duration // 1) | round(0, floor) %}
  {% set secs = ((adj_duration - mins) * 60) | round %}
  00:{{ '%02i' | format(mins) }}:{{ '%02i' | format(secs) }}
{% else %}
  {% set duration = states('input_number.adjusted_cycle + cycle + '_zone' + zone + '_duration') | float %}
  {% set mins = (duration // 1) | round(0, floor) %}
  {% set secs = ((duration - mins) * 60) | round %}
  00:{{ '%02i' | format(mins) }}:{{ '%02i' | format(secs) }}
{% endif %}

You are every welcome :slight_smile:

1 Like

After updating to 0.103, an error appears in the log and watering does not turn on.
Error:

[homeassistant.components.script] Error executing script script.irrigation_run_a_cycle. Unknown error for call_service at pos 4:
...
...
TypeError: can only concatenate str (not "int") to str

To make it work again, you need to make changes to the garden_irrigation.yaml file:
Lines 93 and 97

cycle: 1

to

cycle: '1'

Lines 119 and 123

cycle: 2

to

cycle: '2'

Line 348

zone: 1

to

zone: '1'

Line 357

zone: 2

to

zone: '2'

Line 366

zone: 3

to

zone: '3'

Line 375

zone: 4

to

zone: '4'

Line 384

zone: 5

to

zone: '5'
1 Like

Interesting…
I wonder if that is that documented as a breaking change?

EDIT: I’ve asked the question, 0.103 - Undocumented Breaking Change?

@sparkydave

I am planning on expanding my system to eight zones and I think I would like to go down a similar hardware route to you.

Do you by any chance have a schematic showing the connections in more detail?

And also if anyone else is reading this, I am sure someone put a really good description of their implementation using an 8 relay module somewhere but I can’t find it now…

I don’t have one drawn up but I can put together a little sketch for you. It’s pretty simple. I’ll try and get something done soon and post here

1 Like

sorry for the delay, I’m putting together a diagram today. Will hopefully have it uploaded soon…ish

EDIT: here is a sample of how it’s done, simply add more wiring to the extra relays as required.

Bare in mind the following rules:

Additionally, I used a single 24Vac power supply for my system and then used a combination of a bridge rectifier and a DC-DC converter to get the 5Vdc supply rather than using 2 separate supplies. Either way will work.

There is also another option for controlling relays from an ESP and that is to use an I2C interface. You can buy I2C relay boards and ESPhome has config options to control them. This would be handy if you start running out of GPIO on the ESP or want to save some for inputs etc.

4 Likes

No worries, thanks for doing this, I appreciate it.
I’ve got an ESP32 Devkit which I think has enough GPIOs to run eight relays, I’ll just need to read up on which are the best ones to use.

…and now the obligatory followup questions :wink:

First and most easily, I keep seeing these nice diagrams. I assume a website is used to create them?
Also I really like the idea of only having one power supply. Would you mind linking to an example bridge rectifier and DC-DC converter?

The link “rules” that I had in my post will take you to the ESP8266 stuff but that same site has a similar page for the ESP32. Its a great resource

1 Like

I just did that diagram in MS Word using images from Google and some lines drawn on.

I’ll post some links to what I purchased when I’m back on a PC

1 Like

The bridge rectifier I used was chosen purely because I already had it in my shed, otherwise I would have used a smaller one.

Bridge rectifier:

DC-DC converter:

1 Like

Similar idea to what I’m slowly working on. Although I got a 12v relay board and a 12v>5v converter for my EPS8266. Was working well, until I discovered that my test solenoid is 24v, though it works with 12v. So now I’m looking to get a 24v>12v converter. LOL.

I have upgraded to Hassio 0.104.3 . And now garden not run, it gives me this error:
Error executing script script.irrigate_a_zone. Unknown error for condition at pos 1:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/script/init.py”, line 204, in async_turn_on
await self.script.async_run(kwargs.get(ATTR_VARIABLES), context)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 189, in async_run
await self._handle_action(action, variables, context)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 272, in _handle_action
await self._actions[_determine_action(action)](action, variables, context)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 410, in _async_check_condition
check = config(self.hass, variables)
File “/usr/src/homeassistant/homeassistant/helpers/condition.py”, line 387, in template_if
return async_template(hass, value_template, variables)
File “/usr/src/homeassistant/homeassistant/helpers/condition.py”, line 367, in async_template
value = value_template.async_render(variables)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 221, in async_render
return compiled.render(kwargs).strip()
File “/usr/local/lib/python3.7/site-packages/jinja2/asyncsupport.py”, line 76, in render
return original_render(self, *args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/usr/local/lib/python3.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/usr/local/lib/python3.7/site-packages/jinja2/_compat.py”, line 37, in reraise
raise value.with_traceback(tb)
File “”, line 1, in top-level template code
TypeError: can only concatenate str (not “int”) to str

I can’t be sure but I think you are running an old version of the code. There is no script called irrigate_a_zone anymore. I think I renamed them all to accommodate the master control and failsafe scripts.

This error is about having an int when it needs a str (or vice versa).

What version of HA did you upgrade from?

I am not using this system at the moment as it is deep winter here but as far as I know the version on GitHub works. Maybe someone else who is using it can confirm or deny that?

I am thinking of writing a whole new version before the summer, partly as I’m changing all the hardware I use and partly to see if I can do it better than I did first time round now that I know more about HA.

I have install new version of your garden but now the problem is the script “irrigation_irrigate_a_zone”…

I just looked on GitHub and I last uploaded the code in September 2019 which is after the summer here throughout which time I used it constantly with no problems.

I’m not sure I can think of any reason it doesn’t work for you unless ether,

  • you have made some changes which introduced a problem, or conversely,
  • you haven’t made any changes that you needed to make in order to make it fit in with your specific setup.

As I said I am planning a complete re-write in the next few weeks so whilst I am more than happy to help with any specific questions I don’t really want to spend time in detailed debugging of your config.

i think that My Garden Irrigation is that what do you need

Hi klogg
You did not update github version after HA update 0.103.