Heat Index Calculated Sensor in Home Assistant

The following is a sample of how to implement a sensor in Home Assistant that displays a calculated heat index value based off an existing sensor device that provides temperature and relative humidity readings.

This calculation is using the formulas provided on the National Weather Service website.

- platform: template
  sensors:
    sensor_device_heat_index:
      unique_id: "your-unique-id-here"
      friendly_name: "Location: Heat Index"
      unit_of_measurement: "°F"
      value_template: >
        {% set sensorVars = {
          "simpleValue": (0.5 * ( states.sensor.device_air_temperature.state|float(default=0) + 61.0 + ((states.sensor.device_air_temperature.state|float(default=0) - 68.0) * 1.2) + (states.sensor.device_humidity.state|float(default=0) * 0.094)) )|round(1, 'common'),
          "regressionValue": (-42.379 + (2.04901523 * states.sensor.device_air_temperature.state|float(default=0)) + (10.14333127 * states.sensor.device_humidity.state|float(default=0)) - (0.22475541 * states.sensor.device_air_temperature.state|float(default=0) * states.sensor.device_humidity.state|float(default=0)) - ((6.83783 * 10**-3) * states.sensor.device_air_temperature.state|float(default=0)**2) - ((5.481717 * 10**-2) * states.sensor.device_humidity.state|float(default=0)**2) + ((1.22874 * 10**-3) * states.sensor.device_air_temperature.state|float(default=0)**2 * states.sensor.device_humidity.state|float(default=0)) + ((8.5282 * 10**-4) * states.sensor.device_air_temperature.state|float(default=0) * states.sensor.device_humidity.state|float(default=0)**2) - ((1.99 * 10**-6) * states.sensor.device_air_temperature.state|float(default=0)**2 * states.sensor.device_humidity.state|float(default=0)**2))|round(1, 'common')
        } %}
        {% if ([sensorVars.simpleValue, states.sensor.device_air_temperature.state|float(default=0)] | average) >= 80.0 -%}
          {{ sensorVars.regressionValue }}
        {% else %}
          {{ sensorVars.simpleValue }}
        {% endif %}

I have a few Z-Wave multi-sensor devices that provide me temperature and humidity data in various rooms of my home. Using the above template, I am able to create individual heat index sensors for each of these devices. Using this I am able to better gauge the comfort level of the air throughout my home and adjust the thermostat accordingly.

Show Comments