Hello,
How can I calculate a mean value only once per day (not continuously)?
Is it possible in a {{ template expression }} that would be triggered by an automation?
Or is it possible to combine a trigger template with statistics?
Of course I could configure a statistic sensor that would calculate all day long the average value. Then I could have a trigger sensor capturing that value once a day.
But I don’t need HA to be continuously calculating the mean value 24h just to give me one result.
To give you more context, this is my chickens eating activity calculated by a load sensor in ESPhome together with day/night (night is dark):
Normally the chicken eat the same amount each day, during the night period and the graph should presend a descending stairway at night like in this screenshot.
In case of problem (jammed feeder) the graph will stay stable.
I want to calculate the average value each night and check if the progression is constant, otherwise, it means there is a problem.
You can see the activity (feeding) during the day, and the remaining quantity of food stable at night.
Each morning at 4:00 I want to calculate the average value during the last 8h and keep the last 11 values.
Then I will compare the latest differential value (day - previous day) with the medium value of the previous 10 days. If the value is 50% inferior, that mean the chicken did not eat enought yesterday and I need to check the automatic feeder probably jammed.
Any help will be welcome!!