Heat Index / Apparent Temperature / Feels Like Temperature

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ā€¦

6 Likes

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

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

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!

4 Likes

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) }}
6 Likes

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.

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'
3 Likes

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:

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'
2 Likes

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.

2 Likes

Thanks ā€“ this is nearly what I was looking for. I have also realised that even indoor airflow (through fans and ventilators) affect the comfort level.

Is there a method we can first measure indoor air velocity and then use it to tweak the thermostats.

Do you know what Iā€™d have to change to get this to work in Fahrenheit?

I might be missing something, but that template solves for Fahrenheit. It converts to F to C back to F.

Thank you for this template. I needed a template sensor for VPD.

Anyone know if thereā€™s a way to make this calculation reusable?

Iā€™m a bit confused with the above calculations, as the UK Meterology Office describes outdoor ā€˜Feels Likeā€™ temperature as a measurement of temp/humidity/windspeed at a height of 5ft. Unless Iā€™m missing something I donā€™t see windspeed integrated in those calcs. If I find the calculation for this missing piece of info, Iā€™ll post it here.

1 Like

Here in the US, windspeed isnā€™t considered in the feels-like temperature. Hereā€™s the formula: https://www.weather.gov/media/epz/wxcalc/heatIndex.pdf.

Are you still using this formula for indoor? How has it worked for you?
Iā€™m looking into implementing something like that for my home and I think what you wanted is exactly what I want to do.
Could you tell me if you have noticed a difference by using the feeling temperature compared to the real temp?

Thereā€™s generally not a vast difference between the measured temperature and the feels-like temperature. For example, right now thereā€™s only a one-degree difference between the feels-like temperature upstairs and the actual temperature (69.8 vs. 68.8) and thatā€™s with 66% humidity.

I was going to try to look at a historical graph and discovered that history doesnā€™t record derived values, unfortunately. Otherwise, I might have been able to see how much of a delta I saw between the two.

If youā€™re interested in picking up a 1-2 degree difference, it might be useful; otherwise, itā€™s more of a novelty, I think. To answer your question more directly, the only place I leveraged the feels-like temperature is in determining whether to switch over between A/C and Heat. Otherwise, my house uses the thermostat temperature as you would normally.

Just popped in to say this is so beautiful I could cry. You should see my brute force attempt to do the same. With zillions of ifs and ().
Sad.

1 Like