I have created an input_value which will be daily at 23:59 be filled with the current value of the day.
My goal is to have a sensor with the sum of the last 7 days to steer my irrigation system.
My code looks like the following:
sensor:
- platform: statistics
unique_id: niederschlag_letzte_7_tage_in_mm
name: "Niederschlag letzte 7 Tage in mm"
entity_id: input_number.niederschlag_gestern_in_mm
state_characteristic: sum
max_age:
days: 7
sampling_size: 7
Within the last week there was only one day with rain:
Yes thats true, but I need for my automation always the value from the last 7 days.
Do you have a recommendation maybe?
I are not 100% precent working.
With my current I think it is the best, but afte rebooting HA I got the feeling that the valuie is added twice.
Like when it is switching again from 0/null or unavailable to the last value and this is added again and so the statistics calculates it.
I just checked again, the intitial value is - initial: null
Those aren‘t sensors.
All I am using are input_numbers which I am filling each night once with the last values.
I am doing this because my sensor are sending not constant updstes and so it is hard to define a valid statistics.
With 7 values within 7 days for an input_number I thoughtbit is more robust.
What I am triing also now is to create an input_number in parallel with initial=0 to avoid the double adding.
Need some weeks to test this. Because my feeling will bw that i have now less values.