I use the following statistics sensor which is doing what I need but it stores a lot of data and I would like to reduce it.
- platform: statistics
entity_id: sensor.wind_speed
name: wind speed ss 90 m4
state_characteristic: mean
sampling_size: 90
max_age:
minutes: 4
To be honest I made it 2 years ago and until now I am not sure how the particular sensor works.
I have set it to 4 minutes so if I understand correct each minute it gets 6 measurements (1 every 10 sec) so in 4 minutes there are total 24 measurements. ?
If that is right the what the sampling size does?
This sensor produces a graph like this
As I said the above measurements are accurate but I am wondering if I can fine tune in order to reduce the file size that it produce in my database (like the following)
No, it is limited by the max_age. But it may have allocated that amount of storage to be used, someone better at reading the source than me would have to check.
Then there’s not much else you can do unless you can change the reporting interval.
How the statistics sensor calculate the mean number? for example in a minute I have 6 measurements. So if it was set to make the calculation every minute then I would get 1 mean every minute. But how does it calculate the second minute/number? Does the result derives from the last 6 measurements of the second minute only?
2. I am using an esp8266 to import the measurements in HA. I used this code
Lately I have installed and use espHome. If I install a new esp8266 in esphome and copy paste this code, do you think it could work?