My Garden Irrigation

Ah ha!
Yes it is.
Sort of…

I’ve only snatched a few minutes to look at this but I think the problem is that your switches don’t have the word ‘zone’ in them!

I look for a name with ‘zoneX’ you have ‘relayX’.

There are several ways around this…

I need to have a pattern to look for in switch names that I am sure will appear in everyone’s switch name.

So I can think of three options:

  1. I ‘insist’ everyone (re)names their switches to include the string ‘zoneX’
  2. I add extra checks to look for other possible strings, such as ‘relayX’
  3. I just look for a digit (i.e 1, 2 ,3 … etc.)

There are pros and cons to all these solutions.

  1. This would affect some people who would need to rename their switches (and I would need to update the documentation)
  2. This would make clunky code and I would never be sure I had included every option
  3. This would run the risk of someone using numbers inappropriately and also I am hoping to add changes soon that allow an unlimited (theoretically) number of zones so I’d have to search for double digit numbers and everyone would have to rename theirs to ‘01’, ‘02’, etc.

My preference is for option 1 but I am open to any other suggestions…

In NodeRed, I “simply” check each real names of my switches and then update the relative sensor.

The code should already know the number of zones defined and the switches real names (in input_text.irrigation_zoneX_switch_entity_id), so maybe another way is to do it per single zone, without caring of the zoneX, relayX or others in the switch name, even if wouldn’t be the best optimized way, but at least you don’t have to ‘insist’ on switches naming.

Yeah, I’d thought of that… An automation for every zone instead of one automation that checks all zones. Not the most optimized way but maybe it would be best that way…

I’ll think about it.

Whatever I do, I can’t work on this for a couple of days.


If you want to change your code in the meantime so that you get history data then in the automation you can change the action by replaceing all the

{% if 'zoneX' in trigger.event.data.entity_id %}

to

{% if 'relayX' in trigger.event.data.entity_id %}

1 Like

Probably, a fast way could be to adapt the naming of the switches to ‘zoneX’ or to modify that automation reflecting the switch naming.
If explained well, as you already did with the Readme and Prerequisites, should not be an issue…

Hello,
I just wanted to mention that the HowTo that you referenced is complete, the integration of your implementation according to it is ok, with the mention that for me all the browser_mod dialogs work in Win7, Android but not in Win10, but I think this is some problem with my browser/firewall/antivirus that I am still researching.

@klogg

I found the way!!! Easy and without any issue and without any cons.

In the automation Irrigation Synchronise Sensor Zone Switches in the file garden_controller.yaml in the package folder, in the action of the automation just replace the actual - service: homeassistant.update_entity with this

      - service: homeassistant.update_entity
        data_template:
          entity_id: >
            {% if states('input_text.irrigation_zone1_switch_entity_id') in trigger.event.data.entity_id %}
              sensor.irrigation_sensor_zone1_switch
            {% elif states('input_text.irrigation_zone2_switch_entity_id') in trigger.event.data.entity_id %}
              sensor.irrigation_sensor_zone2_switch
            {% elif states('input_text.irrigation_zone3_switch_entity_id') in trigger.event.data.entity_id %}
              sensor.irrigation_sensor_zone3_switch
            {% elif states('input_text.irrigation_zone4_switch_entity_id') in trigger.event.data.entity_id %}
              sensor.irrigation_sensor_zone4_switch
            {% elif states('input_text.irrigation_zone5_switch_entity_id') in trigger.event.data.entity_id %}
              sensor.irrigation_sensor_zone5_switch
            {% elif states('input_text.irrigation_zone6_switch_entity_id') in trigger.event.data.entity_id %}
              sensor.irrigation_sensor_zone6_switch
            {% elif states('input_text.irrigation_zone7_switch_entity_id') in trigger.event.data.entity_id %}
              sensor.irrigation_sensor_zone7_switch
            {% elif states('input_text.irrigation_zone8_switch_entity_id') in trigger.event.data.entity_id %}
              sensor.irrigation_sensor_zone8_switch
            {% else %}
              none
            {% endif %}

And everything seems to be working.

It should be double checked by others, just to be sure it works for all…

I can’t believe I missed that!
Myabe my excuse can be that it was a case of looking at something for so long you end up having no idea what you are looking at…

Thank you for finding this :slight_smile: :clap: (and well done)!!

I’ll update GitHub soon.

1 Like

But will this scale above 8 zones dynamically? Personally I’d rather opted for a “fixed” naming convention *zoneX and scale dynamically, than having to edit a bunch of code to adapt to different number of zones. My 2cents worth…

For the “is it raining / did it rain” - I still have an old Rainbird rainsensor which works like a switch/relay - I wired the common of my zone through it, so even it the cycle runs for some reason and it rained the valve solenoids cant turn on. The history tab will be a bit off, but the plants wont be drowned.

Ops i missed out some message in these days! I’ll try it asap!

That’s a good question. In a word the answer is, no.
But…

It would be (as far as I know) impossible to write a system that dynamically adjusts completely to any number of zones using pure yaml (I am sure with some Python modules it would be possible) and to be honest when I wrote this I never even considered more than eight as that is all I wanted :wink: In fact I never expected this much interest in it because whilst Version 1 was used by a few people as far as I could tell there wasn’t much interest or activity in its development.

As it stands now, in order to extend it you have to at least add extra input_*. There may be other things but the only person I know who is actually doing this is @Athan. They have adapted the code and offered some suggestions for changes to make that adaptation simpler.

This change in particular is really a fix to a coding error that should never have been there in the first place and simply makes the history work as intended and restores the status quo.

I am very open to changes to make it scale to more zones and it would be great to make it as dynamic as possible but at the very least I do hope that at some point there will be documentation about what changes/additions are needed to implement this.

In principle I am entirely in agreement with this :wink:

Hmm… if I understand correctly I don’t think it will because the History is based on the actual time that actual switch is on. If your Rainbird sensor stops the switch turning on then no ‘history time’ will be recorded.

There may be other things but the only person I know who is actually doing this is @Athan.

I have a repository that i forked from @klogg and keeping it updated with his latest changes. I have choose to have up to 16 zones. Keep in mind that i haven’t change the core code (except from the changes that i have already propose to Klogg), i just manually added the extra code that needed to support the zones.

1 Like

Updates

Enhancement

Better able to deal with more than eight zones (thanks to @Athan)

Bug fix

Fix History (thanks to @woody4165)

New Feature

Allow cycle start time to be an offset from sunset/sunrise (suggested by @ekkesa)

image

3 Likes

Hello everybody,

is there a step by step guide to irrigation?

I don’t really know where to start.
The HA irrigation version 2 documentation is not that great.

I have two rainbird controllers with a total of 10 cycles.

Unfortunately there is a problem with the support of the second Rainbird controller.
thank you.

The Readme and Prerequisites of this project are really well done.
Take some time to read them better…

Hi i have a issue with the updated item_cycle_start_time.yaml below, when i switch back to the previous version item_cycle_start_time.yaml all is working ok, and can’t work out why its not loading the new file and everything checks out ok in the HA logs ?

New version item_cycle_start_time.yaml view.

Previous item_cycle_start_time.yaml, loaded with all the new files minus the updated item_cycle_start_time.yaml which works fine.

Think i may of jumped the gun as there are now some package files to up load, we let you know once i have upload all the files…

All sorted now by uploading the rest of the files from packages doh …

Hi @klogg

I’m getting this strange issue when using the sliders to select the irrigation time

Schermata 2020-07-14 alle 15.59.56

This is happening from 10 days or more.

What can I check ?

Thanks

Yes so am I…

2 Likes