Home Assistant Community

Heat Index / Apparent Temperature / Feels Like Temperature

#1

I just built my first Mysensors sensor (temperature-humidity sensor) and it was successfully integrated in HASS. I extend it further by making a Heat Index sensor using this formula.

Here is the code in configuration.yaml

sensor: 
- platform: template
  sensors:
    heat_index_1:
      friendly_name: 'Feels Like'
      #formula taken from http://www.srh.noaa.gov/ama/?n=heatindex
      value_template: '{{ (((-42.379 + (2.04901523*(((states.sensor.humidity_1_1.state|float)*1.8)+32)) + (10.14333127*(states.sensor.humidity_1_0.state|float)) - (0.22475541*(((states.sensor.humidity_1_1.state|float)*1.8)+32)*(states.sensor.humidity_1_0.state|float)) - (6.83783 * (10**(-3))*((((states.sensor.humidity_1_1.state|float)*1.8)+32)**2)) - (5.481717 * (10**(-2))*((states.sensor.humidity_1_0.state|float)**2)) + (1.22874 * (10**(-3))*((((states.sensor.humidity_1_1.state|float)*1.8)+32)**2*(states.sensor.humidity_1_0.state|float))) + (8.5282 * (10**(-4))*((((states.sensor.humidity_1_1.state|float)*1.8)+32)*(states.sensor.humidity_1_0.state|float)**2)) - (1.99 * (10**(-6))*((((states.sensor.humidity_1_1.state|float)*1.8)+32)**2)*((states.sensor.humidity_1_0.state|float)**2)))-32)/1.8)|round(1) }}'
      unit_of_measurement: '°C'

Then you can display it in the group such as this…

2 Likes
Create "sensor" from two existing ones
BRUH DIY Multisensor
#2

Is that accurate? Big difference in Feels Like and temperature there.

#3

Yeah, I know. But I have tested it out at…

http://www.calculator.net/heat-index-calculator.html?airtemperature=29.1&airtemperatureunit=celsius&humidity=89.6&dewpoint=&dewpointunit=farenheit&x=69&y=14

and

http://www.srh.noaa.gov/epz/?n=wxcalc_heatindex

#4

Resurrecting an old thread but (hopefully) for good reason.

At home right now it’s 18C & 40% inside according to my Nest. That produces a Heat Index of 26 using your formula so I used the simpler Heat Index Formula from http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml (last one on the page)

HI = 0.5 * {T + 61.0 + [(T-68.0)*1.2] + (RH*0.094)}

So, pulling the info from my Nest and converting it to Fahrenheit for the equation (but keeping the result in Celsius), my value template looks like this:

value_template: '{{ (((((((states.sensor.upstairs_thermostat_nest_temperature.state|float)*1.8)+32) + 61.0 + (((((states.sensor.upstairs_thermostat_nest_temperature.state|float)*1.8)+32)-68.0)*1.2) + ((states.sensor.upstairs_thermostat_nest_humidity.state|float)*0.094))*0.5)-32)/1.8)|round(1) }}'

The result is 16.9C, which I figure is much more likely given how chilly I feel.

Next step is to write an automation that triggers the AC when the Heat Index rises above the Set Temperature… Helps me feel warm to think about such things in the middle of winter!

3 Likes
#5

Re-resurrecting an old thread for reasons I feel are good as well…

I did a bit of research about heat index and it seemed to only apply to the great outdoors. Then I stumbled across the following article: http://www-das.uwyo.edu/~geerts/cwx/notes/chap05/apparentt.html

It was clear to me that heat index and wind chill really don’t apply in the case of indoor temperature. I really wanted to take advantage of the formula provided, but needed Saturation Vapor Pressure and Actual Vapor pressure in order to calculate that value. That’s when I found the following: https://physics.stackexchange.com/questions/4343/how-can-i-calculate-vapor-pressure-deficit-from-temperature-and-relative-humidit which provided the final piece of the puzzle.

