To line dry or not to line dry?

To line dry the laundry, or use the drying machine?

Seems like a simple enough question, but there were a number of variables to consider, BUT homeassistant has information on many of those things already…

First thing is how long will it take the clothes to dry… seems like evaporation calculations could be done, and I found a paper with a formula here:

So I started by working that down to something I could put into home assistant as a template sensor…
That gave me this mess (which i think is mostly right, but if you want to double check feel free.):

{%set weather_entity="weather.kane_daynight"-%}
{%set sunshine_percent=(states.sensor.solaredge_current_power.state|float/6000) -%}

{%set temp = ((state_attr(weather_entity,temperature)|int)-32)*5/9+273-%}
{%set wind = (state_attr(weather_entity,wind_speed)|float)/2.237-%}
{%set humidity = state_attr(weather_entity,humidity)|float/100 -%}
{%set pressure = state_attr(weather_entity,pressure)|float*33.86389/10-%}
{%set rn = 9.4*sunshine_percent-%}

{%set delta=((5336/temp)**(21.07-(5336/temp))) -%}
{%set lamda=2.501-0.002361*(temp-273)-%}
{%set y=(0.0016286*pressure)/lamda-%}
{%set ea=1**(21.07-(5336/temp))-%}
{%set d=(1-humidity)*ea-%}
{%set e=(delta*rn+y*(6.43*(1+0.536*wind)*d))/(lamda*(delta+y))-%}

That should return the number of minutes for a towel to dry on the line, based off of the temperature, windspeed, relative humidity, pressure and “net irradiance of sunlight”. (better measures could probably be made around my thickeest towels and how much water my washing machine squeezes out in a spin cycle, but for now I just used the towel example from the paper and rounded generously, seems over estimating the dry time is preferable to under estimating it.)

The first 4 data points I can pull from any weather station, the “net irradiance of sunlight” is a function of the time of year, and location (which should be something that could be calculated), but also the clouds, and any shade that might be cast on the clothes line. for my needs right now put in some close enough numbers for the max irradiance this time of year by me, and multiplied it out by the percentage of solar power my panels are creating (6kw being the inverter is maxed out).

If you think my math is off, feel free to fix it, but the results I’m getting seem to be in the ball park of what I’d expect.

Now that I know roughly how long clothes will take to dry I can start to look at other items… like will they dry before the sun sets (don’t want to leave them out over night) and will there be rain before they are dry?

So for that I used another template in the notifications I send when the washing machine is done:

    The Washing Machine is done.{% if
    (states.sensor.line_dry_time.state|int/60)|int <
    and states.sensor.line_dry_time.state|int+1 > 0 %}You have time to line dry
    before sunset.Estimated Time to dry is
    {{(states.sensor.line_dry_time.state|int/60)|round(1)}} hours.{%- for cat in -%}{%- if
    cat.precipitation_probability >0 and loop.index <
    (states.sensor.line_dry_time.state|int/60)|int+1%}There is a
    {{cat.precipitation_probability}}% chance of rain in {{loop.index}} hours
    from now.{%- endif %}{%- endfor %}{%- endif %}

There is probably lots of room for improvements, looking at forecast data and breaking it down that way could probably give a more accurate result (things like putting clothes out 3 hours before sunset and expecting them to dry as the line gets less and less sun would be problematic.)

But over all I thought this would be an interesting project to undertake. I’ve only had one load of laundry out with an estimated time, and only one or two garments were still damp after the initial estimated time passed, so we’ll see how much I need to refine it to get an accurate estimate if the weather holds out for drying laundry on the line.


This is ridiculous and I love it. Especially how you pull data in from a solar panel! I thought that my household realfeel temperature calculation to control my whole house fan was a bit much… This is amazing!

Hey @Dolores, how do you calculate the household realfeel temperature?

I’ve deleted my code because I’ve since removed my fan on account of my wife’s demands that we get AC, but I think that I used the first formula in this thread. It looks like it has been improved in this post, and much easier to copy due to using variables!

Do note (you can look at a table) that these values only differ from the plain temperature once it gets quite hot and humid.

1 Like

I updated the templates above… some of the unit conversions might be off if your not using the same units for weather data as I am, in the second block I convert temp from Fahrenheit to kelvin, wind from mph to m/s, humidity from a percent to a decimal, and pressure from inches mg to kpa. so adjust to match your starting units. (maybe I’ll try to figure out how to get templates to figure out and convert to the correct units on their own some day).

Percentage sunshine is just a percentage for how much the sun is shining when 100% is the brightest it gets (6kw of power from 6kw solar inverter) and 0% is that it is dark out. (I would guess a lux meter or other sensors might be able to get a similar number, percentage cloud cover from a weather sensor might work too?)

The 0.2 on the last line is the kg of water per square meter, I used the numbers given by the paper linked above for a towel (thick and absorbent). You can try to measure the weight of your own laundry after it comes out to the wash, and subtract that by the weight dry, and then divide by the number of square meters in your wash… or just use 0.2 like I did.

It seems pretty accurate.

I’ve got a notifications setup for when the time to line dry is less the line dry time is less than 90 minutes, to notify me to do the laundry, conditional on: it’s before noon, the chance of rain is 0 for the next 3 hours, and the laundry machine hasn’t run for 3 days (sonoff s31 monitors when it is running).

Amazing @Anglac well done and thanks for sharing !

quick question I wanted to use the same template sensor and the template for the notification for my case, just wanted to know what weather service are you using for calculating the chance of rain etc.

I am kinda stuck here:

{{(states.sensor.line_dry_time.state|int/60)|round(1)}} hours.{%- for cat in -%}{%- if
    cat.precipitation_probability >0 and loop.index <
    (states.sensor.line_dry_time.state|int/60)|int+1%}There is a
    {{cat.precipitation_probability}}% chance of rain in {{loop.index}} hours
    from now.{%- endif %}{%- endfor %}{%- endif %}

I have loved this thread, I have even tried to replicate the sensor by passing my variables to celsius, kph, etc.

But I have a doubt, if it is night the sunshine_percent is zero and this increment the drying time until 2745015 minutes.

I find the calculation very strange after trying this…

This great. I’ve been looking for something like this for a while.

What’s the expected value of states.sensor.solaredge_current_power.state? I’m trying to convert the template sensor to use cloud_coverage from my weather sensor. It seems to spit out an integer from 0-100. I presume 0 being no clouds and 100 being total cloud cover.

sunshine_percent is 0-1 so a divide by 100 and make sure it is a float when your done.

Thanks, presuming that 1 means it;s very bright and sunny and not cloudy?

If so, then I’ll need to invert the float output from the cloud_coverage attribute.