I have automated my Garden sprinklers using Smart irrigation custom component.
This uses the daily rainfall as one of the calculation inputs. Now I want to run the sprinklers at 6 in the morning, but my Netatmo daily rain sensor resets at Midnight.
Since I also want to use rain that falls between then and 6 in the morning for the calculation, I need a way to store last days value showrtly before midnight and add anything that comes in after.
Also the value measured till 6 has to be subtracted the next day.
It uses an input_number helper, 2 Automations and a template sensor.
Automation to store rain fallen until 6 in the morning:
alias: Store rain at 6
trigger:
- platform: time
at: '06:01:00'
condition: []
action:
- service: input_number.set_value
data_template:
value: '{{ states("sensor.netatmo_regenmesser_rain_today") | float }}'
entity_id: input_number.regenspeicher
mode: single
Before the reset of rain_today at midnight, the same input_number is used to store rain from 6-24 (subtracting rain until 6 o’clock from the total of the day):
alias: Store rain before 12
trigger:
- platform: time
at: '23:59:00'
condition: []
action:
- service: input_number.set_value
data_template:
value: >-
{{ (states("sensor.netatmo_regenmesser_rain_today") | float -
states("input_number.regenspeicher") | float) | round(1) }}
entity_id: input_number.regenspeicher
mode: single
Since Smart Irrigation expects the rain amount from a sensor, I defined a template sensor, that adds the stored value to the current rain_today: