My Garden Irrigation

I don’t use GitHub in the way it is supposed to be used. I simple copy my config there whenever I make any changes. I have recently uploaded some new files that made a few minor coding improvements and improved the weather adjustments (which I now use and seem to work quite well). Also I discovered that the sonoff pulsetime settings weren’t correct if using weather adjustments. I don’t use the schedules unless I am on holiday so the last time I did that was early June and they worked well.

However as proved by the recent cock-up with the duplicate globals.yaml file that @Tjeerd found, my copying might not always have been perfect.

I will copy all my files up again so hopefully that will resolve any issues (wait a little while after this post for me to do it)…

EDIT: Files all uploaded.

I always use irrigation everyday. Yesterday i tried to set irrigation from EVERYDAY to ALTERNATE. UI tell me next irrigation day was 7 sept at 19:00 (it is right) … But today (6 sept) irrigation started at 19:00… Anyone this same problem?

Sorry, this got lost as I was away for a while.

I’ll be honest and say I have never used alternate days but I had a quick look and can see no reason why it didn’t work and whilst it was well over a year ago I am sure I must have tested it back then :wink:

Is it still a problem?

No problem. Now my system is off until next season :wink:

Same here. Speak to you next spring.
Have a good winter!
:slight_smile:

Sorry it’s taken so long, I have been crazy busy. Here are a couple of photos to show my hardware install. It’s simply a weatherproof enclosure with a 24Vac power supply, a bridge rectifier, a switchmode power supply, a NodeMCU and two dual channel relay boards. I mounted the PCB’s using nylon stand-offs to a sheet of galvanised steel, cutting out a section near the NodeMCU antenna to prevent shielding / interference.

The bridge rectified provides a DC voltage from the 24Vac power supply which is then fed into the switchmode PSU to give me 5Vdc for the NodeMCU and relay control.
The 24Vac is fed to the solenoids in the garden via the relay contacts.
Since I have a bore, one of the relays is controlling a contactor to start / stop the bore. This contactor has a 24Vac coil.

I hadn’t yet tidied up the wiring in these photos.


1 Like

No problem and thank you.
I hope you mind a few questions over the next few weeks if I have any…

Hi All

Im new to home assist and love all the possibilities.

I would like some advice on how to use this files within Hassio (Cloned it from site now im STUCK lol)

Hi Everyone,

I have downloaded @klogg all your files - it is awesome. Got the ESP32 code working, uploaded all the cards, put all the files into the package/garden directory etc. etc.

But I have seem to have an issue with one of the automation scripts. When I try to go to the overview screen all I get is a blank screen. In the log files I get this:

Log Details (ERROR)

Fri Oct 11 2019 22:51:21 GMT-0700 (Pacific Daylight Time)
Error while executing automation automation.irrigation_master_control_switch. Invalid data for call_service at pos 2: not a valid value for dictionary value @ data['entity_id]
helpers/script.py[ERRORS]

Looking at the code in garden_master_control_.yaml — I think there issue is near here:

  • alias: Irrigation Master Control Switch
    initial_state: ‘on’
    trigger:
    - platform: state
    entity_id: input_boolean.irrigation_master_control_switch
    - platform: homeassistant
    event: start

Not sure where to dig next?
Thanks in advance.

Also for me. Never digged inside the problem :slight_smile:

I just had a very quick look and the code is exactly the same as my local version which works. (Sometimes the GitHub version does get out of step with my local ‘production’ version. As I have said the GitHub version is only a snapshot in time for others to use and modify as fits their purpose).

Do you have the weather scripts in your config? Have you kept the names of the scripts the same as I wrote? The for will fail if there are no scripts with those name patterns (e.g. startswith('Irrigation - '), startswith('Irrigation Weather - ') which is possibly where your error is coming from?

Hi Klogg,

Thanks for responding so quickly. Yes - that particular set of lines were still active in garden_master_control.yaml.

So I commented out that particular data_template.

data_template:

entity_id: >

{% for item# in states[‘automation’] if item.name.startswith('Irrigation Weather - ') -%}

{% if not loop.first %},{% endif %}{{ item.entity_id }}

{%- endfor %}

Not sure if it will affect anything else at this point - but now I am NOT getting those errors - so that is one fix.

Now I just need to figure out why lovelace is showing nothing when it comes up. Basically, a complete blank screen except for the left menu bar.

Hmmm.
C

Just a quick update. I got everything working with NO errors! If you anyone runs into similar errors/problems that I had above - drop me a line and I will help where I can.

I also got lovelace all setup as wel.

The last I am trying to figure out is that my start times don’t seem to cause any of the programs to start. So just working on that part. If anyone has run into this issue before - any feedback would be appreciated :).

I just set all this up and my start times also dont seem to run… I found in the code that it calls ‘sensor.time’… i dont have a ‘sensor.time’ in my home assistant… this could be part of the issue. I’ve added this in

  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'

this has helped the automation work…

there is also a call for ‘sensor.bom_perth_forecast_chance_of_rain_0’… i also dont have this sensor and cant seem to find how to get it, so i’ve just removed the references to it in the code.

Yes, platform: time_date is something that you would likely need in HA for other automations etc, so it wasn’t included in this package. I remember thinking that I should add a comment about that but must have forgotten to do it.

This is where it takes the local weather forecast into account. You could replace that sensor with a similar one from whatever weather service you use

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