[Help] Automation based on average humidity

Hello!
I have this idea of an automation that I don’t know where to start with.
My apartment has an attic which is currently monitored with a thermometer/hygrometer. During winter I use this attic to dry laundry. During this process the value of humidity varies like this:

  • average with no wet clothes: 40 - 43 %
  • 1-2 hours after hanging the clothes: humidity jumps to 50 - 55 %
  • while the clothes are drying the humidity slowly dropping back to normal over the course of 2 - 3 days
    Now I would like to have an automation like this:
  • keep an 3-6 hours average of the humidity
  • if the humidity spikes by 10 % over this average put binary sensor to “wet clothes”
  • in the average humidity over 3-6 hours drops back to the initial average put the binary sensor to “dry clothes” and issue a notification to several Android phones, but only during the day (between 08:00 and 21:00)
    Can something like this be made?
    Thanks for your help!

PS: Humidity values and average length are approximate and subject to change depending on observed data.

I haven’t really used it much but I think you could use the custom “average” sensor to get the average humidity.

then you could use that to set up the automations.