Heat Index or Real Feel Template with Wind Chill

I’ve been doing a bunch of work on our RV with an additional instance of Home Assistant running on a PI 4. I built an antenna and I’m using 2 RTL dongles to get real time data from multiple sensors. Things are working out great and I wanted to share a method to convert Temperature, Humidity, and Wind Speed to a “Real Feel” Temperature. All you would need is sensor data to supply the data for this template. The units must be in Degrees F and mph. In my case I’m using a LaCrosse Breeze Pro that broadcasts data on 915 MHz.

I’ve also included a wind chill factor to this template for those of us that live in colder climates like Wisconsin.

I’ve simplified the formula to make it easier to read. The formula can be found here

- sensor:
  - name: Feels Like
    state: >
      {% set T = (states('sensor.breeze_pro_temp') | float) %}
      {% set RH = (states('sensor.breeze_pro_humidity') | float) %}
      {% set windspeed = (states('sensor.breeze_pro_wind_speed')|float) %}
      {% set C1 = 42.379 | float %}
      {% set C2 = 2.04901523 | float %}
      {% set C3 = 10.14333127 | float %}
      {% set C4 = 0.22475541 | float %}
      {% set C5 = 0.00683783 | float %}
      {% set C6 = 0.05481717 | float %}
      {% set C7 = 0.00122874 | float %}
      {% set C8 = 0.00085282 | float %}  
      {% set C9 = 0.00000199 | float %}        
      {% set heat_index = -C1 + C2*T + C3*RH - C4*T*RH - C5*T**2 - C6*RH**2 + C7*T**2*RH + C8*T*RH**2 - C9*T**2*RH**2 %}      

      {% if (80.0 <= T <= 112.0) and (RH < 13) %}
        {% set A1 = ((13 - RH)/4)*((17-(T-95 |abs)/17)**0.5)  %}
        {% set feels_like = heat_index - A1 |round(1) %}

      {% elif (80.0 <= T <= 87.0) and (RH > 85) %} 
        {% set A1 = (RH - 85)/10 * ((87 - T)/5) %}
        {% set feels_like = heat_index - A1 |round(1) %}

      {% elif (50.0 < T < 80.0) %}
        {% set heat_index = 0.5 * (T + 61.0 + (T - 68)*1.2) + (RH * 0.094) %}
        {% set feels_like = (heat_index) |round(1) %}

      {% elif (T <= 50.0) and (windspeed >0) %}
        {% set feels_like = ((0.6215 * T) -35.75*(windspeed**0.16) + ((0.4275*T)*(windspeed**0.16))+35.74)| round(1)  %}
      {% else %}
        {% set feels_like = T| round(1)  %} 
      {% endif %} 
      {{ feels_like }} 
    unit_of_measurement: "°F"

Completely appreciate the code!! Initial template wasn’t working for me as it was giving random errors which, yes I am new to Home Assistant. So anyone following along this is how I modified and works like a charm.

- platform: template
  sensors:
    feels_like:
      friendly_name: "Feels Like"
      unit_of_measurement: '°F'
      value_template: >
        {% set T = (states('sensor.acurite_atlas_b_538_f') | float) %}
        {% set RH = (states('sensor.acurite_atlas_b_538_h') | float) %}
        {% set windspeed = (states('sensor.acurite_atlas_b_538_ws')|float) %}
        {% set C1 = 42.379 %}
        {% set C2 = 2.04901523 %}
        {% set C3 = 10.14333127 %}
        {% set C4 = 0.22475541 %}
        {% set C5 = 0.00683783 %}
        {% set C6 = 0.05481717 %}
        {% set C7 = 0.00122874 %}
        {% set C8 = 0.00085282 %}  
        {% set C9 = 0.00000199 %}        
        {% set heat_index = -C1 + C2*T + C3*RH - C4*T*RH - C5*T**2 - C6*RH**2 + C7*T**2*RH + C8*T*RH**2 - C9*T**2*RH**2 %}      

        {% if (80.0 <= T <= 112.0) and (RH < 13) %}
          {% set A1 = ((13 - RH)/4)*((17-(T-95 |abs)/17)**0.5) %}
          {% set feels_like = heat_index - A1 |round(1) %}

        {% elif (80.0 <= T <= 87.0) and (RH > 85) %} 
          {% set A1 = (RH - 85)/10 * ((87 - T)/5) %}
          {% set feels_like = heat_index - A1 |round(1) %}

        {% elif (50.0 < T < 80.0) %}
          {% set heat_index = 0.5 * (T + 61.0 + (T - 68)*1.2) + (RH * 0.094) %}
          {% set feels_like = heat_index | round(1) %}

        {% elif (T <= 50.0) and (windspeed > 0) %}
          {% set feels_like = ((0.6215 * T) - 35.75*(windspeed**0.16) + ((0.4275*T)*(windspeed**0.16))+35.74) | round(1) %}
        {% else %}
          {% set feels_like = T | round(1) %}
        {% endif %} 
        {{ feels_like }}

feels_like