Errata re: max_values for rainfall

This commit is contained in:
Joshua Boniface 2018-10-03 18:10:25 -04:00
parent 27d8f1d3af
commit 9dad6de12e
1 changed files with 24 additions and 20 deletions

View File

@ -360,10 +360,10 @@ sensor:
value_template: >- value_template: >-
{% if states.sensor.tfh_precipitation_stats_mean.attributes.max_value <= 0.1 %} {% if states.sensor.tfh_precipitation_stats_mean.attributes.max_value <= 0.1 %}
0.0 0.0
{% elif states.sensor.tfh_precipitation_stats_mean.attributes.max_value < 4.0 %} {% elif states.sensor.tfh_precipitation_stats_mean.attributes.max_value < 0.5 %}
<4.0 <0.5
{% elif states.sensor.tfh_precipitation_stats_mean.attributes.max_value >= 4.0 %} {% elif states.sensor.tfh_precipitation_stats_mean.attributes.max_value >= 0.5 %}
>4.0 >0.5
{% endif %} {% endif %}
48h_precipitation_history: 48h_precipitation_history:
friendly_name: "48h precipitation history" friendly_name: "48h precipitation history"
@ -372,10 +372,10 @@ sensor:
value_template: >- value_template: >-
{% if states.sensor.feh_precipitation_stats_mean.attributes.max_value <= 0.1 %} {% if states.sensor.feh_precipitation_stats_mean.attributes.max_value <= 0.1 %}
0.0 0.0
{% elif states.sensor.feh_precipitation_stats_mean.attributes.max_value < 4.0 %} {% elif states.sensor.feh_precipitation_stats_mean.attributes.max_value < 0.5 %}
<4.0 <0.5
{% elif states.sensor.feh_precipitation_stats_mean.attributes.max_value >= 4.0 %} {% elif states.sensor.feh_precipitation_stats_mean.attributes.max_value >= 0.5 %}
>4.0 >0.5
{% endif %} {% endif %}
``` ```
@ -388,12 +388,12 @@ sensor:
# Hose control structures # Hose control structures
# #
# Basic idea: # Basic idea:
# If it rained <4.0mm in the last 48h, run for 1h # If it rained <0.5mm 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 >0.5mm 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 <0.5mm 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 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' - alias: 'Hose - 02:00 Timer - turn on'
trigger: trigger:
platform: time platform: time
@ -403,7 +403,7 @@ sensor:
conditions: conditions:
- condition: state - condition: state
entity_id: sensor.24h_precipitation_history entity_id: sensor.24h_precipitation_history
state: '<4.0' state: '<0.5'
- condition: state - condition: state
entity_id: sensor.24h_precipitation_history entity_id: sensor.24h_precipitation_history
state: '0.0' state: '0.0'
@ -411,8 +411,8 @@ sensor:
service: homeassistant.turn_on service: homeassistant.turn_on
entity_id: switch.hose_a 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 # 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 (<4.0mm/24h)' - alias: 'Hose - 02:15 Timer - turn off (<0.5mm/24h)'
trigger: trigger:
platform: time platform: time
at: '02:15:00' at: '02:15:00'
@ -424,13 +424,13 @@ sensor:
state: 'on' state: 'on'
- condition: state - condition: state
entity_id: sensor.24h_precipitation_history entity_id: sensor.24h_precipitation_history
state: '<4.0' state: '<0.5'
action: action:
service: homeassistant.turn_off service: homeassistant.turn_off
entity_id: switch.hose_a 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 # 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 (>4.0mm/48h + 0.0mm/24h)' - alias: 'Hose - 02:30 Timer - turn off (>0.5mm/48h + 0.0mm/24h)'
trigger: trigger:
platform: time platform: time
at: '02:30:00' at: '02:30:00'
@ -445,7 +445,7 @@ sensor:
state: '0.0' state: '0.0'
- condition: state - condition: state
entity_id: sensor.48h_precipitation_history entity_id: sensor.48h_precipitation_history
state: '>4.0' state: '>0.5'
action: action:
service: homeassistant.turn_off service: homeassistant.turn_off
entity_id: switch.hose_a entity_id: switch.hose_a
@ -469,3 +469,7 @@ Tada! Automated watering based on the rainfall!
### Conclusion ### 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! 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.