Calculation of wind chill temperature (WCT)
Wind-chill is the lowering of body temperature due to the passing-flow of lower-temperature air.
Wind chill numbers are always lower than the air temperature for values where the formula is valid. When the apparent temperature is higher than the air temperature, the heat index is used instead.
var temperature = global.get("gv_home_outdoor_weather_temperature");
var windspeed = global.get("gv_home_outdoor_weather_windspeed");
var WCT = 13.12 + 0.6215 * temperature - 11.37 * Math.pow(windspeed, 0.16) + 0.3965 * temperature * Math.pow(windspeed, 0.16);
msg.payload = (Number(WCT)).toFixed(1);
return msg;
Calculation of dewpoint
The dew point is the temperature to which air must be cooled to become saturated with water vapor. When cooled further, the airborne water vapor will condense to form liquid water (dew). When air cools to its dew point through contact with a surface that is colder than the air, water will condense on the surface. When the temperature is below the freezing point of water, the dew point is called the frost point, as frost is formed rather than dew.[3] The measurement of the dew point is related to humidity. A higher dew point means there is more moisture in the air.
var temperature = global.get("gv_home_outdoor_weather_temperature");
var humidity = global.get("gv_home_outdoor_weather_humidity");
if(temperature > 0) {
k2=17.62;
k3=243.12;
} else {
k2=22.46;
k3=272.62;
}
// Calculate dew point
dewpoint=k3*((k2*temperature)/(k3+temperature)+Math.log(humidity/100))/((k2*k3)/(k3+temperature)-Math.log(humidity/100));
// Round dew point
msg.payload = Math.round(dewpoint*100)/100;
return msg;