Armed with all of the above, I came up with the following value template:

    value_template: >
      {% set upstairs_temp_c = ((states('sensor.upstairs_temperature') | float) - 32) * 5/9 %}
      {% set es = 0.6108 * e ** (17.27 * upstairs_temp_c / (upstairs_temp_c + 237.3)) %} {# Saturation vapor pressure in kPa #}
      {% set ea = ((states('sensor.upstairs_humidity') | float) / 100 * es) %} {# Actual vapor pressure in kPa #}
      {% set tp = -1.3 + 0.92 * upstairs_temp_c + 2.2 * ea %} {# Apparent temperature in C #}
      {% set tpf = (tp * 9/5) + 32 %}
      {{ tpf | round(1) }}
1 Like
#6

thanks for sharing this. but I’m not sure is this the right one. I have compared the apparent temperature given by dark sky vs the result calculated at https://www.calculator.net/heat-index-calculator.html using the temperature and humidity value from dark sky are quite consistent.

#7

Anyway, I have revisited the formula page at https://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml and updated the template based on my understanding. Here is the latest version…

- platform: template
  sensors:
    outdoor_heat_index:
      friendly_name: 'Outdoor Feels Like'
      value_template: >-
          {% set T = ((states.sensor.outdoor_temperature.state|float)*1.8)+32 %}
          {% set RH = states.sensor.outdoor_humidity.state|float %}

          {% set STEADMAN_HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (RH*0.094)) %}

          {% if STEADMAN_HI >= 80 %}

            {% set ROTHFUSZ_HI = -42.379 + 2.04901523*T + 10.14333127*RH - 0.22475541*T*RH - 0.00683783*T*T - 0.05481717*RH*RH + 0.00122874*T*T*RH + 0.00085282*T*RH*RH - 0.00000199*T*T*RH*RH %}
            
            {% set HI = ROTHFUSZ_HI %}
          
            {% if RH < 13 and 80 < T < 112 %}
              {% set ADJUSTMENT = ((13-RH)/4)*((17-(T-95)|abs)/17)**0.5 %}
              {% set HI = HI - ADJUSTMENT %}
            {% elif RH > 85 and 80 < T < 87 %}
              {% set ADJUSTMENT = ((RH-85)/10) * ((87-T)/5) %}
              {% set HI = HI + ADJUSTMENT %}
            {% endif %}
            
          {% else %}
            {% set HI = STEADMAN_HI %}
          {% endif %}

          {% set HI_C = (HI-32)/1.8 %}
          
          {{- HI_C|round(1) -}}
      unit_of_measurement: '°C'
#8

Hi.

Sorry for resurrecting this topic, but I get errors on this config:

  - platform: template
    sensors:
      outdoor_heat_index:
        friendly_name: 'Outdoor Feels Like'
        value_template: >-
          {% set T = ((states.sensor.0x00158d000304031a_temperature.state|float)*1.8)+32 %}
          {% set RH = states.sensor.0x00158d000304031a_humidity.state|float %}
          {% set STEADMAN_HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (RH*0.094)) %}
          {% if STEADMAN_HI >= 80 %}
            {% set ROTHFUSZ_HI = -42.379 + 2.04901523*T + 10.14333127*RH - 0.22475541*T*RH - 0.00683783*T*T - 0.05481717*RH*RH + 0.00122874*T*T*RH + 0.00085282*T*RH*RH - 0.00000199*T*T*RH*RH %}
            {% set HI = ROTHFUSZ_HI %}
            {% if RH < 13 and 80 < T < 112 %}
              {% set ADJUSTMENT = ((13-RH)/4)*((17-(T-95)|abs)/17)**0.5 %}
              {% set HI = HI - ADJUSTMENT %}
            {% elif RH > 85 and 80 < T < 87 %}
              {% set ADJUSTMENT = ((RH-85)/10) * ((87-T)/5) %}
              {% set HI = HI + ADJUSTMENT %}
            {% endif %}
          {% else %}
          {% set HI = STEADMAN_HI %}
          {% endif %}
          {% set HI_C = (HI-32)/1.8 %}
          {{- HI_C|round(1) -}}
        unit_of_measurement: '°C'

Log:

# hassio ha check
Error: Testing configuration at /config
Failed config
  sensor.template:
    - Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: expected token ')', got 'x00158d000304031a_temperature') for dictionary value @ data['sensors']['outdoor_heat_index']['value_template']. Got '{% set T = ((states.sensor.0x00158d000304031a_temperature.state|float)*1.8)+32 %} {% set RH = states.sensor.0x00158d000304031a_humidity.state|float %} {% set STEADMAN_HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (RH*0.094)) %} {% if STEADMAN_HI >= 80 %}\n  {% set ROTHFUSZ_HI = -42.379 + 2.04901523*T + 10.14333127*RH - 0.22475541*T*RH - 0.00683783*T*T - 0.05481717*RH*RH + 0.00122874*T*T*RH + 0.00085282*T*RH*RH - 0.00000199*T*T*RH*RH %}\n  {% set HI = ROTHFUSZ_HI %}\n  {% if RH < 13 and 80 < T < 11.... (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.template/
    - platform: template
      sensors: [source /config/configuration.yaml:297]
        outdoor_heat_index: [source /config/configuration.yaml:298]
          friendly_name: Outdoor Feels Like
          unit_of_measurement: °C
          value_template: {% set T = ((states.sensor.0x00158d000304031a_temperature.state|float)*1.8)+32 %} {% set RH = states.sensor.0x00158d000304031a_humidity.state|float %} {% set STEADMAN_HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (RH*0.094)) %} {% if STEADMAN_HI >= 80 %}
  {% set ROTHFUSZ_HI = -42.379 + 2.04901523*T + 10.14333127*RH - 0.22475541*T*RH - 0.00683783*T*T - 0.05481717*RH*RH + 0.00122874*T*T*RH + 0.00085282*T*RH*RH - 0.00000199*T*T*RH*RH %}
  {% set HI = ROTHFUSZ_HI %}
  {% if RH < 13 and 80 < T < 112 %}
    {% set ADJUSTMENT = ((13-RH)/4)*((17-(T-95)|abs)/17)**0.5 %}
    {% set HI = HI - ADJUSTMENT %}
  {% elif RH > 85 and 80 < T < 87 %}
    {% set ADJUSTMENT = ((RH-85)/10) * ((87-T)/5) %}
    {% set HI = HI + ADJUSTMENT %}
  {% endif %}
{% else %} {% set HI = STEADMAN_HI %} {% endif %} {% set HI_C = (HI-32)/1.8 %} {{- HI_C|round(1) -}}
Successful config (partial)
  sensor.template:
