Hello,
I try to calculate the abs humidity in my bathrooms, cause I will try to open the window until the abs humidity is on a level that the rel. humidity is in between 40 to 60 % after heating the room again.
but I do get a String as response instead of a numeric value. This is the code I have integrated in my sensor.yaml file:
- platform: template
sensors:
hum_abs_bad2og:
value_template: >-
{% set h, t = states('sensor.bad_2_og_humiditiy') | float, states('sensor.bad_2_og_temperature' | float ) %}
{{ (h*6.112*2.1674*e**((t*17.67)/(t+243.5))/(t+273.15))|round(2) }}
unit_of_measurement: 'g/m³'
friendly_name: 'abs. humidity 2.OG'