Garden Irrigation

I’m glad you like it and I think you summed up pretty well how I planned the system! Yes if you choose alternate days I think it will do what you need.

For temperature it looks at the previous few days and then averages it. you can set the baseline temperature before it starts to adjust the time up or down.

For rainfall it looks at the previous few days and weights the effect depending on how many days ago the rain fell. Again you can set a baseline.

All the calculations are described in the comments in the code but as I said, I decided I might have been over thinking everything so in the end I kind of left things where they are now. It does do some reasonable looking adjustments (although we’ve had no rain here for a while) but you can probably come up with better algorithms. Mine are based on other ideas I have seen around in other forums when searching for ideas.

You are right, some actual physical sensors would probably be best but I have no intention right now of getting any. I wanted to write my system to be as modular and expandable as possible (within the very restrictive confines of HA and yaml config files!!!) so hopefully you will be able to add these features if you want them.

Good luck with using it, it is good to know that it might be useful for someone else.

1 Like

@klogg: i have some more questions. i now reduced your setup to only cylce (removed the evening cycle, and added it’s times to the morning cylcle - just in case i want to let it rain in the afternoon).
so i wonder: why can you manually input rainfall and temperature for the last days manually? this data should be gathered automatically, and i don’t see the need to change it?!

Yes, you are right. The UI as I have it configured only displays the sensors which are based on the input_numbers. I have a Garden view:

  garden_view:
    view: yes
    name: Garden
    icon: mdi:flower
#    icon: mdi:barley
    entities:
    - group.master_control
    - group.irrigation_information
    - group.irrigation_cycle1
    - group.irrigation_cycle2
    - group.irrigation_cycle1_status
    - group.irrigation_cycle2_status
    - group.irrigation_valves
    - group.cycle1_weather_settings
    - group.cycle2_weather_settings

my question maybe got lost in translation: WHY is there a way to manually input rain and temp data?
this should be autofilled by the system, shouldn’t it?

The input_numbers are only used to hold the historic values they are not meant to be used manually.

ok. i see. this is just a hass issue. those things clutter your home screen a lot.
they should find a solution to “hide” things like that, and still show what is new and necessary.

part of my home screen:

1 Like

Yes, I agree the home page is a lot of clutter!
You can set up your own default home page which will stop that happening but off the top of my head I can’t remember how. I haven’t done it yet.

So I’ve set up your package and I absolutely love , except I’m having one issue where the “manual run” options don’t actually seem to be triggering anything. The programs work and the basic “switch” entities work, but that group of manual run options don’t actually trigger the switch. Unfortunately it also doesn’t log any errors either so I have no idea.

I’m entirely new to YAML so I’m not super sure what I’m doing, but I couldn’t find what those entities actually reference in your code package. Am I missing a piece?

it’s strange, but i can’t get any rain updates. it did rain yesterday, and dark sky knew showed it, but still the historic weather shows 0.

image

is it only these two lines of code that care about rain calculations?

 {{ float(states.sensor.dark_sky_precip_intensity.state) * 24 *
    (float(states.sensor.dark_sky_precip_probability.state) / 100) }}

btw: do i read your comment correctly, that the (highly floating) number given by dark sky does NOT show the rain to be expected at the give time, but the average amount of rain over the whole day? because you’re multiplying that number by 24.
so e.g. taking this screenshot of yesterday:

image

what would be the total mm (or liters) of rain per m2 to be expected?
0.08 * 24 ? or does it mean that it would rain at 8pm for ~ an hour?

Hmm… rain.

It’s a problem. I tested it all when we were having little or no rain here using the input_numbers to manually adjust the history. I have noticed, now that we have had loads of rain (are you in the UK by any chance!!?) that the DarkSky rain sensors do not really give the information I thought they did. I spent quite a lot of time trying to research a source of actual rainfall for a given day but clearly I got it wrong. Even people on the DarkSky forums complain that the api data fields are not well documented.

I have since discovered (I think) that the OpenWeatherMap api can give the actual rainfall for the last 3 hours which if I’m right would be perfect and easy to incorporate in my code. However the HA OWM sensor only returns the forecast figures from OWM.

I wonder if anyone reading this knows how to code an add-on to get the rainfall figures? (I don’t).

I’m afraid that whilst my code works in principle, getting a source of rainfall has proved impossible for me which is a shame as I think it is more useful than the temperature adjustment.

