Dew point
=========

The aim is to determine if condensation will occur. Temperature and humidity are used to calculate a dew point.
If temperature is lower than the dew point, condensation will appear.

As water vapour concentration grows, the rate of condensation increases. The amount
of water grows until the rate of condensation and the rate of evaporation are in equilibrium.
Then the water vapour concentration will stop increasing because the air is saturated with
water vapour. Relative humidity of saturated air is 100 %. The temperature to which the
air has to be cooled to reach saturation is called dew point.

The configuration parameters in the examples below can be changed
in the configuration file ``config.ini``
that is described in section :ref:`installation.config_file`.

.. literalinclude:: ../../examples2/0304_dew_point/run.py
   :language: python

It is necessary to set clients that can communicate with a remote server using the function ``setup_clients``.
Current time is stored in the variable ``actual_time``. Latitude and longitude that enable to get weather data
according to a sensor position are stored in the variable ``lat`` and ``lon``. The API key allows to get weather data
from server and it is obtained by the function ``wunderground_api_key``. The sensors used to gather data are stored
in the variable ``devs``. Determination if condensation will occur is performed by the function ``dew_point`` and the result is stored
in the variable ``notification``.

An output of the determination is a notification that contains basic information described in the section
:ref:`Notifications <notification.notification>` and the following information:

* **dew_point** - dew point calculated using indoor temperature and humidity,
* **dewing** - if condensation will occur,
* **hum_in** - indoor humidity,
* **temp_in** - indoor temperature,
* **type** - what quantity is used for prediction.

The example of a notification follows.

.. literalinclude:: ../../examples2/0304_dew_point/notification.doc.json
   :language: json

The example of a command that can be used to determine if condensation will occur is below.

.. code-block:: bash

   python examples2/0304_dew_point/run.py
