## README

# Pimatic-Dewpoint

Dew point, absolute humidity, wind chill factor, heat index, and apparent temperature calculation support for Pimatic.

This plugin calculates the dew point temperature, absolute humidity, and the heat index temperature from the given temperature and relative humidity variables in Pimatic. Additionally, it can also calculate the wind chill factor and the apparent temperature if a variable reference for wind speed is provided. For all values metric, imperial, and ISO measures are supported.

## Theoretical Background

### Dew Point

The dew point temperature *DT* is defined as a dimension at which the actual degree of saturation of water in the
air is at 100% RH (relative humidity). If a body at this temperature or below is exposed to this air condition, water
on its surface will condense.
The dew point can be calculated approximately with the values of the relative humidity and the temperature of the air.

The basis for the computation is the the approximation formula of the saturation vapor pressure:

*P _{vs}(T) = 6.1078 * 10^{(a * T)/(b + T)}*

where a = 7.5, b = 237.3 for temperatures T >= 0°C

and a = 7.6, b = 240.7 for temperatures T < 0°C

The relationship of the actual vapor pressure and saturation vapor pressure is represented as:

*P _{v}(rh, T) = P_{vs}(T) * ^{rh}/_{100}*

Putting *P _{v}(rh, T)* instead of

*P*into the first formula and dissolving it to

_{vs}(T)*T*leads to the dew point

*DT*:

*DT = ^{(b * v)}/_{(a - v)}*

where *v* is:

*log _{10}(^{Pv(rh, T)}/_{6.1078})*

### Absolute Humidity

Absolute humidity is the total mass of water vapor present in a given volume of air. Assuming ideal gas behaviour it can be calculated as follows:

*A = c · P _{v} / T*

where c = 2.16679 gK/J
and P_{v} denotes the vapour pressure in Pa
and T denotes the temperature in K

### Wind Chill

For temperatures below 10 degrees Celsius the wind chill is the lowering of the body temperature due to the passing-flow of lower-temperature air (wind). The calculation is performed according to the Canada Windchill Index established in 2001. The formula for metric values is as follows:

*T _{wc} = 13.12 + 0.6215T_{a} + (0.3965v_{a} - 11.37)v^{+0.16}*

where *T _{wc}* is the wind chill temperature,
and

*T*is the air temperature, and

_{a}*v*is the wind speed in km per hour.

### Heat Index

For temperatures starting from 27 degrees Celsius, heat index combines temperature and relative humidity as an attempt
to determine the human-perceived equivalent temperature. The calculation is based on the work of Robert G. Steadman,
published in the Journal of Applied Meteorology in 1979. The formula uses several constants c_{1} through
c_{9} as follows:

*T _{hi} = c_{1} + c_{2} Ta + c_{3} R + c_{4} Ta R + c_{5} Ta^{2} + c_{6} R^{2} + c_{7} Ta^{2}R + c_{8} Ta R^{2} + c_{9} Ta^{2} R^{2}*

where *T _{hi}* is the heat index,
and

*T*is the air temperature, and

_{a}*R*is the relative humidity.

constant | value for Celsius |
---|---|

c_{1} |
−8.784695 |

c_{2} |
1.61139411 |

c_{3} |
2.338549 |

c_{4} |
−0.14611605 |

c_{5} |
−1.2308094 · 10^{−2} |

c_{6} |
−1.6424828 · 10^{−2} |

c_{7} |
2.211732 · 10^{−3} |

c_{8} |
7.2546 · 10^{−4} |

c_{9} |
−3.582 · 10^{−6} |

### Apparent Temperature

Apparent temperature is the temperature equivalent perceived by humans, caused by the combined effects of air temperature, relative humidity and wind speed. It is determined as follows:

- wind chill temperature for air temperature below 10 degrees Celsius
- heat index temperature for air temperatures starting from 27 degrees Celsius and relative humidity staring from 40%
- air temperature, otherwise

Note, the wet bulb globe temperature is not used.

### Sources

- Wikipedia Dew Point
- Wikipedia Wind Chill
- Wikipedia Heat Index
- Wikipedia-Deutsch Hitzeindex
- Wikipedia Apparent Temperature
- FAQs.org Temp, Humidity & Dew Point
- Wikipedia Humidity
- Vaisala Calculation formulas for humidity
- Wetterochs

## Usage

The intention to calculate the dew point is to see if cold spots (for instance cold floors and walls in the closet) tend to become wet because their temperature is below the dew point of the surrounding air temperature. This also happens often in old houses with weak isolation when it is cold outside, but the air is heated and the walls are poorly isolated to the outside.

A good way to get these values is the usage of a combined temperature and humidity sensor (eg. DHT22) to measure the air climate and to calculate the dew point.

An additional sensor (eg. DS18B20) has directly contact to the cold spots and its temperature can be compared to the dew point temperature.

## Configuration

Example:

```
{
"id": "dew",
"class": "DewPointDevice",
"name": "Dew Point",
"temperatureRef": "$homeduino-airclimate.temperature",
"humidityRef": "$homeduino-airclimate.humidity"
}
```

By default, the referenced temperature is expected to be in °C. To switch to imperial units, set the "units" property to "imperial" as shown in the following example:

```
{
"id": "dew",
"class": "DewPointDevice",
"name": "Dew Point",
"temperatureRef": "$homeduino-airclimate.temperature",
"humidityRef": "$homeduino-airclimate.humidity",
"units": "imperial"
}
```

## Acknowledgements

Thank you Marcus Wittig and Icesory for helping me in this project and as well sweet pi for his work on the software Pimatic!