Last active
August 2, 2021 03:24
-
-
Save tylerszabo/47f766aaa5d8e97324bb64cd24f3f087 to your computer and use it in GitHub Desktop.
Home Assistant Expected Indoor Humidity computation
This file contains 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
# Use Arden Buck equation <https://en.wikipedia.org/wiki/Arden_Buck_equation> to compute approximate expected indoor humidty given outdoor humidity | |
template: | |
- sensor: | |
unique_id: "tylerszabo/template.sensor:expected-indoor-humidity" | |
name: "Expected Indoor Humidity" | |
unit_of_measurement: "%" | |
device_class: humidity | |
state: > | |
{%- set t0 = states('sensor.outdoor_temperature')|float(undefined) -%} | |
{%- set h0 = states('sensor.outdoor_humidity')|float(undefined) -%} | |
{%- set tx = states('sensor.indoor_temperature')|float(undefined) -%} | |
{%- if t0 is undefined() or h0 is undefined() or tx is undefined() -%} | |
unavailable | |
{%- else -%} | |
{%- if t0 > 0.0 -%} | |
{{ (2.71828**(((18.678 - 0.0042644*t0)*t0)/(t0 + 257.14) - ((18.678 - 0.0042644*tx)*tx)/(tx + 257.14))*h0)|round(2) }} | |
{%- else -%} | |
{{ (2.71828**(((23.036 - 0.0029967*t0)*t0)/(t0 + 279.82) - ((18.678 - 0.0042644*tx)*tx)/(tx + 257.14))*h0)|round(2) }} | |
{%- endif -%} | |
{%- endif -%} | |
trigger: | |
- platform: state | |
entity_id: | |
- sensor.outdoor_temperature | |
- sensor.indoor_temperature | |
- platform: event | |
event_type: event_template_reloaded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment