Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105851

Trouble substrating two variables

$
0
0

Hey guys!

I got a question I can’t figure out. I am trying to create a template sensor to help me judge whether or not it is useful to open the windows to lower the humidity. I can calculate the respective absolute humidity just fine but I am having trouble calculating the offset … it will just not calculate anything but instead turn the sensor to „unavailable“.

variables:
  inside:
    {{ ((e ** ((17.67 * (states('sensor.tuyathsensor2_temperature')|float)) /
    (243.5 + (states('sensor.tuyathsensor2_temperature')|float)) ) * 6.112 *
    (states('sensor.tuyathsensor2_humidity')|float) * 2.1674 ) / (273.15 +
    (states('sensor.tuyathsensor2_temperature')|float))) | round(1) }}
  outside:
    {{ ((e ** ((17.67 * (state_attr('weather.forecast_home',
    'temperature')|float)) / (243.5 + (state_attr('weather.forecast_home',
    'temperature')|float)) ) * 6.112 * (state_attr('weather.forecast_home',
    'humidity')|float) * 2.1674 ) / (273.15 +
    (state_attr('weather.forecast_home', 'temperature')|float))) | round(1) }}
  offset: {{ 'inside' - 'outside' }}
state: {% if 'inside' < 'outside' %} Lüften
 {% else %} Schliessen
 {% endif %}

Also, is there a way to show this offset value as some kind of a gauge?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105851

Trending Articles