Calculate relative humidity using dewpoint, absolutely humidity and temperature

I agree.

And that right there is the easiest concept in the whole system to figure out and understand.

But without taking all of those other variables I mentioned above (plus others I might not even have thought of) you won’t be able to predict what the final relative humidity will be at some random point in the future.

The equation will get ridiculously complicated if you can even come up with one at all that takes into account all of those factors (both known and unknown).

Especially since you admit yourself above that the basic calculations that literally just deal simply with delta-RH/delta-T (change in relative humidity per change in temperature) that were already given to you from the link are beyond your capabilities. It only gets way harder from there.

:roll_eyes: good luck.

I have the requisite variables according to Temperature, Dewpoint, and Relative Humidity Calculator
And am trying to ask what the literal variables in his equation mean, like what the letters that represent a value actually represent, and how to arrange them properly. I’m not explaining this again, stop commenting, I don’t care what you have to say because your literally not helping at all. You still refuse to understand what I’m even trying to do. Like how to take this

def computeRelativeHumidity(self, temperature, absHumidity):
“”“How to convert relative humidity to absolute humidity | carnotcycle”""
absTemperature = temperature + 273.15;
relHumidity = absHumidity
relHumidity *= absTemperature
relHumidity /= 2.1674;
relHumidity /= math.exp((17.67 * temperature) / (243.5 + temperature));
relHumidity /= 6.112;
return round(relHumidity, 2)

And use that equation in home Assistant instead of python. Unless you actually plan on helping instead of just quipping in to say “why do you want to do that” or making some stupid comment that reveals that you have no idea what I’m even trying to do, STOP COMMENTING BECAUSE YOUR COMMENTS ARE NOT HELPFUL AND NEITHER ARE YOU.

well we can’t have that can we… :wink:

{% set temperature = states('sensor.temperature') | float %}
{% set relHumidity = states('sensor.relative_humidity') | float %}
{% set absHumidity = states('sensor.absolute_humidity') | float %}
{% set absTemperature = temperature + 273.15 %}
{% set relHumidity = absHumidity %}
{% set relHumidity = relHumidity * absTemperature %}
{% set relHumidity = relHumidity / 2.1674 %}
{% set relHumidity = relHumidity / relHumidity**((17.67 * temperature) / (243.5 + temperature)) %}
{% set relHumidity = relHumidity / 6.112 %}
{{ relHumidity | round(2) }}

I haven’t verified the equations but I’m fairly sure the conversions in notation are correct.

{% set temperature = states(‘sensor.mainroomtemperaturec’) | float %}
{% set relHumidity = states(‘sensor.outdoorhumidityecowittgw’) | float %}
{% set absHumidity = states(‘sensor.outdoor_absolutehumidity’) | float %}
{% set absTemperature = temperature + 273.15 %}
{% set relHumidity = absHumidity %}
{% set relHumidity = relHumidity * absTemperature %}
{% set relHumidity = relHumidity / 2.1674 %}
{% set relHumidity = relHumidity / relHumidity**((17.67 * temperature) / (243.5 + temperature)) %}
{% set relHumidity = relHumidity / 6.112 %}
{{ relHumidity | round(2) }}

ok so i think this is right then, so how do you make this a sensor? or i supose how more aptly would one make “relHumidity” a sensor, which i believe is the result of the equation?

*edit because temperature was not in celsus

You’ve been using HA for almost a year and a half so I’m going to let you try to figure that one out on your own.

TBH, I’m surprised I’ve stuck around this long after all of the above. I guess it’s like they say about a train wreck that you just can’t look away.

I only answered the above to prove you wrong about me being unhelpful. I didn’t do it to help because you yelled at me so much as doing it in spite of that. So…you’re welcome…

But if you really do figure it all out I’ll still be lurking and watching so feel free to prove me wrong as well.

1 Like

So being intentionally not helpful to prove a point as to how helpful you are. Lol. Okay.

for anyone concerned and finding this on google heres how u make it work, put it under your templates

      - name: entering_humidity
        unit_of_measurement: '%'
        state: >
          {% set temperature = ((states('sensor.mainroomtemperature1') | float(0))-32)/1.8 %}
          {% set relHumidity = states('sensor.outdoorhumidity1')  | float(0) %}
          {% set absHumidity = states('sensor.outdoor_absolutehumidity') | float(0) %}
          {% set absTemperature = temperature + 273.15 %}
          {% set relHumidity = absHumidity %}
          {% set relHumidity = relHumidity * absTemperature %}
          {% set relHumidity = relHumidity / 2.1674 %}
          {% set relHumidity = relHumidity / 2.718281828459045235360287471352**((17.67 * temperature) / (243.5 + temperature)) %}
          {% set relHumidity = relHumidity / 6.112 %}
          {{ relHumidity | round(9) }}

