Irrigation Custom Component with Custom Card

Hi Terrence,

V4.0.8 of the Custom Component and V1.0.8 of the Custom Card are available on GitHub . I would appreciate if you could review and let me know if it supports the Show Config requirement.

Once installed just add a new line in your config ‘show_config: input_boolean.show_config’ see the documentation for more info.

Cheers
Pete

Peter

Thanks installing now and will revert.
If I want to add another controller, is it best to replicate the irrigation test.yaml file?

Hi Terence,

I would simply extend your existing configuration. Add another switch in the ‘switches’ under the existing ‘platform: irrigationprogram’ referencing the new zones on the new controller. You can then add another Irrigation Custom Card to show the new program you have created for the new controller.

Alternatively just add additional zones to your existing program definition.

If you intend to have both controllers running simultaneously (watering at the same time) check out the ‘allow_multiple’ option that will enable two or more switches to be active at the same time.

Cheers
Pete

Hello, I am thinking of giving this a go, but I’m a bit concerned about loosing the connection from HA to the solenoid I am using to control my zones.

I looked for the esp_home code you mentioned, but I can’t seem to find it. Is it still available?

FYI, I’m currently using this system based on a Sonoff 4 Channel Pro R2 with ESPHome.

Looking for something a little more flexible and thinking this might be worth a try.

Hi Steven,

I have created a repository for the code.

I built my own controller using an ESP and some Solid State Relays. But have not documented the process yet. It is powered off a 24VAC power supply so it can activate the solenoids. It is really a cobbled together set of components but can ramp up to 16 channels. I could have selected some better components that required less soldering but as a project to keep me busy it was fun. I think the box was more expensive than most of the components combined.

As for using the SONOFF, as long as the switches are exposed to HA you can use custom component and card.

2 Likes

Thanks, that looks very useful and, maybe even doable, for someone like me!

Hi Peter

Thanks for the great tool!
I am still in the progress of installing, however, it’s exactly what I was lookin for.

Anyway, I could need some additional help.
I couldn’t figure out what these sections in the test.yaml are for


      - platform: template
        switches:
          dummy_1:
            value_template: "{{ is_state('input_boolean.dummy_switch_1', 'on') }}"
            turn_on:
              - service: input_boolean.turn_on
                entity_id: input_boolean.dummy_switch_1
            turn_off:
              - service: input_boolean.turn_off
                entity_id: input_boolean.dummy_switch_1
          dummy_2:
            value_template: "{{ is_state('input_boolean.dummy_switch_2', 'on') }}"
            turn_on:
              - service: input_boolean.turn_on
                entity_id: input_boolean.dummy_switch_2
            turn_off:
              - service: input_boolean.turn_off
                entity_id: input_boolean.dummy_switch_2
          dummy_3:
            value_template: "{{ is_state('input_boolean.dummy_switch_3', 'on') }}"
            turn_on:
              - service: input_boolean.turn_on
                entity_id: input_boolean.dummy_switch_3
            turn_off:
              - service: input_boolean.turn_off
                entity_id: input_boolean.dummy_switch_3



      dummy_switch_1:
      dummy_switch_2:
      dummy_switch_3:
      dummy_rain_sensor:

Can you give me a hint?

My setup is that I need to switch two different switches on for the irrigation of the three of my four zones, one for the pump and one for the valve. Sure, I could do this outside the integration, with an automation, however, it would be much easier to have this right in the integration, any way to do this?

Best regards
Karl

Hi Karl, The sections in the test.yaml you have highlighted are how I emulate having a solenoids/switches so it appears as a complete working model. You can remove these once you replace the references in the body of the yaml with your switches.

I will add your request onto the ‘to do’ list. I am currently working on a request for a flow/volume based solution rather than time based, I will pick this request up as part of the change.

Cheers
Pete

Thanks for your feedback and change requests.

Version 4.0.10 has been released.

