Page 1 of 1
Dewpoint calculation.
Posted: Monday 27 June 2022 15:40
by redswan
Hi,
I'm trying to reconstitute some historical data to include in one of my temp/humidity sensors. Can some one please point me to the formula used to calculate the dew-point. I've found several on the web but they give different results that don't correspond to what I see in Domoticz. I've tried looking in the source but I've no idea in which file its defined.
Thanks for any help.
Chris
Re: Dewpoint calculation.
Posted: Monday 27 June 2022 16:24
by kiddigital
Look at `main/helper.cpp`.
It contains a Dew Point calculation function.
Solved: Dewpoint calculation.
Posted: Monday 27 June 2022 16:44
by redswan
Hi,
OK, I've answered my own question - it's in main/helper.cpp.
It's the same formula that I already found except that the constants are different!
(C1 * (LOG(Hum/100) + ( (C2 *Temp / (C1 +Temp ) ))) / (C2 - (LOG(Hum/100) + ( (C2 *Temp ) / (C1 +Temp ) )))
C1 in Domoticz is 243.04, my search elsewhere gives 237.3
C2 in Domoticz is 17.625, elsewhere 17.27
No idea, for the moment why the difference.
Anyway, after testing, the real problem was that I was using LOG base 10 instead of natural LOG, my bad

The difference in constants only makes a few hundredths of a degree difference.
Chris
Re: Dewpoint calculation.
Posted: Monday 27 June 2022 16:45
by FireWizard
Hi @redswan,
Have a look at my post at
viewtopic.php?p=279553&hilit=Dewpoint#p279553
This contains a javascript function of the Dewpoint calculation and is identical to what Domoticz is using. However I do not understand the function of the second "if" statement in the Domoticz calculation. If it is the intention to avoid a division by zero, then the lines 620/621 are wrong.
Regards
Re: Dewpoint calculation.
Posted: Monday 27 June 2022 16:48
by redswan
Just saw your replies - thanks @Kiddigital, @Firewizard