Weather based irrigation

ok done :slight_smile: so far counter looks good :slight_smile:

BTW
Is it possible to add ā€œfutureā€ to show dynamically how long WBI plans to irrigate during next round ?
It would be extremely interesting to see how it change over a day, after rain, day etc.
The simplest method could be just update on input_number.wbi_pX_duration so it would be visible on slider.
If thatā€™s not possible, it can be even any new variable or whatsoever what can be presented in UI.

The other user friendly extras could be a variable or any sensor to show in UI next time (+day) when next irrigation is being scheduled. I know that it is visible in the config but you know how it is ā€¦ once put into config = thrown out from head :slight_smile: so a month later I would like to just look at UI and know that e.g. front will be irrigated on Thursday 4am.

difficult to do ?

The calculation is dynamic and based on the last day actual weather data not estimation. So it is not possible to do

ok i captured issue with accumulator

I did changed names as you suggested, so started with 0 again.
After restart all accumulators was counting util I turned on and off switch
see this:

fist one which I turned on and off
image

second one which I havenā€™t touched after HA restart:

image

so seems that this issue https://github.com/hhaim/hass/issues/10 is still valid.

ok I understand that this is calculated, but even if dynamic canā€™t you put calculated value into some variable or whatsoever ā€¦ just to see how value (planned irrigation time) is changing.

I did replaced accumulator with ā€œplatform: history_statsā€ sensor :slight_smile:
Just as a hint for others. this is e.g. config for one switch:

sensor:
  - platform: history_stats
    name: rainbird_zone1_history_today
    entity_id: switch.rainbird_zone_1
    state: 'on'
    type: time
    start: '{{ now().replace(hour=0, minute=0, second=0) }}'
    end: '{{ now() }}'

  - platform: history_stats
    name: rainbird_zone1_history_yesterday
    entity_id: switch.rainbird_zone_1
    state: 'on'
    type: time
    end: '{{ now().replace(hour=0, minute=0, second=0) }}'
    duration:
      hours: 24

  - platform: history_stats
    name: rainbird_zone1_history_week
    entity_id: switch.rainbird_zone_1
    state: 'on'
    type: time
    end: '{{ now().replace(hour=0, minute=0, second=0) }}'
    duration:
      days: 7

  - platform: history_stats
    name: rainbird_zone1_history_month
    entity_id: switch.rainbird_zone_1
    state: 'on'
    type: time
    end: '{{ now().replace(hour=0, minute=0, second=0) }}'
    duration:
      days: 30

  - platform: history_stats
    name: rainbird_zone1_history_alltime
    entity_id: switch.rainbird_zone_1
    state: 'on'
    type: time
    start: '{{ 0 }}'
    end: '{{ now() }}'

1 Like

Thanks @hhaim. Seems to work fine. At least it irrigates based on the plan.
But one thing that puzzles me, is the always declining EV remaining. It started positive +500 when I started, and now sits at -1500 and wonā€™t move up, not with rain, and not with irrigation.

See this picture:

Red is the EV, and Cyan is EV-remaining.
Below is rain for the hour and accumulated rain (last 4 days)

Thanks hhaim for your work and the sharing!

Iā€™ve had some difficulties to do it working with AppDaemon 4.0.3 and to cleanup correctly your different libraries to keep only the irrigation part but now everything seems to be running :slight_smile:

This night the taps queue went up from -1300 to 3000 (max value in my conf), which is a bit weird because the ev was 66 and the total rain yesterday was 5.5 mm (eq 495 with the 90 factor) so I thought the new taps queue will be -1300 - 66 + 495 = -871 but I should miss somethingā€¦ any idea ? In any case Iā€™ve changed the max queue value to 100000 and will let it running few more days to better understand the calculationā€¦

And there is perhaps an issue with the latest HA release (0.109), have a look to the ā€œDetection of blocking I/O in the event loopā€ section in https://rc.home-assistant.io/blog/2020/04/29/release-109/ , I have some of these log entries in my environment coming from the get(url) of your sensor.py.

@nico17 your calculation is right, it does not make sense.

