Last active
April 9, 2023 17:20
-
-
Save boozeman/6e283b67a9b4deb08c34fd602c7b21e3 to your computer and use it in GitHub Desktop.
Using Temperature, Humidity and Atmospheric Pressure for some Greenhouse Calculating Stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Some stuff for testing Home Assistant Template to make template sensors #} | |
{# This is equivalent to Tasmota Berry Script used on greenhouse automation #} | |
{# https://gist.github.com/boozeman/e191e01ef914e2651544a03a7acf32eb #} | |
{# Target_VPD set here by hand. Read some sensor data to variables #} | |
{% set Target_VPD = 1.4 |float %} | |
{% set T = states('sensor.your_sensor_sht3x_temperature') |float %} | |
{% set RH = states('sensor.your_sensor_sht3x_humidity') |float %} | |
{% set p = states('sensor.your_sensor_bme280_seapressure') |float %} | |
{# Absolute Humidity g/m3 #} | |
{% set AH = RH * 6.112 * e**((17.67 * T) / (T + 243.5)) * 2.1674 / (273.15 + T) * p / 1013.25 %} | |
{# Saturation Vapour Pressure in kPa #} | |
{% set SVP = 610.78 * e**(T / (T + 237.3) * 17.2694) /1000 %} | |
{# Saturation Vapour Pressure but different equation in kPa #} | |
{% set es = 6.112 * e**((17.67 * T) / (T + 243.5)) /10 %} | |
{# Actual Vapour Pressure in kPa #} | |
{% set ea = RH/100 * es %} | |
{# Vapour Pressure Deficit calculated with 2 different ways in kPa #} | |
{# https://gardeningincanada.net/rapid-growth-from-houseplants/ #} | |
{% set VPD = es - ea %} | |
{% set VPD2 = SVP * (1 - RH/100) %} | |
{# How to get optimal relative humidity for choosed VPD value #} | |
{% set Target = SVP - Target_VPD %} | |
{% set rh = (Target / es) * 100 %} | |
Temperature: {{ T }} | |
equivalent sealevel pressure: {{ p }} hPa | |
relative humidity: {{ RH }} % | |
Saturation vapour pressure: {{ es |round(3) }} kPa | |
Saturation vapour pressure2_ {{ SVP |round(3) }} kPa | |
Actual vapour pressure: {{ ea |round(3) }} kPa | |
Vapour pressure Deficit VPD {{ VPD |round(3) }} kPa | |
VPD2: {{ VPD2 |round(3) }} | |
Absolute humidity:{{ AH |round(2) }} g/m3 | |
Target humidity for VPD:{{ rh |round(1) }} % |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment