I like to calculate the avarage energy level (W) over the last 5 minutes.
What is my goal?
I have solar panels and I want to switch on/off a device when the panels start to produce energy. But when they start the amount is not so high and if someone is in the house and switches stuff on and off then it can make large steps from negative energy to positive and back. T prevent to much flipping i use a timer now, but a much better approch is to use average data over a certain period, to prevent to much switching my device on and off.
Also due to clouds the energy levels can very a lot.
I found the thread how to calculate the average humidity, but that’s a continues average and not an average over the last 5 minuts.
What I thought but cannot find: can I use the history of Insights in a flow card, to calculate an average, max, min, sum, etc. over the last 1, 5, 10, 15, 30, 60 minutes and maybe even hours and day’s? The numbers are there, but how to use them in a flow?
Numbers for example (in W):
Normal use: 200, no one at home (NAS, Homey, cameras, etc).
Washing machine 2200
Fohn / vacume cleaner, dishwasher, etc…
Solar full sun: -2400
Solar with cloud -10 till -1200