Irrigation Unlimited Integration

Hi there and welcome.

Migrating your configuration and keeping similar names would look something like this:

irrigation_unlimited:
  controllers:
    zones:
      - name: "A"
        zone_id: a
        entity_id: "switch.my_valve_a"
      - name: "B"
        zone_id: b
        entity_id: "switch.my_valve_b"
      - name: "C"
        zone_id: c
        entity_id: "switch.my_valve_c"
    sequences:
      - duration: "0:05:00"
        schedules:
          - time: "06:00"
        zones:
          - zone_id: a
          - zone_id: b
          - zone_id: c

The above zones are named A, B and C. A sequence is setup and scheduled to start at 06:00 and run each zone for 5 minutes one after the other. From here you can adjust the setup to suit.

  1. Perform a manual_run service call on sequence_id 1. This will run the first sequence (there is only one but you can have more). Here we run it for 15 minutes, note this is the entire sequence time.
- service: irrigation_unlimited.manual_run
  data:
    entity_id: binary_sensor.irrigation_unlimited_c1_m
    sequence_id: 1
    time: '00:15'
  1. This is like a ‘skip’ function. Partially supported by the cancel service call. You can cancel a running zone but the next zone won’t start until the allotted time.

  2. The shims are support services outside of the integration. They provide a go between the integration and the front end to make things more friendly. Hopefully one day this functionality will be incorporated into the front end. See above post regarding creating a ha-card.

  3. The times are read on startup and stored in memory. Adjustment service calls alter these values, still in memory and are exposed to the world in the ‘adjustment’ attribute on the controller and zone entities. Here is the trick, Home Assistant automatically records all the states and attributes of your entities by default in an sql-lite db. So when Irrigation Unlimited starts up it restores the adjustment from HA history. This means the adjustments last forever and persist across HA restarts. This is also true for enable/disable.

  4. The default for zone_id in the zone objects is 1, 2, 3 etc. so you don’t need to set it. In the above example I have changed it to a, b, c but then you must change the reference in the sequence zones to match. If you want to change from a, b, c system to 1, 2, 3 then the configuration can be simplified.

irrigation_unlimited:
  controllers:
    zones:
      - entity_id: "switch.my_valve_a"
      - entity_id: "switch.my_valve_b"
      - entity_id: "switch.my_valve_c"
    sequences:
      - duration: "0:05:00"
        schedules:
          - time: "06:00"
        zones:
          - zone_id: 1
          - zone_id: 2
          - zone_id: 3

Hope this makes sense and feel free to ask if not.

1 Like

Briefly, zones represent physical valves which are all independent of each other. Sequences allow you to group the zones and run them in a particular order. Schedules can be attached to either zones which means they will each march to their own tune - possibly even overlap (multiple valves open) or attached to a sequence where you instruct the commencement as a series.

Just one thing. YAML is very picky about indentation and it means a lot. If you share your configuration please put it in fenced code blocks. This will stop the text being squished to the left hand margin and help a lot with support. For example.

```yaml
irrigation_unlimited:
  controllers:
    - name: 'My Garden'
      all_zones_config:
        show:
          timeline: true
      zones:
        - entity_id: 'switch.my_switch'
          schedules:
            - time: '06:00'
              duration: '00:20'
```

Hopefully I have not confused you further.

Hi, I’m Just starting to add my irrigation sensor to Home Assistant. I’ve installed Irrigation Unlimited and it seems to be working. In my old system I had a rain sensor (Rain Bird WR2-48) and it is now an ESPHome binary sensor. Is there a way to stop irrigation while the rain sensor is active?

Sure is. This automation is an adaptation from the ESPHome soil moisture adjustment example in the README. Change binary_sensor.rain_sensor to whatever the entity is actually called in Home Assistant (2 places in the example below). Basically, the automation will trigger when the sensor changes state. If the sensor is on it will adjust the time to 0% or if off to 100%. Note: I have not actually tested this so typos are possible but you get the idea. If possible, please publish your final work to help the community.

