Add absolute humidity component (#2723)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
58
components/sensor/absolute_humidity.rst
Normal file
@ -0,0 +1,58 @@
|
||||
Absolute Humidity
|
||||
=================
|
||||
|
||||
.. seo::
|
||||
:description: Instructions for setting up absolute humidity calculation
|
||||
:image: water-drop.svg
|
||||
|
||||
The ``absolute_humidity`` platform allows you to calculate absolute humidity from air temperature and relative humidity.
|
||||
|
||||
See the links at the bottom of the page for details on absolute humidity and the different saturated vapor pressure equations.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# Example configuration entry
|
||||
sensor:
|
||||
- platform: absolute_humidity
|
||||
name: Absolute Humidity
|
||||
temperature: air_temperature
|
||||
humidity: relative_humidity
|
||||
|
||||
# Use any temperature and relative humidity source, e.g. a BME280:
|
||||
- platform: ...
|
||||
temperature:
|
||||
name: Temperature
|
||||
id: air_temperature
|
||||
humidity:
|
||||
name: Relative Humidity
|
||||
id: relative_humidity
|
||||
|
||||
Configuration variables:
|
||||
------------------------
|
||||
|
||||
- **name** (**Required**, string): The name for the absolute humidity sensor.
|
||||
- **temperature** (**Required**, :ref:`config-id`): The sensor that is used to measure the current temperature, in °C.
|
||||
- **humidity** (**Required**, :ref:`config-id`): The sensor that is used to measure the current relative humidity, in %.
|
||||
- **equation** (*Optional*): The saturated vapor pressure equation to use (see below).
|
||||
- All other options from :ref:`Sensor <config-sensor>`.
|
||||
|
||||
Saturated vapor pressure equations
|
||||
----------------------------------
|
||||
|
||||
There are several different equations for calculating saturated vapor pressure.
|
||||
``Wobus`` is used by default, as it is notionally the most accurate, but any of the following can be used:
|
||||
|
||||
- ``Buck``: `Arden Buck equation <https://en.wikipedia.org/wiki/Arden_Buck_equation>`__
|
||||
- ``Tetens``: `Tetens equation <https://en.wikipedia.org/wiki/Tetens_equation>`__
|
||||
- ``Wobus``: `Wobus equation <https://wahiduddin.net/calc/density_altitude.htm>`__
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :apiref:`absolute_humidity/absolute_humidity.h`
|
||||
- `NOAA Discussion on Humidity <https://www.weather.gov/lmk/humidity>`__
|
||||
- `Absolute humidity on Wikipedia <https://en.wikipedia.org/wiki/Humidity#Absolute_humidity>`__
|
||||
- `How to calculate absolute humidity <https://www.environmentalbiophysics.org/chalk-talk-how-to-calculate-absolute-humidity/>`__
|
||||
- `How to convert relative humidity to absolute humidity <https://carnotcycle.wordpress.com/2012/08/04/how-to-convert-relative-humidity-to-absolute-humidity/>`__
|
||||
- :ghedit:`Edit`
|
@ -58,6 +58,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :apiref:`aht10/aht10.h`
|
||||
- `AHT10 Library <https://github.com/Thinary/AHT10>`__ by `Thinary Electronic <https://github.com/Thinary>`__
|
||||
- `Unofficial Translated AHT10 Datasheet (en) <https://wiki.liutyi.info/download/attachments/30507639/Aosong_AHT10_en_draft_0c.pdf>`__
|
||||
|
@ -57,6 +57,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`dht`
|
||||
- :doc:`dht12`
|
||||
- :doc:`hdc1080`
|
||||
|
@ -66,4 +66,5 @@ See Also
|
||||
|
||||
- `b-parasite on GitHub <https://github.com/rbaron/b-parasite>`__
|
||||
- :doc:`/components/esp32_ble_tracker`
|
||||
- :doc:`absolute_humidity`
|
||||
- :ghedit:`Edit`
|
||||
|
@ -89,6 +89,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`bme680`
|
||||
- :doc:`bmp085`
|
||||
- :apiref:`bme280/bme280.h`
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
@ -107,6 +107,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`bme280`
|
||||
- :doc:`bmp085`
|
||||
- :apiref:`bme680/bme680.h`
|
||||
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
@ -308,6 +308,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`bme680`
|
||||
- :apiref:`bme680_bsec/bme680_bsec.h`
|
||||
- `BME680 VOC classification <https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME680-VOC-classification/td-p/26154>`__
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -81,6 +81,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`dht12`
|
||||
- :doc:`hdc1080`
|
||||
- :doc:`htu21d`
|
||||
|
@ -55,6 +55,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`dht`
|
||||
- :doc:`hdc1080`
|
||||
- :doc:`htu21d`
|
||||
|
@ -52,6 +52,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :apiref:`ENS210/ENS210.h`
|
||||
- `ENS210 Library <https://github.com/maarten-pennings/ENS210>`__ by `Maarten Pennings <https://github.com/maarten-pennings>`__
|
||||
- :ghedit:`Edit`
|
||||
|
@ -80,6 +80,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`dht`
|
||||
- :doc:`dht12`
|
||||
- :doc:`htu21d`
|
||||
|
@ -52,6 +52,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`tee501`
|
||||
- :doc:`ee895`
|
||||
- :doc:`dht`
|
||||
|
@ -58,6 +58,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`dht`
|
||||
- :doc:`dht12`
|
||||
- :doc:`hdc1080`
|
||||
|
@ -115,6 +115,7 @@ See Also
|
||||
|
||||
- :doc:`/components/esp32_ble_tracker`
|
||||
- :doc:`/components/sensor/index`
|
||||
- :doc:`absolute_humidity`
|
||||
- :apiref:`inkbird_ibsth1_mini/inkbird_ibsth1_mini.h`
|
||||
- `OpenMQTTGateway <https://github.com/1technophile/OpenMQTTGateway>`__ by `@1technophile <https://github.com/1technophile>`__
|
||||
- :ghedit:`Edit`
|
||||
|
@ -184,6 +184,7 @@ See Also
|
||||
|
||||
- :doc:`/components/esp32_ble_tracker`
|
||||
- :doc:`/components/sensor/index`
|
||||
- :doc:`absolute_humidity`
|
||||
- :apiref:`ruuvitag/ruuvitag.h`
|
||||
- `Ruuvi <https://ruuvi.com>`__
|
||||
- :ghedit:`Edit`
|
||||
|
@ -108,6 +108,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`dht`
|
||||
- :doc:`dht12`
|
||||
- :doc:`hdc1080`
|
||||
|
@ -168,6 +168,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`scd30`
|
||||
- :apiref:`scd4x/scd4x.h`
|
||||
- :ghedit:`Edit`
|
||||
|
@ -208,6 +208,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`sds011`
|
||||
- :doc:`pmsx003`
|
||||
- :doc:`ccs811`
|
||||
|
@ -53,6 +53,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`dht`
|
||||
- :doc:`dht12`
|
||||
- :doc:`hdc1080`
|
||||
|
@ -67,5 +67,6 @@ See Also
|
||||
- :doc:`/components/sensor/sht3xd`
|
||||
- :doc:`/components/sensor/shtcx`
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :apiref:`sht4x/sht4x.h`
|
||||
- :ghedit:`Edit`
|
||||
|
@ -56,6 +56,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`dht`
|
||||
- :doc:`dht12`
|
||||
- :doc:`hdc1080`
|
||||
|
@ -76,6 +76,7 @@ See Also
|
||||
--------
|
||||
|
||||
- :ref:`sensor-filters`
|
||||
- :doc:`absolute_humidity`
|
||||
- :doc:`mhz19`
|
||||
- `CO2mon-esp firmware <https://github.com/Anonym-tsk/co2mon-esp>`__ by `@anonym-tsk <https://github.com/Anonym-tsk>`__
|
||||
- `Some information about hacking MT8060 <https://habr.com/ru/company/dadget/blog/394333/>`__
|
||||
|
@ -42,18 +42,10 @@ After validating the sensor is working, we can proceed and add some formulas.
|
||||
update_interval: 15s
|
||||
icon: 'mdi:signal'
|
||||
unit_of_measurement: 'm'
|
||||
- platform: template
|
||||
- platform: absolute_humidity
|
||||
name: "Absolute Humidity"
|
||||
lambda: |-
|
||||
const float mw = 18.01534; // molar mass of water g/mol
|
||||
const float r = 8.31447215; // Universal gas constant J/mol/K
|
||||
return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) /
|
||||
(id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) /
|
||||
((273.15 + id(bme280_temperature).state) * r); // in grams/m^3
|
||||
accuracy_decimals: 2
|
||||
update_interval: 15s
|
||||
icon: 'mdi:water'
|
||||
unit_of_measurement: 'g/m³'
|
||||
temperature: bme280_temperature
|
||||
humidity: bme280_humidity
|
||||
- platform: template
|
||||
name: "Dew Point"
|
||||
lambda: |-
|
||||
@ -73,7 +65,7 @@ The variable ``STANDARD_SEA_LEVEL_PRESSURE`` (in hPa), should be filled in for y
|
||||
The formula derived from `here <https://github.com/finitespace/BME280/blob/master/src/EnvironmentCalculations.cpp>`__,
|
||||
converts the currently measured pressure to the altitudes in meters including temperature compensation.
|
||||
|
||||
The lambda in the second :doc:`/components/sensor/template` defines two physical constants and
|
||||
The second block uses the :doc:`/components/sensor/absolute_humidity` component which
|
||||
converts the currently measured temperature and relative humidity to absolute humidity (grams/m^3).
|
||||
|
||||
.. note::
|
||||
@ -120,13 +112,13 @@ Calculating the sea level pressure with a statically mounted sensor can be used
|
||||
Formula explanation
|
||||
-------------------
|
||||
|
||||
- `Relative humidity calculations <https://carnotcycle.wordpress.com/2012/08/04/how-to-convert-relative-humidity-to-absolute-humidity/>`__
|
||||
- `Altitude calculation <https://en.wikipedia.org/wiki/Atmospheric_pressure#Altitude_variation>`__
|
||||
- `Dew Point calculation <https://carnotcycle.wordpress.com/2017/08/01/compute-dewpoint-temperature-from-rh-t/>`__
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
- :doc:`/components/sensor/absolute_humidity`
|
||||
- :doc:`/components/sensor/template`
|
||||
- :doc:`/components/sensor/bme280`
|
||||
- :ghedit:`Edit`
|
||||
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 4.9 KiB |
1
images/water-drop.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg height="26" width="26" xmlns="http://www.w3.org/2000/svg"><path d="M12.953,0c0,0-9,10.906-9,16.906c0,4.971,4.029,9,9,9s9-4.029,9-9C21.953,10.906,12.953,0,12.953,0z M9.026,17.496c0,1.426,0.668,4.25,1.134,5.426c-3.042-1.494-3.846-4.425-3.846-6.463c0-3.173,3.684-7.824,5.777-12.149 C11.861,6.581,9.026,13.177,9.026,17.496z"/></svg>
|
After Width: | Height: | Size: 333 B |
@ -274,6 +274,7 @@ Environmental
|
||||
|
||||
.. imgtable::
|
||||
|
||||
Absolute Humidity, components/sensor/absolute_humidity, water-drop.svg
|
||||
AHT10 / AHT20 / AHT21 / DHT20, components/sensor/aht10, aht10.jpg, Temperature & Humidity
|
||||
AirThings BLE, components/sensor/airthings_ble, airthings_logo.png, Temperature & Humidity & Pressure
|
||||
AM2320, components/sensor/am2320, am2320.jpg, Temperature & Humidity
|
||||
|