#9

Solved:

  - platform: template
    sensors:
      heat_index_suite:
        friendly_name: 'Feels Like - Suite'
        value_template: >-
          {% set T = ((states('sensor.0x00158d000304031a_temperature')|float)*1.8+32) %}
          {% set RH = states('sensor.0x00158d000304031a_humidity')|float %}
          {% set STEADMAN_HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (RH*0.094)) %}
          {% if STEADMAN_HI >= 80 %}
            {% set ROTHFUSZ_HI = -42.379 + 2.04901523*T + 10.14333127*RH - 0.22475541*T*RH - 0.00683783*T*T - 0.05481717*RH*RH + 0.00122874*T*T*RH + 0.00085282*T*RH*RH - 0.00000199*T*T*RH*RH %}
            {% set HI = ROTHFUSZ_HI %}
            {% if RH < 13 and 80 < T < 112 %}
              {% set ADJUSTMENT = ((13-RH)/4)*((17-(T-95)|abs)/17)**0.5 %}
              {% set HI = HI - ADJUSTMENT %}
            {% elif RH > 85 and 80 < T < 87 %}
              {% set ADJUSTMENT = ((RH-85)/10) * ((87-T)/5) %}
              {% set HI = HI + ADJUSTMENT %}
            {% endif %}
          {% else %}
          {% set HI = STEADMAN_HI %}
          {% endif %}
          {% set HI_C = (HI-32)/1.8 %}
          {{- HI_C|round(1) -}}
        unit_of_measurement: '°C'
#10

I was just rereading this thread after I came across it again. I just realized we had very different goals in mind.

The heat index calculation you’re using is, in fact, the correct calculation for outdoor “feels like” temperatures. My goal was to calculate a “feels like” temperature for the indoors, which is a very different calculation–note the NOAA formula is only accurate down to 80 degrees F, which would definitely be outside my comfort zone for an indoor temperature.

My usage is primarly for the purpose of tweaking indoor thermostat settings based on a “feels like” temperature rather than an absolute temperature.

Hopefully, that clarifies the use-case and reasoning behind the different formula.