automation:
  - alias: ESPHome rain sensor
    trigger:
      platform: state
      entity_id:
        - binary_sensor.rain_sensor
    action:
      service: irrigation_unlimited.adjust_time
      data:
        entity_id: binary_sensor.irrigation_unlimited_c1_m
        percentage: >
          {% if states('binary_sensor.rain_sensor') == 'on' %}
            {{ 0 }}
          {% else %}
            {{ 100 }}
          {% endif %}

Thank you, I an relatively new to Home Assistant but my guess is that this would be copied into the “automation.yaml” file?

Thanks for the reply. I am getting much more used to the nuances of the nesting so I should have just worked harder before bothering you. Now that I immediately have moved to on to trying more complicated things, I may have more questions, but again- I am trying to slog it out first with more trial and error.

More than great. Thanks a lot. :+1:

That’s a pity. Any plans to have this optional as service parameter (directly start next zone yes/no).

And regarding cancel. Yes, saw this, but then I have to know, which zone is currently running in such schedule, haven’t I?

Didn’t get this. Where and why is there a difference between the documented services, e.g. manual_run and this undocumented services, e.g.shim_manual_run

Hm, didn’t see this before in HA. I define fixed values, they are afterwards fix in yaml, but the integration changes this and stores and uses other values from memory. If I later on have to debug and double-check, I will find different information stored in yaml and what the integration is using? And always have to e.g. use adjust, reset to have a save and comparable situation?

Sorry for being a bit presumptous. There are a number of ways to setup automations in HA. My personal favourite is via packages which keeps things organised. But yes, copy the code into automation.yaml but get rid of the automation: line (everything in this file is assumed to be an automation) and pull all the text two spaces to the left so the - alias... starts in column 1.

Go to Configuration → Settings → Server Control. Press CHECK CONFIGURATION and then under YAML configuration reloading press AUTOMATIONS. Now under Configuration → Automations & Scenes you should see the automation listed.

  1. Cancellations. You can send the cancel to the controller which will propagate it to all the zones. The cancel function is fairly basic by just deleting the current run out of the zone queue. There are no plans in this area simply because no-one has made any suggestions and I don’t really use it all that much. That’s not to say it couldn’t stand some attention. One thing is it is naive to any sequence. It would be nice to cancel out an entire sequence run and as part of that skipping as you suggested.

  2. Shims. These are pyscript routines which are intended to be interim solutions until a fully formed frontend card can be developed. As a consequence not an overwhelming amount of effort have been expended but they are somewhat self documenting if you go into Developer Tools → Services and look at them. The code can be found in the repository if you are curious and the install instructions are in the readme.
    So what do they do? list_configuration will load up an input_select control with pretty formatted configuration data like ‘1.0 My Garden’, ‘1.1 Vege Beds’ etc. You can now drop this control onto a card for the user to make a selection. The other shims (manual_run, enable/disable) take as an argument the name of this input_select control, read the selected contents and convert it to an entity_id like binary_sensor.irrigation_unlimited_c1_z1 and then call the real service. The shims simply run interference and make the interface a nicer user experience.

  3. Adjustments. Bottom line is adjustments last until they are subsequently overwritten/reset. The yaml is read-only and consumed at startup/reload but it doesn’t hold adjustments. Service calls are the only way to set adjustments and these are logged for a traceback if needed. The current adjustment in play is exposed via an attribute in the entity. Meanwhile, HA is merrily recording all the changes and it forms the basis of history, stats, charts and all the other wonderful things it does.

1 Like

Thank you, everything seems to be working.

can you share your configuration?

This automation is working great on by bench set up but I have now added another zone to my system that will water potted plants on my covered patio. Can i have a zone that will not respond to the rain sensor?