This version brings a few practical improvements requested.

  • The ability to irrigate based on volume with the introduction of a flow meter. Once the ‘flow_senor’ attribute is defined in a zone the ‘water’ attribute is treated as volume instead of time.
  • The addition of a ‘pump’ attribute to allow a second switch to be activated when watering

There are also a couple of defect fixes.

Hi Pete
Thanks for your reply.
I am more and more fascinated about this tool. And piece by piece, I understand how to implement :wink:
I would be willing to add to the documentation e.g. with some examples based on my learning curve, which could be helpful for others to implement. As always with such projects, the project owner has a naturally understanding build up from scratch and by that documentation misses sometimes out on basics, being selfexplaining for you but not necessarily for others.
So I would gladly add some explanations to the wiki on GitHub, however, for whatever reason, I can’t access the wiki to edit.

That was fast ! Thanks
Where exactly do I place the pump Attribute and how do I define it?

Would it be possible to have an enabled switch per zone instead of the disabled?
Looking at he card it looks for me more intuitively when a zone is activated when the switch is on, as with the switches for the Programm itself and for when raining.
Maybe you could implement an option in the yaml which way the switch does work?

Just add the pump attribute inside each zone.

          - zone: switch.zone_1
            pump: switch.pump
1 Like

I will have a look at inverting the switch behaviour

I think if you create a pull request on GITHUB this will allow you create a branch to edit the documentation, we can then merge later

