Calculating Vapor Pressure Deficit (or VPD) in kPa

In case you’re somewhere in the world where your sensors are in Celcius (not F), then I found it easiest to add an additional line to convert between C → F for the remainder of the math to work:

sensor:
  - platform: template
    sensors:
      vapor_deficit:
        unique_id: 'vpd_in_kpa'
        friendly_name: 'VPD in kilo pascals'
        value_template: >-
          {% set TC = ((states('sensor.co2_1_temperature') | float) - 32) * 5/9 %}
          {% set T = (TC * 5 / 9  + 32 | round(2)) %}
          {% set RH = states('sensor.co2_1_humidity')|float %}
          {% set SVP = 0.61078 * e ** (17.2694 * T / (T + 238.3)) %}
          {% set VPD = ((100-RH) / 100) * SVP %}
          {{-VPD | round(2) -}}
        unit_of_measurement: 'kPa'

Hopefully that’s useful to somebody :slightly_smiling_face:
Big thanks to @t_rage for the original calculations!

3 Likes