hi all, based on the excellent work by @hhaim and with his help I have been able to create an alternative solution that does the same thing :slight_smile: It is here: https://github.com/jeroenterheerdt/HAsmartirrigation.

Differences:

  • my solution requires you to provide info on your irrigation so it can calculate just how long it needs to run to compensate for net evaporation (=evaporation - precipitation). @hhaimā€™s solution did not work for me.
  • my solution considers rain and snow, @hhaim previously focused on just rain.
  • my solution does not use AppDeamon, it is just one custom component and an automation. I think it is cleaner that way.
  • installable through HACS and configurable through configuration flow.

please take it for a spin!

3 Likes

@jeroenterheerdt I installed it and looks awesome!

One question: can I change the initial set up parameters afterwards (e.g.: sprinkler flow)?

Thanks!

1 Like

For now you have to reinstall the component to do that. Looking into changing that though.

Hi @jeroenterheerdt, nice work!
I have 3 valves, each one independently controlled by a sonoff relay, and each one of them sends water to 10-15 sprinklers. How should it be set up? Also, how is area affecting the calculations?

hi @nassost thanks for checking in! I would treat the 3 valves as 3 zones, so you would add the custom component three times. For each of the valves/zones/instances you can then configure the number of sprinklers, the flow and the area. The area is important because it allows the component to calculate precisely how many mm/inch per minute it adds to the soil across the whole area it can reach.
Hope that helps.

1 Like

Iā€™m using wbi for 1 month now :slight_smile:

I donā€™t know why the calculations were wrong the first night (perhaps because of lots of reboot / code changesā€¦) but everything was working fine after that, thanks @hhaim ! :+1:

Iā€™ve only changed the heat_app.py code because in my environment the variable.wbi_last_duration_px was initially an accumulation of durations (by using var_inc), and Iā€™ve preferred to have only the last duration. Iā€™ve also changed the async_track_utc_time_change in sensor.py because I thought it was better to have the daily update just before running the irrigation to avoid irrigating although itā€™s raining for several hours :laughing:

The tuning possibilities are very clever. I only have one suggestion to be able to benefit full capabilities of them: put the max_ev / min_ev at the tap level. I have 6 taps which are irrigating very different things, for instance I have one tap which irrigates potted flowers and an other one which irrigates big hedges. For potted flowers I would tend to put a max_ev near 0 to avoid in summer too much days without water after a big rain, while I donā€™t have any problem to stop irrigating my hedges for 2 weeks after big rains and put an important max_ev for that :slight_smile:

@nico17 in regards to the last duration, it reminds me the first month that I have been looking into it to verify that it working correctly. I donā€™t touch it and donā€™t look into it anymore, It just works for more than a year now. In my experience grafana + influx are the tool to look into the history for example, monthly water consumption/Eto/Rain per each tap etc.

The weather started to be very strange lately have a look into this

This is the last month per tap/total water consumption, the main consumer is my son that used to do 1 hour shower :slight_smile:
image

There was a week with 650 ev per day (I think it was the hottest in the last 10 years) while the average in the summer is ~250. The WBI did it right without intervention and put x2 water than the hottest month.

In regards to the max/min per tap I think this is a good idea!

@hhaim interesting! :slight_smile:

Could you please tell me what is the initial goal of the get_fao56_factor function in sensor.py?
I have the feeling it returns just 1 between sunrise and sunset and 0 otherwise, but I should miss something.

@nico17 you are right, it should be 1 in the sunrise and sunset and 0 at night, but it could return 0.5 in the sunset hour to more accurate with fao56 integral results

@hhaim ok, thanks! I didnā€™t get the algorithm considers there is no evaporation during night hours :slight_smile:

@nico17 it is more than that. The sample is every hours and it could be that there are only 12.7 hours of day light, without this function it would be considered as 13. This function do the 0.7 correction.

Maaan really looking to test your app. Iā€™ve just finished garden - Iā€™ve installed a 24 V gardena irrigation system controlled by Sonoffs. I have 6 different sections and each of them can be switched on/off (2x Sonoff 4ch pro).

How does it work for you after those months? Is there anything youā€™d change or you are still satisfied?

Thank you!