to get the values necessary you can use humdity and temperature from a sensor and then use the thermal comfort integration to get the remaining values. and this is for F not C so if in centigrade i suppose remove the conversion bit or just convert to F with another template and use that sensor as the temperature. this can be used to determine weather an automation for humidifying or dehumidifying is necessary and prevent over dehumidification causing an arid environment or over humidification causing a damp and wet environment, or causing scripts to continuously bounce back and forth between the two wasting electricity if only internal humidity is part of the automation. this value will be the humidity entering your house if it were at the temperature of inside, which it immediately becomes upon entering.

:roll_eyes: :roll_eyes:

That gives you nothing but a conversion for taking a given mass of air (say 1 cubic meter) at a specific absolute humidity and telling you what the relative humidity of that same volume of air will be at different temperatures. I already knew that you (well at least someone could) could do that.

That formula assumes a closed system in which there are no other inputs or outputs that are changing except the temperature. Basically you take a sealed box of air at a certain absolute humidity and then change its temperature and it gives you the final relative humidity of that same exact box of air.

Proved me wrong did you?

So how much air (cubic meters) goes from outside your house to inside your house? over what time frame (cubic meters per hour, per minute, per second)? I don’t see that data in your formula.

How much air (cubic meters) goes from inside your house to outside your house over that same time frame (cubic meters per hour, per minute, per second)? That will take some of that absolute humidity out of your house. And you don’t account for that.

Do you ever run an exhaust fan that draws in outside air and discharges inside air to the outside at a faster rate (cubic meters per minute) than natural in(ex)filtration? I don’t see that accounted for either.

Do you ever take a shower? Because that adds moisture to the air that your formula doesn’t account for.

Is your basement/crawlspace completely sealed? Because moisture from the ground will migrate into/out of your house and your formula doesn’t account for that either.

do you have a gas stove? It adds moisture to the air. ditto.

Ventless gas fireplace? same result. ditto again.

For all of that to even be useful you will need the actual volume of the heated portion of the inside your house as well. since the outside air (at that absolute humidity) will be mixing continuously with the already heated air inside your house. It’s not just a one to one turn over of air.

And to add to all of that every single room in your house will end up being a bit different than every other room since you never have perfect air flow that will keep every room at the exact same temp humidity. Your kitchen, laundry and bathrooms will usually be higher in humidity even at the same temperature than your living room or bedrooms. And the flow of air between all of those rooms over time will affect the humidity in the others.

etc.

etc.

etc.

Like I said above (many times now) you did the easy part.

Well actually, TBH, YOU didn’t really do anything except find a formula that someone else came up with originally (not that there’s anything wrong with that we all build on others work). I was the one who made it work in HA for you.

And then YOU didn’t even come up with the sensor either. I saw the other thread (that you posted after I told you I wasn’t helping you any further here) where others basically had to do that for you too.

And now you come here to gloat thinking you’ve proved me wrong. HAH!

I never denied you could figure out what you did above. I had already sent you to the same link that you posted that you got this (non-)answer from. But what you figured out isn’t what you think you figured out.

You may say I’m not being helpful but just because I’m not giving you the answer you want to hear doesn’t make not helpful. You just don’t want to accept the answers.

At this point I think I’ll just use your own words…

I already made an ac system that does all that, it has humidity and temperature in every room with sensors. Added booleans to allow a particular room to be heated ,a particular room to be cooled, a particular room to be humidified, and a particular room to be dehumidified. Autonomously based on indoor temperature and humidity with an ecowitt local internet gateway for rf humidity sensors, and z wave devices. This just is a thing I need to turn those booleans on and off so it doesn’t autonomously cool/dehumidify now that it’s freezing/arid as fck. That’s what the number was for and only what it was for. There is no autonomous heating and cooling solution in blueprints so it’s a mix of scripts and automations triggered by booleans, triggered by other automations, that are conditional on the original booleans I mentioned that THIS FCKING MEASUREMENT is for. That’s all it’s for. Is it (hot_deviation) away from (humidity_set) then disable the booleans. You literally keep creating issues that I need solving, that I already solved. I needed one number dufus. If you didn’t wanna help you didn’t have to. I’m done creating my central air control automation. What are you talking about?

Chill out guys, review the COC. You’re both being ridiculous.

This topic was automatically opened after 18 hours.

@jatgm1 are you sure that you really need more than the dewpoints?
The dewpoint value is completely proportional to the mass of water per volume of air.

