Dew point Calculator?

I am monitoring temp and RH but what I really want to know is dew point. Has anyone ever worked on this? I guess I’m imagining a virtual device would pull the temp & RH from the hardware and apply a dp calc to it. From there I want notification.

Yes, I have a little bit of scene code which does that. I also used it in the Netatmo plugin. Input and output temperature in degrees Celcius…

------------------------------------------------------------------------
--
-- Dew point calculation using Magnus formula: http://en.wikipedia.org/wiki/Dew_point
-- 
local function dewPoint (T, RH)
-- a,b,c taken from a 1980 paper by David Bolton in the Monthly Weather Review
--  local a = 6.112     -- a is not used in this approximation
  local b,c = 17.67, 243.5
  RH = math.max (RH or 0, 1e-3)
  local gamma = math.log (RH/100) + b * T / (c + T) 
  return c * gamma / (b - gamma)
end
-----

BTW, I think you posted this on the wrong board… (Sorry Richard.)

Yes I was assuming this would be pleg thing. Richard, please move this as needed.

akbooer, I really appreciate you sharing. I’m monitoring indoor conditions with st814’s. I’m not sure how I would use this code to get my dew point readings. I mean I get that it’s the formula which will take b & c, apply the calculation, and result in the dew point but I’m not sure how I point it to my readings for inputs. Any guidance would be appreciated.

Well, it depends a bit on what you want to do with the answer. But, for example, if you place the following code into your Lua Startup.

------------------------------------------------------------------------
--
-- Dew point calculation using Magnus formula: http://en.wikipedia.org/wiki/Dew_point
-- 
function dewPoint (T, RH)
-- a,b,c taken from a 1980 paper by David Bolton in the Monthly Weather Review
--  local a = 6.112     -- a is not used in this approximation
  local b,c = 17.67, 243.5
  RH = math.max (RH or 0, 1e-3)
  local gamma = math.log (RH/100) + b * T / (c + T)
  return c * gamma / (b - gamma)
end

function ST814_get (d)
    local tempSID  = "urn:upnp-org:serviceId:TemperatureSensor1"
    local humidSID = "urn:micasaverde-com:serviceId:HumiditySensor1"

    local T = luup.variable_get (tempSID, "CurrentTemperature", d)
    local H = luup.variable_get (humidSID, "CurrentLevel", d)
    local D = dewPoint (T,H)
    luup.variable_set (tempSID, "DewPoint",D,  d)
    return T,H,D
end

…and the following code in the Lua section of a scene, which is scheduled to run, say, every 10 minutes

local d = 20021     -- CHANGE THIS TO YOUR ST814 device number
local T,H,D = ST814_get(d)

… then the temperature, humidity, and dewpoint will be returned to your scene to do with what you will. Additionally, and perhaps even more usefully, it will create a “DewPoint” device variable on that specific device, which you can use like any other device variable. This calculation assumes that your temperature is in Celcius, but it’s a one-liner to convert in the parameter list of the dewPoint call (and again for the returned value.)

The Weather Underground plugin already provides Dew Point.
I can’t imagine a need for an Indoor Dew Point measurement.

Maybe the ‘indoors’ in question is a greenhouse? One of mine is.

Was thinking about controlling A/C based on dewpoint rather than temp. Might be more comfortable that way

Sent from my SM-G928V using Tapatalk