Custom template challenge: creating washing drying time sensor

Hi all, I am looking for some help to get a custom template sensor up and running that essentially tells me the optimal time to bring in washing if it has been hung outside to dry. My vision is a sensor that either returns a time of the day when clothes would no longer be drying, or something like “Now” if the conditions are no longer optimal.

To determine the correct time, I was planning on asking chatGPT to come up with a simple formula that comes up with a weighted score based on the current time of day, sunset time, weather conditions (sunny, rainy, stormy, etc.), temperature, humidity and dew point temperature (if available), and then comparing the score against a particular threshold to determine what time to bring in clothes that may be outside as they would no longer be drying. I would then play around with weightings or the threshold to determine what works in my situation.

Additionally, in order to determine the correct time in the future, this formula would have to be evaluated for several time intervals throughout the current day. I was hoping to get the resolution down to 10 minutes, and then re-evaluate the scores every 5 minutes so that the optimal time may continuously update as the conditions change.

Finally, I would then create a second sensor that essentially does the same thing for the following day, in which case the sensor might return something like “Not optimal to dry” if there isn’t something like 5 hours of optimal conditions to dry.

I would like to set this up in my templates.yaml file but understand that I might also need some automations to fetch the weather data every 5 minutes. I was originally planning on using the default HA weather integration to achieve this but am not sure if this is the best option (especially the resolution I am after).

Other than this information, I have made no solid progress towards this dream, so any help would be hugely appreciated!

Add wind speed to that set of parameters.

There are clothes drying equations and papers available. A quick search found this (paywalled) paper: https://www.jstor.org/stable/2102313

This: https://www.reddit.com/r/kustom/comments/v6tyfe/clothes_drying_equation/

And this: Clothesline drying time calculator

1 Like

Thanks for these related links. This is pretty much exactly what I was thinking, but showing the time when there’s no point leaving them outside as a sensor value. I’m happy to rely on a simple formula, which I can calculate later. My problem is actually setting up the template in HA and linking it correctly to a weather integration.