From 9dad6de12efb9d97d608221b0603f91d95b4a73e Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Wed, 3 Oct 2018 18:10:25 -0400 Subject: [PATCH] Errata re: max_values for rainfall --- content/post/automating-your-hose.md | 44 +++++++++++++++------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/content/post/automating-your-hose.md b/content/post/automating-your-hose.md index b28e9e9..eb46249 100644 --- a/content/post/automating-your-hose.md +++ b/content/post/automating-your-hose.md @@ -360,10 +360,10 @@ sensor: value_template: >- {% if states.sensor.tfh_precipitation_stats_mean.attributes.max_value <= 0.1 %} 0.0 - {% elif states.sensor.tfh_precipitation_stats_mean.attributes.max_value < 4.0 %} - <4.0 - {% elif states.sensor.tfh_precipitation_stats_mean.attributes.max_value >= 4.0 %} - >4.0 + {% elif states.sensor.tfh_precipitation_stats_mean.attributes.max_value < 0.5 %} + <0.5 + {% elif states.sensor.tfh_precipitation_stats_mean.attributes.max_value >= 0.5 %} + >0.5 {% endif %} 48h_precipitation_history: friendly_name: "48h precipitation history" @@ -372,10 +372,10 @@ sensor: value_template: >- {% if states.sensor.feh_precipitation_stats_mean.attributes.max_value <= 0.1 %} 0.0 - {% elif states.sensor.feh_precipitation_stats_mean.attributes.max_value < 4.0 %} - <4.0 - {% elif states.sensor.feh_precipitation_stats_mean.attributes.max_value >= 4.0 %} - >4.0 + {% elif states.sensor.feh_precipitation_stats_mean.attributes.max_value < 0.5 %} + <0.5 + {% elif states.sensor.feh_precipitation_stats_mean.attributes.max_value >= 0.5 %} + >0.5 {% endif %} ``` @@ -388,12 +388,12 @@ sensor: # Hose control structures # # Basic idea: -# If it rained <4.0mm in the last 48h, run for 1h -# If it rained >4.0mm in the last 48h, but 0.0mm in the last 24h, run for 30m -# If it rained <4.0mm in the last 24h, run for 15m -# If it rained >4.0mm in the last 24h, don't run tonight +# If it rained <0.5mm in the last 48h, run for 1h +# If it rained >0.5mm in the last 48h, but 0.0mm in the last 24h, run for 30m +# If it rained <0.5mm in the last 24h, run for 15m +# If it rained >0.5mm in the last 24h, don't run tonight -# Turn on the hose at 02:00 if there's been <4.0mm of rain in the last 24h +# Turn on the hose at 02:00 if there's been <0.5mm of rain in the last 24h - alias: 'Hose - 02:00 Timer - turn on' trigger: platform: time @@ -403,7 +403,7 @@ sensor: conditions: - condition: state entity_id: sensor.24h_precipitation_history - state: '<4.0' + state: '<0.5' - condition: state entity_id: sensor.24h_precipitation_history state: '0.0' @@ -411,8 +411,8 @@ sensor: service: homeassistant.turn_on entity_id: switch.hose_a -# Turn off the hose at 02:15 if there's been <4.0mm but >0.0mm of rain in the last 24h -- alias: 'Hose - 02:15 Timer - turn off (<4.0mm/24h)' +# Turn off the hose at 02:15 if there's been <0.5mm but >0.0mm of rain in the last 24h +- alias: 'Hose - 02:15 Timer - turn off (<0.5mm/24h)' trigger: platform: time at: '02:15:00' @@ -424,13 +424,13 @@ sensor: state: 'on' - condition: state entity_id: sensor.24h_precipitation_history - state: '<4.0' + state: '<0.5' action: service: homeassistant.turn_off entity_id: switch.hose_a -# Turn off the hose at 02:30 if there's been >4.0mm in the last 48h but 0.0 in the last 24h -- alias: 'Hose - 02:30 Timer - turn off (>4.0mm/48h + 0.0mm/24h)' +# Turn off the hose at 02:30 if there's been >0.5mm in the last 48h but 0.0 in the last 24h +- alias: 'Hose - 02:30 Timer - turn off (>0.5mm/48h + 0.0mm/24h)' trigger: platform: time at: '02:30:00' @@ -445,7 +445,7 @@ sensor: state: '0.0' - condition: state entity_id: sensor.48h_precipitation_history - state: '>4.0' + state: '>0.5' action: service: homeassistant.turn_off entity_id: switch.hose_a @@ -469,3 +469,7 @@ Tada! Automated watering based on the rainfall! ### Conclusion This was a fun little staycation project that I'm certain has great expandability. Next year once the garden is arranged I'll probably start work on a larger, multi-zone version to better support the huge garden. But for today I love knowing that my hose will turn itself on and water the garden every night if it needs it, no involvement from me! I hope you find this useful to you, and of course, I'm open to suggestions for improvement or questions - just send me an email! + +### Errata + +*2018-10-03*: I realized that 4.0mm of rain as an automation value was quite high. Even over a few days of light rain, it never reported above 1.0mm at any single ~2h interval, let alone 4.0mm. So 0.5mm seems like a much nicer value than 4.0mm for the "it's just lightly showered"/"it's actually rained" distinction I was going for. The code and descriptions above have been updated. One could also modify the templates to add up the 24h/48h total and base the condition off the total, which is a little more clunky but would be more accurate if that matters in your usecase.