Yes, in the example above the entity_id: for the service call was `binary_sensor.irrigation_unlimited_c1_m’ which is the controller or master and will effect all zones. For a more targeted approach you have several options available:

For individual zones set the entity_id: to a specific zone like binary_sensor.irrigation_unlimited_c1_z1.

If you are using sequences then target the run. As sequences belong to the controller, go back to the original entity_id: for the controller but add a sequence_id: 1 which is the first sequence in your configuration. You can go a step further by even changing part of the sequence.

There is a whole section on how to hit the right spot in the readme

Hello,

I also installed irrigation unlimited integration and it seems to work ok so far.

I have 2 questions/problems if you can help me:

  1. In “Manual Run” and “Enable/Disable Controller” cards in those dropdowns nothing appears to me, they are empty, I have nothing to choise.
  2. How can I add a card to start/stop a zone and also change the watering time directly from lovelace?

Thanks!

Thank you. I changed the automation by adding actions to turn off multiple zones when the rain sensor is on.
I was going to post my work but I can’t see where to upload a file in this forum.

  1. Check the pyscript installation and there are no errors in the log. The dropdown’s are created and loaded using this file which should be loaded in the packages directory. Perhaps manually run the automation to check it works and there are no errors.
  2. There is no card for adjusting the watering times as this is usually done by an automation using weather data, soil moisture probe or other integration. There are a few examples in the readme. You can make a service call in Developer Tools → Services. What do you mean by start/stop a zone?

I think you can just paste it. Here is a quick guide to markdown, the language under the hood here.

  1. you can do this with an automation and a inpu_number: you just need to call the service adjust_time for you zone or controller with the value of the input_number. For stop and start you can use a button or switch or something and use the manual_run/cancell service or the enable/disable service this depends on what you want to start or stop

I had this working well and the I decided to add a helper that would bypass the rain sensor. In the automation I tried to put in an AND function so that the rain sensor had to be ON (AND) the rain senor bypass had to be OFF to prevent the zone from operating. Home Assistant accepted the file and restarted OK but when I tried it with the rain sensor ON and the bypass OFF the zone still operated for 100% of the time.

  alias: Rain Sensor
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.rain
  condition: []
  action:
  - service: irrigation_unlimited.adjust_time
    data:
      entity_id: binary_sensor.irrigation_unlimited_c1_z1
      percentage: "{% if states('binary_sensor.rain') == 'on' && states('input_boolean.rain_sensor_bypass') == 'off' %}\n    {{ 0 }}\n  {%\
        \ else %}\n    {{ 100 }}\n  {% endif %}\n"
  - service: irrigation_unlimited.adjust_time
    data:
      entity_id: binary_sensor.irrigation_unlimited_c1_z3
      percentage: "{% if states('binary_sensor.rain') == 'on' %}\n    {{ 0 }}\n  {%\
        \ else %}\n    {{ 100 }}\n  {% endif %}\n"
  - service: irrigation_unlimited.adjust_time
    data:
      entity_id: binary_sensor.irrigation_unlimited_c1_z4
      percentage: "{% if states('binary_sensor.rain') == 'on' %}\n    {{ 0 }}\n  {%\
        \ else %}\n    {{ 100 }}\n  {% endif %}\n"
  - service: irrigation_unlimited.adjust_time
    data:
      entity_id: binary_sensor.irrigation_unlimited_c1_z5
      percentage: "{% if states('binary_sensor.rain') == 'on' %}\n    {{ 0 }}\n  {%\
        \ else %}\n    {{ 100 }}\n  {% endif %}\n"

My guess is that I don’t have the AND function written properly.
Any thoughts?

{% if (is_state('binary_sensor.rain', 'on') and is_state('input_boolean.rain_sensor_bypass', 'off')) %}
{{ 0 }}
{% else %}
{{ 100 }}
{% endif %}

You can do it with yaml too:

alias: Rain Sensor
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.rain
  action:
    - choose:
        - conditions:
            - condition: state
              entity_id: binary_sensor.rain
              state: 'off'
            - condition: state
              entity_id: input_boolean.rain_sensor_bypass
              state: 'off'
          sequence: 
            - service: irrigation_unlimited.adjust_time
              data:
                enitity_id: binary_sensor.irrigation_unlimited_c1_z1
                percentage: 0
        - conditions:
            - condition: state
              entity_id: binary_sensor.rain
              state: 'on'
          sequence: 
            - service: irrigation_unlimited.adjust_time
              data: 
                enitity_id: binary_sensor.irrigation_unlimited_c1_z1
                percentage: 100
          ...