If I get your right, all you want to know is, whether the outside air will increase or decrease your inside relative humidity when you turn on ventilation. You can answer that by simply comparing inside and outside dewpoints:

if (outside_dewpoint > inside_dewpoint)
=> turning on ventilation will increase current inside rel. humidity

if (outside_dewpoint < inside_dewpoint)
=> turning on ventilation will decrease current inside rel. humidity

2 Likes

This is actually to determine if a dehumidifier or humidifier should turn on. There is essentially no outside of ventilation in winter that’s significant other than air leaking in and out normally. Which is what I’m trying to account for. If it’s more than a 5% difference in humidity the amount of air leaving my averagely insulated house will require the automations to deal with that at some point to humidify. If it’s essentially equal then nothing should be turning on or off. If it’s greater than 5% same thing but with a dehumidifier. The ambient heat from my server and strawberry grow tent led lamps actually creates some heat in the winter which allows for my heater kicking on less and outside ventilation would probably get rid of that faster and waste more electricity.

I’m trying to achieve a similar thing. What I want is to turn the ventilation system on full capacity when indoor RH is higher than 60%. However, this wouldn’t work if outside air contains more absolute humidity. In that case the inside RH would only increase due to ventilation. To determine if incoming air leads to lower RH I calculate the RH of the incoming air when heated to the indoor temperature.

It has the following steps:

  • determine the inside and outside temperature and humidity
  • determine the outside dew point
  • determine predicted RH which is RH using the outside dew point with the indoor temperature
  • compare the current indoor RH with the predicted RH
  • If predicted < current, turn on ventilation, else turn ventilation off.

The testcode is as follows

{% set indoor_temp = 21.2|int %}
{% set indoor_RH = 56.2|int %}
{% set outdoor_temp = 20|int %}
{% set outdoor_RH = 90|int %}
{% set outdoor_dewpoint = 243.04*(log(outdoor_RH/100)+(17.625*outdoor_temp/(243.04+outdoor_temp)))/(17.625-log(outdoor_RH/100)-(17.625*outdoor_temp/(243.04+outdoor_temp))) %}
{% set indoor_RH_prediction = 100*(e**(17.625*outdoor_dewpoint/(243.04+outdoor_dewpoint))/e**(17.625*indoor_temp/(243.04+indoor_temp))) %}

RH inside: {{ indoor_RH|round }}%
RH inside after heating: {{ indoor_RH_prediction|round }}%

{% if indoor_RH_prediction < indoor_RH%}
Ventilation on! possible RH reduction {{(indoor_RH - indoor_RH_prediction)|round}}%
{% else %}
Ventilation off! possible RH increase {{(indoor_RH_prediction - indoor_RH)|round }}%
{% endif %}

To determine if ventilation will transport air humidity out or not you really only need to compare the dewpoints.

if  ( DPin > DPout )  doVentilation

So your complete logic would be (with in meta language):

if  ( RHin > 60  &&  DPin > DPout )  doVentilation
2 Likes

I’ve tried that with little to no success as far as determining whether or not to use ventilation or air conditioning or whether it’s energy efficient to turn on heating or cooling based on outside temperature. I had it working then it stopped working unexpectedly after a home assistant update. Some code automatically doing this task. I’ve since given up and do it manually because idk why it stopped working and now don’t have the time or specific knowledge to make it work and every update makes me have to figure out what was Changed that fucked something up so Ive given up. Since this just seems like something an integration or addon should be able to do via gui without any issues.

      - name: entering_humidity
        unit_of_measurement: '%'
        state: >
          {% set temperature = ((states('sensor.mainroomtemperature1') | float(0))-32)/1.8 %}
          {% set relHumidity = states('sensor.outdoorhumidityecowittgw')  | float(0) %}
          {% set absHumidity = states('sensor.thermal_comfort_absolute_humidity') | float(0) %}
          {% set absTemperature = temperature + 273.15 %}
          {% set relHumidity = absHumidity %}
          {% set relHumidity = relHumidity * absTemperature %}
          {% set relHumidity = relHumidity / 2.1674 %}
          {% set relHumidity = relHumidity / 2.718281828459045235360287471352**((17.67 * temperature) / (243.5 + temperature)) %}
          {% set relHumidity = relHumidity / 6.112 %}
          {{ relHumidity | round(9) }}


P.s. how to I quote code I thought these lines were how. It used to give me a warning or something before posting I’m not sure I did this right.

If you could tell me how I did this wrong that would be useful because I’m not sure.

Thank you.

To clarify for everyone, thermal comfort updated and stopped working the same and I never updated the entity name and gave up. This code works fine actually.