ok. makes sense. as you said: rain is the most vital source for cycle time adjustement.
e.g. it did rain really heavily last evening. only for 30min, but so heavy that you couldn’t see very far. so way enough to NOT irrigate the following day.
btw, i’m in austria.

I wonder if @sparkydave has done any better than I have with rain calculations?

EDIT: for what its worth I’ve added a feature request to expand the OWM sensor to include current rainfall (which is rainfall in the last 3 hours).

i guess not, as he wrote:

In terms of what I want the end solution to be, its only missing the rain / weather conditions which I will sort out in the near future

have you looked a WU sensors? they seem to give a more resonable output

image

and this gives the rainfall at a given time (i think)

image

Yes it does look better but the problem is I am not sure how to interpret it.
Is it telling us the actual amount of rain there has been so far today in total, for a number of hours, the amount forecast including the rest of the day…

I don’t understand why none of the weather providers seem to document their APIs in any detail. I might look into experimenting again with these figures but it probably won’t be for a few weeks now.

Let me know if you have a go and what results you get.

well, precipitation today (the first screenshot) seems to give the TOTAL rainfall in mm (of today? of the last 24h?). the curve shown is growing. so be replacing your darksky calculated (mm/h * 24 * possibility) by this value should be what we want. the curve also correlates to the second graph. it’s just the cummulated data.
as far as i understood the other values (rain yesterday, the day day before etc …) are taken from one the other every 24h. correct?

Ok, I couldn’t resist it. I have changed mine to use WU rainfall today. I’ll have to wait a few days to see if it is any better but here is what I changed:

Automation - Collect Weather Data, I commented out as follows

  # # Set today's forecast rain
  # # DarkSky precip_intensity is 'the average expected intensity of precipitation'
  # # measured in mm/h so multiply by 24 then multiply by the probability of rain.
  # # This is done here so that it is only done once a day after midnight.
  # # The forcast figues go up and down all day so the best we can do for history
  # # is take the whole day forecast, once only.
  # # We do NOT want to do it every time a re-calculation of the averages is performed.
  # #
  # #=== NOTE: Waiting until 10 minutes after midnight might not be right.
  # #=== I am not sure when the coming day forecast is updated.

  # - wait_template: "{{ states.sensor.time.state == '00:10' }}"

  # - service: input_number.set_value
  #   data_template:
  #     entity_id: input_number.rain_minus0
  #     value: >
  #       {{ float(states.sensor.dark_sky_precip_intensity.state) * 24 *
  #          (float(states.sensor.dark_sky_precip_probability.state) / 100) }}

script - calculate_average_weather_conditions, I changed this

  # Set today's rain
  - service: input_number.set_value
    data_template:
      entity_id: input_number.rain_minus0
      value: >
        {{ states('sensor.pws_precip_today_metric') }}

  # Adjust the total amount of rain depending on how many days ago it was.
  # If 3 days ago take 20% of the rain.
  # If 2 days ago take 50% of the rain.
  # If yesterday take 80% of the rain.
  # If today take it all.
  - service: input_number.set_value
    data_template:
      entity_id: input_number.rain_3days_ratio
      value: >
        {{ (float(states.input_number.rain_minus3.state) * 0.2) +
           (float(states.input_number.rain_minus2.state) * 0.5) +
           (float(states.input_number.rain_minus1.state) * 0.8) +
            float(states.input_number.rain_minus0.state) }}

Let’s see what happens!
(I’m tempted to add fourth day of rain history too using multipliers of 0.2, 0.4, 0.6 and 0.8 but that will be simple if I decide to do it)

i hope your WU collector works better than mine. at the moment it shows ‘–’ or zero in the overview, but 17mm as last value when you check the diagram.

image

Yes I noticed I got the ‘-’ earlier today too and have it again now. Also the graph has gone down so I don’t think it is telling us the accumulated rain for today, more likely the forecast for the rest of the day?

image

For me the WUnderground sensor ‘Precipitation Today’ shows the amount of precipitation since midnight, i.e. it resets every day and shows actual, not forecasted numbers.

It’s also in line with what my Ambient weather station tells me.

Yes, ‘Precipitation Today’ is what I have been using in my home grown system – I have an automation that fires at 11:30PM and flips an input boolean if it was over half an inch. That input boolean will delay another automation the following day from running the drip system and then a final automation flips the boolean back to off each day at 11PM.