MQTT based sprinkler control

Tags: #<Tag:0x00007f739e911400> #<Tag:0x00007f739e9112e8> #<Tag:0x00007f739e911220>

This one:

Hi Tom,

I was so impressed with that interface I extended the automations into Node-red and made some slight adjustments to some of the templating. Dropping back here in case someone is grappling with this in the future. There are probably better more effective ways of doing this in NR as I am still learning.

My flow for a zone is below in case it is useful to anyone else:

[{"id":"ab233bbf.7445b8","type":"trigger-state","z":"eab90dac.1ba15","name":"Zone 2 Time Trigger","server":"5d9df51f.c01a5c","entityid":"sensor.time","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":120,"y":900,"wires":[["bb6f30af.b8829","5621b69c.500148","3fbead61.900232"],[]]},{"id":"8548ae7.661095","type":"api-render-template","z":"eab90dac.1ba15","name":"Is Zone 2 active today","server":"5d9df51f.c01a5c","template":"{% if is_state(\"binary_sensor.zone_2_day_active\", \"on\") %}on\n{%-else %} off {% endif %}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"","templateLocationType":"none","x":390,"y":707,"wires":[["b602c9e9.36ab78"]]},{"id":"19770f74.e86811","type":"trigger-state","z":"eab90dac.1ba15","name":"Midnight Arrives","server":"5d9df51f.c01a5c","entityid":"sensor.date","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":90,"y":747,"wires":[["993cc97.da44338","8548ae7.661095"],[]]},{"id":"5b03b094.e5777","type":"api-render-template","z":"eab90dac.1ba15","name":"Start Time","server":"5d9df51f.c01a5c","template":"{% if states('sensor.time') == states('input_datetime.zone_2_am_on_time').rsplit(':',1)[0] %}on\n{%-else %} off {% endif %}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"","templateLocationType":"none","x":670,"y":920,"wires":[["1fc3136f.ed2d0d"]]},{"id":"b602c9e9.36ab78","type":"switch","z":"eab90dac.1ba15","name":"block off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":667,"wires":[["f4e0c833.ceaef8"]]},{"id":"f4e0c833.ceaef8","type":"change","z":"eab90dac.1ba15","name":"Enable sensor.time","rules":[{"t":"set","p":"payload","pt":"msg","to":"enable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":667,"wires":[["ab233bbf.7445b8"]]},{"id":"993cc97.da44338","type":"change","z":"eab90dac.1ba15","name":"Disable sensor.time","rules":[{"t":"set","p":"payload","pt":"msg","to":"disable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":807,"wires":[["ab233bbf.7445b8"]]},{"id":"1592afd2.ae18e","type":"trigger-state","z":"eab90dac.1ba15","name":"Zone 2 Becomes Active","server":"5d9df51f.c01a5c","entityid":"binary_sensor.zone_2_day_active","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"kbvbtxf5trq","targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":120,"y":807,"wires":[["993cc97.da44338","8548ae7.661095"],[]]},{"id":"f94411ca.91b5","type":"api-call-service","z":"eab90dac.1ba15","name":"Zone 2 Turn on","server":"5d9df51f.c01a5c","version":1,"service_domain":"switch","service":"turn_on","entityId":"switch.garden_sprinklers_zone_2","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1400,"y":940,"wires":[[]]},{"id":"bb6f30af.b8829","type":"api-current-state","z":"eab90dac.1ba15","name":"Sprinklers Running?","server":"5d9df51f.c01a5c","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.garden_sprinklers_zone_2","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":360,"y":860,"wires":[["876bb58a.f9ffe8"],[]]},{"id":"876bb58a.f9ffe8","type":"api-render-template","z":"eab90dac.1ba15","name":"Remaining Time = 0","server":"5d9df51f.c01a5c","template":"{% if states('sensor.zone_2_time_remaining')|round(0) > 0 %}on\n{%-else %} off {% endif %}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"","templateLocationType":"none","x":600,"y":860,"wires":[["4f9468f3.42b9d8"]]},{"id":"b1b6e11b.b33d5","type":"api-call-service","z":"eab90dac.1ba15","name":"Zone 2 Turn off","server":"5d9df51f.c01a5c","version":1,"service_domain":"switch","service":"turn_off","entityId":"switch.garden_sprinklers_zone_2","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1020,"y":860,"wires":[[]]},{"id":"4f9468f3.42b9d8","type":"switch","z":"eab90dac.1ba15","name":"block on","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":800,"y":860,"wires":[["b1b6e11b.b33d5"]]},{"id":"5b6fc169.2c4b4","type":"trigger-state","z":"eab90dac.1ba15","name":"Manual Activation","server":"5d9df51f.c01a5c","entityid":"switch.garden_sprinklers_zone_2","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"1f0y0109b8t","targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":100,"y":707,"wires":[["409d6b9f.362fb4","993cc97.da44338"],[]]},{"id":"409d6b9f.362fb4","type":"api-render-template","z":"eab90dac.1ba15","name":"Check how activated","server":"5d9df51f.c01a5c","template":"{% if states('sensor.time') != states('input_datetime.zone_2_am_on_time').rsplit(':',1)[0] %}on\n{%-else %} off {% endif %}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"","templateLocationType":"none","x":390,"y":647,"wires":[["b602c9e9.36ab78"]]},{"id":"5621b69c.500148","type":"api-render-template","z":"eab90dac.1ba15","name":"AM Scheduled?","server":"5d9df51f.c01a5c","template":"{% if states('input_boolean.zone_2_am_enable_schedule') == 'on' %}on\n{%-else %} off {% endif %}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"","templateLocationType":"none","x":340,"y":920,"wires":[["37d8b24b.097a1e"]]},{"id":"17ffc403.6e24cc","type":"comment","z":"eab90dac.1ba15","name":"Zone 2","info":"","x":60,"y":667,"wires":[]},{"id":"2d46bf31.1fe21","type":"api-render-template","z":"eab90dac.1ba15","name":"Start Time","server":"5d9df51f.c01a5c","template":"{% if states('sensor.time') == states('input_datetime.zone_2_pm_on_time').rsplit(':',1)[0] %}on\n{%-else %} off {% endif %}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"","templateLocationType":"none","x":670,"y":980,"wires":[["1fc3136f.ed2d0d"]]},{"id":"3fbead61.900232","type":"api-render-template","z":"eab90dac.1ba15","name":"PM Scheduled?","server":"5d9df51f.c01a5c","template":"{% if states('input_boolean.zone_2_pm_enable_schedule') == 'on' %}on\n{%-else %} off {% endif %}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"","templateLocationType":"none","x":340,"y":980,"wires":[["a435c159.037ed"]]},{"id":"37d8b24b.097a1e","type":"switch","z":"eab90dac.1ba15","name":"block off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":500,"y":920,"wires":[["5b03b094.e5777"]]},{"id":"a435c159.037ed","type":"switch","z":"eab90dac.1ba15","name":"block off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":500,"y":980,"wires":[["2d46bf31.1fe21"]]},{"id":"dcfb829e.50752","type":"switch","z":"eab90dac.1ba15","name":"block off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1240,"y":940,"wires":[["f94411ca.91b5"]]},{"id":"36d2c0e3.2707e","type":"api-render-template","z":"eab90dac.1ba15","name":"Weather check","server":"5d9df51f.c01a5c","template":"{% if states('sensor.bom_brisbane_rain_today')|float < states('input_number.rain_limit')|float and\nstates('sensor.predict_rain_today')|float < states('input_number.rain_limit')|float and\nstate_attr('sensor.rain_in_last_48h' , 'max_value')|int < 30 %}on\n{%-else %} off {% endif %}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"","templateLocationType":"none","x":1053,"y":940,"wires":[["dcfb829e.50752"]]},{"id":"1fc3136f.ed2d0d","type":"switch","z":"eab90dac.1ba15","name":"block off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":870,"y":940,"wires":[["36d2c0e3.2707e"]]},{"id":"5d9df51f.c01a5c","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

My full config is below (It contains 2 zones - The NR flow only contains Zone 2):

#################################################################
#                                                               #
#                Packages/Garden Reticulation                   #
#                                                               #
#################################################################

#################################################################
#                                                               #
#     This is a full reticulation control package using BOM     #
#   weather prediction to prevent watering if rain is expected, #
#   or occured recently with local moisture sensor data as well #
#                                                               #
#################################################################

  switch:
    - platform: mqtt
      name: "Garden Sprinklers Zone 1"
      command_topic: "house/driveway/side-garden/cmnd/power1"
      state_topic: "house/driveway/side-garden/stat/POWER1"
      qos: 1
      payload_on: "ON"
      payload_off: "OFF"
      retain: false
      
    - platform: mqtt
      name: "Garden Sprinklers Zone 2"
      command_topic: "house/driveway/side-garden/cmnd/power2"
      state_topic: "house/driveway/side-garden/stat/POWER2"
      qos: 1
      payload_on: "ON"
      payload_off: "OFF"
      retain: false
      
    - platform: mqtt
      name: "Side Garden Lights"
      command_topic: "house/driveway/side-garden/cmnd/power3"
      state_topic: "house/driveway/side-garden/stat/POWER3"
      qos: 1
      payload_on: "ON"
      payload_off: "OFF"
      retain: false

#################################################################
#                                                               #
#    Zone 1 = Front Lawn          Zone 2 = Side Garden          #
#                                                               #
#################################################################

#################################################################
#                                                               #
#                  Is today a Sprinkler Day?                   #
#                                                               #
#################################################################
  binary_sensor:
    - platform: template
      sensors:
        zone_1_day_active:
          friendly_name: Irrigation Day Active
          entity_id:
            - sensor.date
            - input_boolestatisan.zone_1_am_enable_schedule
            - input_boolean.zone_1_pm_enable_schedule
            - input_boolean.zone_1_mon
            - input_boolean.zone_1_tue
            - input_boolean.zone_1_wed
            - input_boolean.zone_1_thu
            - input_boolean.zone_1_fri
            - input_boolean.zone_1_sat
            - input_boolean.zone_1_sun
          value_template: >-
            {{ (is_state('input_boolean.zone_1_am_enable_schedule', 'on')
            or is_state('input_boolean.zone_1_pm_enable_schedule', 'on'))
            and (( is_state('input_boolean.zone_1_mon', 'on') and now().weekday() == 0 )
            or ( is_state('input_boolean.zone_1_tue', 'on') and now().weekday() == 1 )
            or ( is_state('input_boolean.zone_1_wed', 'on') and now().weekday() == 2 )
            or ( is_state('input_boolean.zone_1_thu', 'on') and now().weekday() == 3 )
            or ( is_state('input_boolean.zone_1_fri', 'on') and now().weekday() == 4 )
            or ( is_state('input_boolean.zone_1_sat', 'on') and now().weekday() == 5 )
            or ( is_state('input_boolean.zone_1_sun', 'on') and now().weekday() == 6 )) }}
    - platform: template
      sensors:
        zone_2_day_active:
          friendly_name: Irrigation Day Active
          entity_id:
            - sensor.date
            - input_boolean.zone_2_am_enable_schedule
            - input_boolean.zone_2_pm_enable_schedule
            - input_boolean.zone_2_mon
            - input_boolean.zone_2_tue
            - input_boolean.zone_2_wed
            - input_sboolean.zone_2_thu
            - input_boolean.zone_2_fri
            - input_boolean.zone_2_sat
            - input_boolean.zone_2_sun
          value_template: >-
            {{ (is_state('input_boolean.zone_2_am_enable_schedule', 'on')
            or is_state('input_boolean.zone_2_pm_enable_schedule', 'on'))
            and (( is_state('input_boolean.zone_2_mon', 'on') and now().weekday() == 0 )
            or ( is_state('input_boolean.zone_2_tue', 'on') and now().weekday() == 1 )
            or ( is_state('input_boolean.zone_2_wed', 'on') and now().weekday() == 2 )
            or ( is_state('input_boolean.zone_2_thu', 'on') and now().weekday() == 3 )
            or ( is_state('input_boolean.zone_2_fri', 'on') and now().weekday() == 4 )
            or ( is_state('input_boolean.zone_2_sat', 'on') and now().weekday() == 5 )
            or ( is_state('input_boolean.zone_2_sun', 'on') and now().weekday() == 6 )) }}


#################################################################
#                                                               #
#         Countdown timer from when Sprinklers start            #
#                                                               #
#################################################################
  sensor:
    # Used to pull a max_value from the statistics sensor
    # Refer: https://www.home-assistant.io/integrations/statistics/
    # The max_value is templated into a sensor.  See 48hour_rain_figure below
    - platform: statistics
      name: Rain in last 48h
      entity_id: sensor.bom_brisbane_rain_today
      max_age:
        days: 2
        
    - platform: template
      sensors:
        zone_1_time_remaining:
          friendly_name: 'Time Remaining'
          entity_id:
            - input_number.zone_1_run_time
            - sensor.time
            - switch.garden_sprinklers_zone_1
          #Check if the zone switch is on or off before providing the number
          value_template: >
            {% if is_state("switch.garden_sprinklers_zone_1", "off") %} 0
            {% else %}
            {% set countdown_timer = [ (states('input_number.zone_1_run_time') | int - (as_timestamp(now()) - as_timestamp(states.switch.garden_sprinklers_zone_1.last_changed)) / 60) | round(0) ,0 ] | max %} {{ countdown_timer }}
            {% endif %}
          unit_of_measurement: "min"

        zone_2_time_remaining:
          friendly_name: 'Time Remaining'
          entity_id:
            - input_number.zone_2_run_time
            - sensor.time
            - switch.garden_sprinklers_zone_2
          value_template: >
            {% if is_state("switch.garden_sprinklers_zone_2", "off") %} 0
            {% else %}
            {% set countdown_timer = [ (states('input_number.zone_2_run_time') | int - (as_timestamp(now()) - as_timestamp(states.switch.garden_sprinklers_zone_2.last_changed)) / 60) | round(0) ,0 ] | max %} {{ countdown_timer }}
            {% endif %}
          unit_of_measurement: "min"


          
#################################################################
#                                                               #
#                  All Zones - Weather Forecasting              #
#                                                               #
#################################################################
        predict_rain_today:
          friendly_name: 'Predicted Rain Today'
          entity_id:
            - sensor.bom_brisbane_forecast_chance_of_rain_0 # always a single int
            - sensor.bom_brisbane_forecast_possible_rainfall_0 # two formats. Single int or "int_1 to int_2" e.g. "3 to 4"
          unit_of_measurement: mm
          value_template: >
            {% set chance = states('sensor.bom_brisbane_forecast_chance_of_rain_0')|int /100 %}
            {% if 'to' in states('sensor.bom_brisbane_forecast_possible_rainfall_0') %}
              {% set amount =  states('sensor.bom_brisbane_forecast_possible_rainfall_0').split(' to ')  %}
              {% set amount1 = amount[0] | float %}
              {% set amount2 = amount[1] | float %}
              {% set amount_avg = (amount1 + amount2) / 2 %}
            {% else %}
              {% set amount_avg = states('sensor.bom_brisbane_forecast_possible_rainfall_0') | int %}
            {% endif %}
            {{ (chance * amount_avg)|round(1) }}

        predict_rain_tomorrow:
          friendly_name: 'Predicted Rain Tomorrow'
          entity_id:
            - sensor.bom_brisbane_forecast_chance_of_rain_1 # always a single int
            - sensor.bom_brisbane_forecast_possible_rainfall_1 # two formats. Single int or "int_1 to int_2" e.g. "3 to 4"
          unit_of_measurement: mm
          value_template: >
            {% set chance = states('sensor.bom_brisbane_forecast_chance_of_rain_1')|int / 100 %}
            {% if 'to' in states('sensor.bom_brisbane_forecast_possible_rainfall_1') %}
              {% set amount =  states('sensor.bom_brisbane_forecast_possible_rainfall_1').split(' to ')  %}
              {% set amount1 = amount[0] | float %}
              {% set amount2 = amount[1] | float %}
              {% set amount_avg = (amount1 + amount2) / 2 %}
            {% else %}
              {% set amount_avg = states('sensor.bom_brisbane_forecast_possible_rainfall_1') | int %}
            {% endif %}
            {{ (chance * amount_avg)|round(1) }}
            
        48hour_rain_figure:
          friendly_name: 'Rain in last 48 hours'
          unit_of_measurement: mm
          value_template: >
            {{ state_attr('sensor.rain_in_last_48h' , 'total') }}
#################################################################
#                                                               #
#                    Set Start/Finish Times                     #
#                                                               #
#################################################################

  input_datetime:
    zone_1_am_on_time:
      name: AM On Time
      has_date: false
      has_time: true

    zone_1_pm_on_time:
      name: PM On Time
      has_date: false
      has_time: true

    zone_2_am_on_time:
      name: AM On Time
      has_date: false
      has_time: true

    zone_2_pm_on_time:
      name: PM On Time
      has_date: false
      has_time: true


#################################################################
#                                                               #
#                  Set the days you Water here                  #
#                                                               #
#################################################################
  input_boolean:
# Zone 1 Days
    zone_1_mon:
      name: Monday
      icon: mdi:calendar

    zone_1_tue:
      name: Tuesday
      icon: mdi:calendar

    zone_1_wed:
      name: Wednesday
      icon: mdi:calendar

    zone_1_thu:
      name: Thursday
      icon: mdi:calendar

    zone_1_fri:
      name: Friday
      icon: mdi:calendar

    zone_1_sat:
      name: Saturday
      icon: mdi:calendar

    zone_1_sun:
      name: Sunday
      icon: mdi:calendar
# Zone 1 Automation Switches
    zone_1_am_enable_schedule:
      name: Enable AM Schedule
      icon: mdi:weather-sunny

    zone_1_pm_enable_schedule:
      name: Enable PM Schedule
      icon: mdi:weather-sunset

# Zone 2 Days
    zone_2_mon:
      name: Monday
      icon: mdi:calendar

    zone_2_tue:
      name: Tuesday
      icon: mdi:calendar

    zone_2_wed:
      name: Wednesday
      icon: mdi:calendar

    zone_2_thu:
      name: Thursday
      icon: mdi:calendar

    zone_2_fri:
      name: Friday
      icon: mdi:calendar

    zone_2_sat:
      name: Saturday
      icon: mdi:calendar

    zone_2_sun:
      name: Sunday
      icon: mdi:calendar
# Zone 2 Automation Switches
    zone_2_am_enable_schedule:
      name: Enable AM Schedule
      icon: mdi:weather-sunny

    zone_2_pm_enable_schedule:
      name: Enable PM Schedule
      icon: mdi:weather-sunset



#################################################################
#                                                               #
#             How much Rain must have fallen to stop            #
#               the Sprinkler cycle from running?               #
#                                                               #
#################################################################
  input_number:
    rain_limit:
      name: Rain Limit
      min: 0
      max: 2
      step: 0.1
      unit_of_measurement: mm
      icon: mdi:weather-pouring
      
#################################################################
#                                                               #
#              Set the run-time for each Zone below             #
#                                                               #
#################################################################
    zone_1_run_time:
      name: Run Time
      min: 5
      max: 30
      step: 5
      unit_of_measurement: min
      icon: mdi:clock
    zone_2_run_time:
      name: Run Time
      min: 1
      max: 10
      step: 1
      unit_of_measurement: min
      icon: mdi:clock

1 Like

I’ve just added a Miflora plant sensor. Currently stabbed into my lawn with a rubber glove finger over it for waterproofing.

I’m waiting for it to rain to get a baseline on the sensor to see if it’s worth including in the automations.

Hi Tom,

How goes you the Hobart MiFloras? With a good dose of rain over the last 48 hours here I got to tinkering with the scheduler logic and decided to use the recorded history from the sensor.bom_brisbane_rain_today and use it as a threshold test to determine if the schedule should start.
image
You can see the sensor resetting each morning at 9am (as designed) but so I’ve searched for the maximum number in that sensor when the sprinklers are due to start.

I’ve picked 48 hours and 30mm of rain in that time as a logic check. I’ve plucked those numbers from thin air as that is the current rainfall we’ve received here (see below). When these are due to kick off I’ll go out and do a quick soil moisture test (using my digits) to see if it needs adjusting. Anyway, I’ve updated my yaml/node-red to include this new logic, again in case anyone comes along later and finds it useful.

image

We’ve had very little rain here. I live in the rain shadow of a mountain. Just enough to keep the moisture level around 25% to 30%. I notice that the Lux sensor has stopped working. No big deal as I wasn’t using it. Also the temperature readings are all over the place due to the sensor being in it’s own little greenhouse.

I’m still not convinced it’s going to be any use.

My AM sprinkler run starts at 8am so I can use the rainfall to 9am sensor without having to store it.

I’ve been watching the ground and anything over 0.5mm in 24 hours seems to soak the top level. My soil is very sandy though so it drains away quickly.

I updated my time remaining sensors so that they only show a value if the sprinkler valve is on:

- platform: template
  sensors:
    zone_1_time_remaining:
      friendly_name: 'Time Remaining'
      entity_id:
        - input_number.zone_1_time_remaining
        - sensor.time
        - switch.zone_1
      value_template: >
        {% if is_state('switch.zone_1', 'on') %}
          {{ [ (states('input_number.zone_1_run_time')|int - (as_timestamp(now()) - as_timestamp(states.switch.zone_1.last_changed))/60)|round(0) ,0 ] | max }}
        {% else %}
          0
        {% endif %}
      unit_of_measurement: "min"

Otherwise restarts and switching off the zone valve trigger it to start counting down.

Nice. That was one of the adjustments I made as well as restarts were messing with it.

I got some moisture data from a 15 minute sprinkler run this morning:

Screenshot_2019-10-13%20Home%20Assistant

Need more data before I decide what to do with it.

Definitely and not just point in time either as historical moisture over time is the key. It drops away quite quickly and back to your normal 25%. You’re not joking about it draining quickly. :grinning:

Changed the day toggles (tiles-card):

3 Likes

This makes me want to buy everything to this happen. Beautiful!

Does the opto isolated 5vdc relay module run fine if the IO input voltage is 3.3 vdc? Supply voltage 5vdc.

I have few relay modules with transistors and those does not run fine with 3.3 vdc. Have to have other transistor to drive 5vdc to relay from esp 3.3vdc pins.

Figured I’d share my UI now that I finally got it all finished.
(The unavailable is because I’m waiting on a new power supply so the controller isn’t on right now.)

3 Likes

That’s awesome, care to share the final product code, would totally love to use what you’ve developed here!

Super cool, very nice. If you’d be willing to share the code I’d love to have a go with it. Just looking to move my irrigation into HA and that panel is amazing.

1 Like

Of course! I use a bunch of custom components so those would all be needed as well.
Components from HACS

  • button-card
  • layout-card
  • Mini Graph Card
  • card-tools
  • card-mod
  - icon: 'mdi:sprinkler'
    path: sprinklers
    title: Sprinklers
    badges: []
    cards:
      - entities:
          - cards:
              - content: '## Front Yard'
                style: |
                  ha-card {
                    background: rgba(0, 0, 0, 0);
                    box-shadow: none;
                  }
                  .markdown {
                    padding-left: 0px;
                  }
                type: markdown
              - entity: script.sprinkler_zone_front
                layout: icon_name
                name: Run Now
                size: 30px
                state:
                  - icon: 'mdi:play-circle'
                    value: 'off'
                  - icon: 'mdi:autorenew'
                    spin: true
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - background-color: '#333'
                tap_action:
                  action: call-service
                  service: script.toggle
                  service_data:
                    entity_id: script.sprinkler_zone_front
                type: 'custom:button-card'
            layout: horizontal
            min_columns: 2
            type: 'custom:layout-card'
          - conditions:
              - entity: script.sprinkler_zone_front
                state: 'on'
            name: Zone currently running
            row:
              entity: sensor.sprinkler_current_zone
              icon: 'mdi:numeric'
            type: conditional
          - conditions:
              - entity: script.sprinkler_zone_front
                state: 'on'
            row:
              entity: sensor.sprinkler_zone_front_time_remaining
              icon: 'mdi:progress-clock'
            type: conditional
          - conditions:
              - entity: script.sprinkler_zone_front
                state: 'off'
            row:
              entity: sensor.sprinkler_zone_front_last_cycle_time
              icon: 'mdi:clock'
            type: conditional
          - type: divider
          - cards:
              - entity: automation.sprinkler_zone_front_am
                gridcol: 1 / 3
                gridrow: 1 / 3
                name: AM Schedule
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: automation.sprinkler_zone_front_pm
                gridcol: 3 / 5
                gridrow: 1 / 3
                name: PM Schedule
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_datetime.sprinkler_zone_front_am_on_time
                gridcol: 1 / 3
                gridrow: 3 / 3
                layout: icon_state
                show_name: false
                show_state: true
                size: 30px
                styles:
                  card:
                    - border-radius: 10px
                    - background-color: '#333'
                    - height: 100%
                type: 'custom:button-card'
              - entity: input_datetime.sprinkler_zone_front_pm_on_time
                gridcol: 3 / 5
                gridrow: 3 / 3
                layout: icon_state
                show_name: false
                show_state: true
                size: 30px
                styles:
                  card:
                    - border-radius: 10px
                    - background-color: '#333'
                    - height: 100%
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_front_mon
                gridcol: 1 / 1
                gridrow: 4 / 6
                name: Mon
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_front_tue
                gridcol: 2 / 2
                gridrow: 4 / 6
                name: Tue
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_front_wed
                gridcol: 3 / 3
                gridrow: 4 / 6
                name: Wed
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_front_thu
                gridcol: 4 / 4
                gridrow: 4 / 6
                name: Thu
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_front_fri
                gridcol: 1 / 1
                gridrow: 6 / 8
                name: Fri
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_front_sat
                gridcol: 2 / 2
                gridrow: 6 / 8
                name: Sat
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_front_sun
                gridcol: 3 / 3
                gridrow: 6 / 8
                name: Sun
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - gridcol: 4 / 4
                gridrow: 6 / 6
                name: Clear
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                tap_action:
                  action: call-service
                  service: input_boolean.turn_off
                  service_data:
                    entity_id:
                      - input_boolean.sprinkler_zone_front_mon
                      - input_boolean.sprinkler_zone_front_tue
                      - input_boolean.sprinkler_zone_front_wed
                      - input_boolean.sprinkler_zone_front_thu
                      - input_boolean.sprinkler_zone_front_fri
                      - input_boolean.sprinkler_zone_front_sat
                      - input_boolean.sprinkler_zone_front_sun
                type: 'custom:button-card'
              - gridcol: 4 / 4
                gridrow: 7 / 7
                name: All
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                tap_action:
                  action: call-service
                  service: input_boolean.turn_on
                  service_data:
                    entity_id:
                      - input_boolean.sprinkler_zone_front_mon
                      - input_boolean.sprinkler_zone_front_tue
                      - input_boolean.sprinkler_zone_front_wed
                      - input_boolean.sprinkler_zone_front_thu
                      - input_boolean.sprinkler_zone_front_fri
                      - input_boolean.sprinkler_zone_front_sat
                      - input_boolean.sprinkler_zone_front_sun
                type: 'custom:button-card'
            column_width: 100%
            gridcols: 25% 25% 25% 25%
            gridrows: 35px 35px 50px 35px 35px 35px 35px
            layout: grid
            type: 'custom:layout-card'
          - type: divider
          - entity: input_number.sprinkler_zone_1_run_time
            icon: 'mdi:sprinkler'
            name: Zone 1
          - entity: input_number.sprinkler_zone_2_run_time
            icon: 'mdi:sprinkler'
            name: Zone 2
        show_header_toggle: false
        style: |
          ha-card layout-card {
            padding: 3px;
          }
        type: entities
      - entities:
          - cards:
              - content: '## Back Yard'
                style: |
                  ha-card {
                    background: rgba(0, 0, 0, 0);
                    box-shadow: none;
                  }
                  .markdown {
                    padding-left: 0px;
                  }
                type: markdown
              - entity: script.sprinkler_zone_back
                layout: icon_name
                name: Run Now
                size: 30px
                state:
                  - icon: 'mdi:play-circle'
                    value: 'off'
                  - icon: 'mdi:autorenew'
                    spin: true
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - background-color: '#333'
                tap_action:
                  action: call-service
                  service: script.toggle
                  service_data:
                    entity_id: script.sprinkler_zone_back
                type: 'custom:button-card'
            layout: horizontal
            min_columns: 2
            type: 'custom:layout-card'
          - conditions:
              - entity: script.sprinkler_zone_back
                state: 'on'
            name: Zone currently running
            row:
              entity: sensor.sprinkler_current_zone
              icon: 'mdi:numeric'
            type: conditional
          - conditions:
              - entity: script.sprinkler_zone_back
                state: 'on'
            row:
              entity: sensor.sprinkler_zone_back_time_remaining
              icon: 'mdi:progress-clock'
            type: conditional
          - conditions:
              - entity: script.sprinkler_zone_back
                state: 'off'
            row:
              entity: sensor.sprinkler_zone_back_last_cycle_time
              icon: 'mdi:clock'
            type: conditional
          - type: divider
          - cards:
              - entity: automation.sprinkler_zone_back_am
                gridcol: 1 / 3
                gridrow: 1 / 3
                name: AM Schedule
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: automation.sprinkler_zone_back_pm
                gridcol: 3 / 5
                gridrow: 1 / 3
                name: PM Schedule
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_datetime.sprinkler_zone_back_am_on_time
                gridcol: 1 / 3
                gridrow: 3 / 3
                layout: icon_state
                show_name: false
                show_state: true
                size: 30px
                styles:
                  card:
                    - border-radius: 10px
                    - background-color: '#333'
                    - height: 100%
                type: 'custom:button-card'
              - entity: input_datetime.sprinkler_zone_back_pm_on_time
                gridcol: 3 / 5
                gridrow: 3 / 3
                layout: icon_state
                show_name: false
                show_state: true
                size: 30px
                styles:
                  card:
                    - border-radius: 10px
                    - background-color: '#333'
                    - height: 100%
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_back_mon
                gridcol: 1 / 1
                gridrow: 4 / 6
                name: Mon
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_back_tue
                gridcol: 2 / 2
                gridrow: 4 / 6
                name: Tue
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_back_wed
                gridcol: 3 / 3
                gridrow: 4 / 6
                name: Wed
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_back_thu
                gridcol: 4 / 4
                gridrow: 4 / 6
                name: Thu
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_back_fri
                gridcol: 1 / 1
                gridrow: 6 / 8
                name: Fri
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_back_sat
                gridcol: 2 / 2
                gridrow: 6 / 8
                name: Sat
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - entity: input_boolean.sprinkler_zone_back_sun
                gridcol: 3 / 3
                gridrow: 6 / 8
                name: Sun
                size: 20px
                state:
                  - icon: 'mdi:cancel'
                    value: 'off'
                  - icon: 'mdi:check-circle'
                    styles:
                      card:
                        - box-shadow: 0 0 4px 2px var(--paper-item-icon-active-color)
                    value: 'on'
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                type: 'custom:button-card'
              - gridcol: 4 / 4
                gridrow: 6 / 6
                name: Clear
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                tap_action:
                  action: call-service
                  service: input_boolean.turn_off
                  service_data:
                    entity_id:
                      - input_boolean.sprinkler_zone_back_mon
                      - input_boolean.sprinkler_zone_back_tue
                      - input_boolean.sprinkler_zone_back_wed
                      - input_boolean.sprinkler_zone_back_thu
                      - input_boolean.sprinkler_zone_back_fri
                      - input_boolean.sprinkler_zone_back_sat
                      - input_boolean.sprinkler_zone_back_sun
                type: 'custom:button-card'
              - gridcol: 4 / 4
                gridrow: 7 / 7
                name: All
                styles:
                  card:
                    - border-radius: 10px
                    - height: 100%
                    - background-color: '#333'
                tap_action:
                  action: call-service
                  service: input_boolean.turn_on
                  service_data:
                    entity_id:
                      - input_boolean.sprinkler_zone_back_mon
                      - input_boolean.sprinkler_zone_back_tue
                      - input_boolean.sprinkler_zone_back_wed
                      - input_boolean.sprinkler_zone_back_thu
                      - input_boolean.sprinkler_zone_back_fri
                      - input_boolean.sprinkler_zone_back_sat
                      - input_boolean.sprinkler_zone_back_sun
                type: 'custom:button-card'
            column_width: 100%
            gridcols: 25% 25% 25% 25%
            gridrows: 35px 35px 50px 35px 35px 35px 35px
            layout: grid
            type: 'custom:layout-card'
          - type: divider
          - entity: input_number.sprinkler_zone_3_run_time
            icon: 'mdi:sprinkler'
            name: Zone 3
          - entity: input_number.sprinkler_zone_4_run_time
            icon: 'mdi:sprinkler'
            name: Zone 4
          - entity: input_number.sprinkler_zone_5_run_time
            icon: 'mdi:sprinkler'
            name: Zone 5
          - entity: input_number.sprinkler_zone_6_run_time
            icon: 'mdi:sprinkler'
            name: Zone 6
        show_header_toggle: false
        style: |
          ha-card layout-card {
            padding: 3px;
          }
        type: entities
      - cards:
          - entities:
              - script.sprinkler_zone_front
              - sscript.sprinkler_zone_back
            gridcol: 1 / 3
            gridrow: 1
            icon: 'mdi:power'
            name: Master Switch
            size: 30px
            state:
              - color: var(--paper-item-icon-active-color)
                icon: 'mdi:power'
                value: 'on'
            styles:
              card:
                - border-radius: 10px
                - background-color: '#333'
            tap_action:
              action: call-service
              service: script.turn_on
              service_data:
                entity_id: script.sprinkler_stop_all
            type: 'custom:button-card'
          - entity: switch.sprinkler_zone_1
            gridcol: 1
            gridrow: 2
            name: Zone 1
            size: 30px
            styles:
              card:
                - border-radius: 10px
                - background-color: '#333'
            type: 'custom:button-card'
          - entity: switch.sprinkler_zone_2
            gridcol: 2
            gridrow: 2
            name: Zone 2
            size: 30px
            styles:
              card:
                - border-radius: 10px
                - background-color: '#333'
            type: 'custom:button-card'
          - entity: switch.sprinkler_zone_3
            gridcol: 1
            gridrow: 3
            name: Zone 3
            size: 30px
            styles:
              card:
                - border-radius: 10px
                - background-color: '#333'
            type: 'custom:button-card'
          - entity: switch.sprinkler_zone_4
            gridcol: 2
            gridrow: 3
            name: Zone 4
            size: 30px
            styles:
              card:
                - border-radius: 10px
                - background-color: '#333'
            type: 'custom:button-card'
          - entity: switch.sprinkler_zone_5
            gridcol: 1
            gridrow: 4
            name: Zone 5
            size: 30px
            styles:
              card:
                - border-radius: 10px
                - background-color: '#333'
            type: 'custom:button-card'
          - entity: switch.sprinkler_zone_6
            gridcol: 2
            gridrow: 4
            name: Zone 6
            size: 30px
            styles:
              card:
                - border-radius: 10px
                - background-color: '#333'
            type: 'custom:button-card'
        column_width: 100%
        gridcols: 50% 50%
        gridrows: auto
        layout: grid
        type: 'custom:layout-card'
      - animate: true
        entities:
          - entity: sensor.dark_sky_temperature
        hours_to_show: 72
        name: Outside Temperature
        type: 'custom:mini-graph-card'
        update_interval: 3600
2 Likes

You are totally changing the way I think about my future dashboard building here, spent the better part of the weekend familiarizing myself with this and started piecing mine together, thanks a ton for the share. Also, shout out to @tom_l for your share up top, definitely helpful as I build and familiarize with HA more and more.

1 Like

Did Anyone design a PCB to reduce the wire need and make this clean ?
I am not good enough at pcb design for this :frowning:

That looks amazing @TJPoorman ! I’m working on integrating my new ESPHome-based sprinkler node and think your Lovelace front-end is exactly what the doctor ordered!

Any chance you would share your supporting scripts, automations, inputs and sensor templates, etc. for this? I started looking at your SplHAsh YAML on GitHub, and tom_l’s examples above, as references to try and cobble something together in my HA instance. It didn’t take long to convince me that your supporting scripts and components would far exceed anything I could hack together, judging from the quality and detail in your front end.

Great work, and thank you for sharing with the community!

I’ve updated my Github to have my full setup in the examples you could check out.