My First Attempt: Set the thermostat based on perceived temperature

Newbie here. Very cool product you’ve got! I just thought I’d share this script I’ve written. The intent is to use an approximation of perceived temperature (I’m using a calculation I found for heat index) based on some source reading the humidity. In my case I don’t have an actual humidity sensor (may buy one if this works well) but I’m using the “weather.home” humidity property.

set_the_thermostat_based_on_real_feel:
  alias: Set the thermostat based on feel
  description: Set the thermostat based on perceived temperature, derived using humidity
    and the simplified Heat Index equation (https://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml)
  fields:
    trg_thermostat:
      name: Thermostat
      description: Thermostat or climate device to control
      required: true
      selector:
        entity:
          domain: climate
    t_perceived:
      name: Perceived Temperature (F)
      description: Perceived temperature
      default: 78
      required: true
      selector:
        number:
          min: 40
          max: 100
          step: 0.1
          unit_of_measurement: °F
    humidity_target:
      name: Humidity source
      description: Entity to read humidity (must provide attribute "humidity")
      required: true
      selector:
        entity:
  sequence:
  - service: climate.set_temperature
    data:
      temperature: '{{((2 * t_perceived) - (0.094*state_attr(humidity_target,''humidity''))
        + 20.6)/2.2 | float}}'
    target:
      entity_id: '{{ trg_thermostat }}'
  mode: single
  icon: mdi:thermometer

Now my automations and scripts for setting the thermostat are calling out to this script, whereas before they were calling “climate.set_temperature” directly:


I would assume if you have an actual humidity sensor then this can still work. Anyway let me know what you think!