Well, no idea how to do this.
;-(
Anyway, I just added some comments to my yaml,
Maybe you want to integrate this somehow to the documentation.


 

 
    input_datetime: #each program needs a starttime, the relevant input fields are defined here
      irrigation_vormittags_start_time:
        name: Vormittags Startzeit  
        has_date: false
        has_time: true
      irrigation_nachmittags_start_time:
        name: Nachmittags Startzeit
        has_date: false
        has_time: true
      irrigation_vorgarten_start_time:
        name: Vorgarten Startzeit
        has_date: false
        has_time: true
     
    sensor:
      - platform: time_date
        display_options:
          - 'time'
          - 'date'
     # - platform: openweathermaphistory
       # name: 'rainfactor'
        ##api_key: !secret openweatherapi
        #api_key: 
    switch:

      - platform: irrigationprogram
        switches: 
                #switches represent the different irrigation schedules/programs
          vormittags: 
                #name of my first schedule, the custom-card irrigation will refer to this name (program:switch.vormittags)
            start_time: input_datetime.irrigation_vormittags_start_time
                #each schedelue needs a start-time, input_datetime is defined further below,
                #at this time the schedule starts to activate the zones, one after the other
            irrigation_on: input_boolean.irrigation_vormittags_on 
                #shows a switch on the card to turn this schedule on/off
            run_freq: input_select.irrigation_vormittags_frequency
                 #will run only on selected run days you can/should have different input_select with different names,
                 #the lists are defined below in a separate section of the yaml
            icon: mdi:fountain
            
            
            zones:  #zones represent the different irrigation areas with separate valves/pumps
                    #this zone requires to switch on a valve(zone) and a pump 
              - zone: switch.schaltung_garten_rasensprenger_state
                pump: switch.schaltung_garten_pumpe_state
                name: Rasensprenger
                rain_sensor: binary_sensor.raining
                    # rain sensor with ignore option when the rain sensor shows rain, this zone will not be activated,
                ignore_rain_sensor: input_boolean.irrigation_ignore_rain_sensor_rasen
                    # however, there is a switch to ignore the sensor and activate the zone nevertheless              
                run_freq: input_select.irrigation_frequency
                     #a select field for the activation days will be shown in the card
                     # zone will run only on selected run days, ATTENTION: only when the program itself is running, 
                     # means the run_freq of a zone depends on the reun_freq of the program if implemented
                water: input_number.irrigation_rasen_vormittags_run 
                        #input for minutes of irrigation 
                        
                        #next two lines (#wait and #repeat)  if activated (remove #) will show two additional lines in the card, 
                        #one for how often irrigation repeats and one for waiting time in between
                #wait: input_number.irrigation_rasen_vormittags_wait
                #repeat: input_number.irrigation_rasen_vormittags_repeat
                icon: mdi:flower
                disable_zone: input_boolean.rasen_vormittags_disabled 
                        #switch to deactivate this zone temporarily 

              - zone: switch.schaltung_garten_beetsprenger_state
                pump: switch.schaltung_garten_pumpe_state
                name: Beete am Rasen
                rain_sensor: binary_sensor.raining
                ignore_rain_sensor: input_boolean.irrigation_ignore_rain_sensor_beete
                #run_freq: input_select.irrigation_frequency
                water: input_number.irrigation_beete_vormittags_run
                #wait: input_number.irrigation_beete_vormittags_wait
                #repeat: input_number.irrigation_beete_vormittags_repeat
                icon: mdi:grass
                disable_zone: input_boolean.beete_vormittags_disabled

              - zone: switch.schaltung_garten_terrassensprenger_state
                pump: switch.schaltung_garten_pumpe_state
                name: Terrasse
              # rain sensor with ignore option
                rain_sensor: binary_sensor.raining
                ignore_rain_sensor: input_boolean.irrigation_ignore_rain_sensor_terrasse
                #run_freq: input_select.irrigation_frequency
                water: input_number.irrigation_terrasse_vormittags_run
                wait: input_number.irrigation_terrasse_vormittags_wait
                repeat: input_number.irrigation_terrasse_vormittags_repeat
                icon: mdi:carrot
                disable_zone: input_boolean.terrasse_vormittags_disabled

                
                
                
          nachmittags:
            start_time: input_datetime.irrigation_nachmittags_start_time
            irrigation_on: input_boolean.irrigation_nachmittags_on
            #run_freq: input_select.irrigation_nachmittags_frequency
                #as run_freg is disabled from script (#) this program will run every day, as long as the program is not disabled

            icon: mdi:fountain
            zones:
              - zone: switch.schaltung_garten_rasensprenger_state
                pump: switch.schaltung_garten_pumpe_state
                name: Rasensprenger
              # rain sensor with ignore option
                rain_sensor: binary_sensor.raining
                ignore_rain_sensor: input_boolean.irrigation_ignore_rain_sensor_rasen
                #will run only on selected run days
                run_freq: input_select.irrigation_rasen_nachmittags_frequency
                water: input_number.irrigation_rasen_nachmittags_run
                #wait: input_number.irrigation_rasen_nachmittags_wait
                #repeat: input_number.irrigation_rasen_nachmittags_repeat
                icon: mdi:flower
                disable_zone: input_boolean.rasen_nachmittags_disabled
                
              - zone: switch.schaltung_garten_beetsprenger_state
                pump: switch.schaltung_garten_pumpe_state
                name: Beete am Rasen
              # rain sensor with ignore option
                rain_sensor: binary_sensor.raining
                ignore_rain_sensor: input_boolean.irrigation_ignore_rain_sensor_beete
                run_freq: input_select.irrigation_frequency
                water: input_number.irrigation_beete_nachmittags_run
                #wait: input_number.irrigation_beete_nachmittags_wait
                #repeat: input_number.irrigation_beete_nachmittags_repeat
                icon: mdi:grass
                disable_zone: input_boolean.beete_nachmittags_disabled
                
              - zone: switch.schaltung_garten_terrassensprenger_state
                pump: switch.schaltung_garten_pumpe_state
                name: Terrasse
              # rain sensor with ignore option
                
                rain_sensor: binary_sensor.raining
                ignore_rain_sensor: input_boolean.irrigation_ignore_rain_sensor_terrasse
                #run_freq: input_select.irrigation_frequency
                water: input_number.irrigation_terrasse_nachmittags_run
                wait: input_number.irrigation_terrasse_nachmittags_wait
                repeat: input_number.irrigation_terrasse_nachmittags_repeat
                icon: mdi:carrot
                disable_zone: input_boolean.terrasse_nachmittags_disabled

                
          vorgarten:
            start_time: input_datetime.irrigation_vorgarten_start_time
            irrigation_on: input_boolean.irrigation_vorgarten_on
            run_freq: input_select.irrigation_vorgarten_frequency

            icon: mdi:fountain
            zones:

              - zone: switch.keller_pumpe_2
                    #this zone requires only one switch to turn on
                name: Vorgarten
                rain_sensor: binary_sensor.raining
                ignore_rain_sensor: input_boolean.irrigation_ignore_rain_sensor_vorgarten
                #run_freq: input_select.irrigation_frequency
                water: input_number.irrigation_vorgarten_run
                #wait: input_number.irrigation_vorgarten_wait
                #repeat: input_number.irrigation_vorgarten_repeat
                icon: mdi:carrot
                disable_zone: input_boolean.vorgarten_disabled

                
                
                
  #below several input_number fields are defined, which are used in the above schedule/zone definitions.               
    input_number:

      irrigation_adjust_run:
        name: water adjustment
        min: 0
        max: 1
        step: 0.2
        icon: mdi:water-pump-off

      irrigation_rasen_vormittags_run:
        name: Bewässerungsdauer in Min.
        min: 1
        max: 30
        step: 1
        icon: mdi:water
      irrigation_rasen_vormittags_wait:
        name: Wartezeit in Min.zwischen Intervallen
        min: 0
        max: 10
        step: 1
        icon: mdi:timer-sand
      irrigation_rasen_vormittags_repeat:
        name: Anzahl Intervalle
        min: 1
        max: 10
        step: 1
        icon: mdi:repeat
        
      irrigation_rasen_nachmittags_run:
        name: Bewässerungsdauer in Min.
        min: 1
        max: 30
        step: 1
        icon: mdi:water
      irrigation_rasen_nachmittags_wait:
        name: Wartezeit in Min.zwischen Intervallen
        min: 0
        max: 10
        step: 1
        icon: mdi:timer-sand
      irrigation_rasen_nachmittags_repeat:
        name: Anzahl Intervalle
        min: 1
        max: 10
        step: 1
        icon: mdi:repeat

      irrigation_beete_vormittags_run:
        name: Bewässerungsdauer in Min.
        min: 1
        max: 30
        step: 1
        icon: mdi:water
      irrigation_beete_vormittags_wait:
        name: Wartezeit in Min.zwischen Intervallen
        min: 0
        max: 10
        step: 1
        icon: mdi:timer-sand
      irrigation_beete_vormittags_repeat:
        name: Anzahl Intervalle
        min: 1
        max: 10
        step: 1
        icon: mdi:repeat
        
      irrigation_beete_nachmittags_run:
        name: Bewässerungsdauer in Min.
        min: 1
        max: 30
        step: 1
        icon: mdi:water
      irrigation_beete_nachmittags_wait:
        name: Wartezeit in Min.zwischen Intervallen
        min: 0
        max: 10
        step: 1
        icon: mdi:timer-sand
      irrigation_beete_nachmittags_repeat:
        name: Anzahl Intervalle
        min: 1
        max: 10
        step: 1
        icon: mdi:repeat

      irrigation_terrasse_vormittags_run:
        name: Bewässerungsdauer in Min.
        min: 1
        max: 30
        step: 1
        icon: mdi:water
      irrigation_terrasse_vormittags_wait:
        name: Wartezeit in Min.zwischen Intervallen
        min: 0
        max: 10
        step: 1
        icon: mdi:timer-sand
      irrigation_terrasse_vormittags_repeat:
        name: Anzahl Intervalle
        min: 1
        max: 10
        step: 1
        icon: mdi:repeat
        
      irrigation_terrasse_nachmittags_run:
        name: Bewässerungsdauer in Min.
        min: 1
        max: 30
        step: 1
        icon: mdi:water       
      irrigation_terrasse_nachmittags_wait:
        name: Wartezeit in Min.zwischen Intervallen
        min: 0
        max: 10
        step: 1
        icon: mdi:timer-sand
      irrigation_terrasse_nachmittags_repeat:
        name: Anzahl Intervalle
        min: 1
        max: 10
        step: 1
        icon: mdi:repeat

      irrigation_vorgarten_run:
        name: Bewässerungsdauer in Min.
        min: 1
        max: 30
        step: 1
        icon: mdi:water
      irrigation_vorgarten_wait:
        name: Wartezeit in Min.zwischen Intervallen
        min: 0
        max: 10
        step: 1
        icon: mdi:timer-sand
      irrigation_vorgarten_repeat:
        name: Anzahl Intervalle
        min: 1
        max: 10
        step: 1
        icon: mdi:repeat

    input_select:
    # Use either run days or Frequency they are mutually exclusive
    # for each zone/program where different activation days are wanted a separate input_select list with different name is needed

      irrigation_run_days:
        name: An welchen Tagen
        options:
          - "['Mon']"
          - "['Tue']"
          - "['Wed']"
          - "['Thu']"
          - "['Fri']"
          - "['Sat']"
          - "['Sun']"
          - "['Mon','Tue']"
          - "['Mon','Wed']"
          - "['Mon','Thu']"
          - "['Mon','Fri']"
          - "['Tue','Sat']"
          - "['Tue','Thu']"
          - "['Tue','Thu','Sun']"
          - "['Sun','Wed']"
          - "['Mon','Thu']"
          - "['Tue','Fri']"
          - "['Wed','Sat']"
          - "['Mon','Wed','Fri']"
          - "['Mon','Tue','Wed','Thu','Fri','Sat','Sun']"

      irrigation_frequency:
        name: Alle wieviel Tage
        options:
          - "1"
          - "2"
          - "3"
          - "4"
          - "5"
          - "6"
          - "7"

      irrigation_vormittags_frequency:
        name: Alle wieviel Tage oder An welchen Tagen
        options:
          - "1"
          - "2"
          - "3"
          - "4"
          - "5"
          - "6"
          - "7"
          - "['Wed','Sat']"
          - "['Sun','Thu']"
          - "['Mon','Fri']"
          - "['Tue','Sat']"
          - "['Sun','Wed']"
          - "['Mon','Thu']"
          - "['Tue','Fri']"
          - "['Mon','Wed','Fri']"
          - "['Mon','Tue','Wed','Thu','Fri','Sat','Sun']"

      irrigation_nachmittags_frequency:
        name: Alle wieviel Tage oder An welchen Tagen
        options:
          - "1"
          - "2"
          - "3"
          - "4"
          - "5"
          - "6"
          - "7"
          - "['Wed','Sat']"
          - "['Sun','Thu']"
          - "['Mon','Fri']"
          - "['Tue','Sat']"
          - "['Sun','Wed']"
          - "['Mon','Thu']"
          - "['Tue','Fri']"
          - "['Mon','Wed','Fri']"
          - "['Mon','Tue','Wed','Thu','Fri','Sat','Sun']"

      irrigation_vorgarten_frequency:
        name: Alle wieviel Tage oder An welchen Tagen
        options:
          - "1"
          - "2"
          - "3"
          - "4"
          - "5"
          - "6"
          - "7"
          - "['Wed','Sat']"
          - "['Sun','Thu']"
          - "['Mon','Fri']"
          - "['Tue','Sat']"
          - "['Sun','Wed']"
          - "['Mon','Thu']"
          - "['Tue','Fri']"
          - "['Mon','Wed','Fri']"
          - "['Mon','Tue','Wed','Thu','Fri','Sat','Sun']"

      irrigation_rasen_nachmittags_frequency:
        name: Alle wieviel Tage oder An welchen Tagen
        options:
          - "1"
          - "2"
          - "3"
          - "4"
          - "5"
          - "6"
          - "7"
          - "['Wed','Sat']"
          - "['Sun','Thu']"
          - "['Mon','Fri']"
          - "['Tue','Sat']"
          - "['Sun','Wed']"
          - "['Mon','Thu']"
          - "['Tue','Fri']"
          - "['Mon','Wed','Fri']"
          - "['Mon','Tue','Wed','Thu','Fri','Sat','Sun']"

# definition of input_booleans used in schedule/zone definition
    input_boolean:
      irrigation_vormittags_on:
        name: Bewässerung Vormittags aktiv
      irrigation_nachmittags_on:
        name: Bewässerung Nachmittags aktiv
      irrigation_vorgarten_on:
        name: Bewässerung Vorgarten aktiv
      vorgarten_disabled:
        name: vorrübergehend ausschalten
      rasen_vormittags_disabled:
        name: Bewässerung Rasen vormittags ausschalten
      rasen_nachmittags_disabled:
        name: Bewässerung Rasen nachmittags ausschalten        
      beete_vormittags_disabled:
        name: Bewässerung Bette vormittags ausschalten        
      beete_nachmittags_disabled:
        name: Bewässerung Beete nachmittags ausschalten           
      terrasse_vormittags_disabled:
        name: Bewässerung Terrasse vormittags ausschalten        
      terrasse_nachmittags_disabled:
        name: Bewässerung Terrasse nachmittags ausschalten           
               
      irrigation_config:
        name: Show Configuration

      irrigation_ignore_rain_sensor_rasen:
        name: Auch bei Regen
      irrigation_ignore_rain_sensor_beete:
        name: Auch bei Regen
      irrigation_ignore_rain_sensor_terrasse:
        name: Auch bei Regen 
      irrigation_ignore_rain_sensor_vorgarten:
        name: Auch bei Regen


      
    binary_sensor:
      - platform: template
        sensors:
          raining:
            device_class: moisture
            value_template: "{{ is_state('input_boolean.dummy_rain_sensor', 'on') }}"
            icon_template: >-
              {% if is_state("binary_sensor.raining", "on") %}
                mdi:weather-pouring
              {% else %}
                mdi:weather-sunny
              {% endif %}

In case you have any comments on my yaml (e.g. what can be done easier, better, more streamlined) those will be more than welcomed by me.
Once more thanks for all your effort, it’s a really great tool.
I believe that should be part of core HA!

Thanks for the great feedback, I always welcome a pat on the back :slight_smile:

You have a very comprehensive configuration, your comments are excellent. I will add it to the repository for everyone to review.

I have mine yaml quite streamlined, I created this to reduce the amount of yaml required.:

I reuse objects if possible; for example if you have a number of zones you will run at the same frequency only create one day/day number selection list and reuse it on all the zones, you only have to change it once to apply to all zones.

I also only define objects if I am using them, it makes it so much easier to maintain, I notice you have wait and repeat objects for all your zones but only use them in one. I am always looking to reduce the load on HA even though it runs super efficiently on my PI4.

My documentation must be out of date as the run days/ run frequency are now merged into a single object and can contain both day number and day groups. As a note day groups have been added to support water restriction rule here in Australia.

Some attributes that are not mandatory can be ignored for example the icon: attributes are less meaningful when using the custom card, I have not found a way to apply the custom icon in the card in a meaningful way and will consider deprecating that logic in the future as I don’t think it adds to the usability.

And a last note: While I have not added the repository to HACS it is HACS ready. So if you have HACS installed you can add this as a manual repository. This makes installing new version much easier.

Version 4.0.11 has been release.

This is a minor release to both the Custom Component and Custom Card.

New functionality to support ‘Enable Zone’ as opposed to ‘Disable Zone’. The program operation is unchanged however this provides a much more intuitive presentation in the custom card.

Both options are supported however if both are defined ‘Enable Zone’ will be the default.

Hi,

I have created v4.0.11 of both the component and card to invert the disable zone functionality.

Cheers
Pete

Thanks a lot!