Sonoff humidity SNZB-02P - create humidity statistics

Hello,

I am very new to HAOS.
What I am trying to create is a dynamic statistics for humidity.
For example, collect 1000 reading values and based on them to update the automation trigger below/above thresholds. The idea is that in the winter the humidity in the bathroom is greater and the threshold value should be high, so that the wall fan won’t work all the time.
I have read about helpers and etc. but have no idea how to store the readings from the humidity sensor and to use them.
Please give me some ideas or hints.
Thank you!