Thermostat Automation Help

One of my bedrooms gets significantly warmer than others. My goal is to make an automation that will trigger the thermostat to run the furnace fan to circulate air when that room gets a few degrees warmer than the rest of the house. I’ve places an Aqari temp sensor in the room and it’s reading correctly, I just need help with the YAML. This is what I’ve got so far but it’s not working correctly. It isn’t triggering on its own, and if I manually run it it runs for 12 hours. I’d like it to run for maybe 5-10 minutes then recheck if there is still a temperature delta.

alias: "RUN fan "
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.lumi_lumi_weather_temperature
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: sensor.nest_thermostat_temperature
    value_template: "2"
condition: []
action:
  - if:
      - condition: not
        conditions:
          - condition: device
            device_id: 91ae04294de2ef5b522104c1b2ede415
            domain: climate
            entity_id: climate.nest_thermostat
            type: is_preset_mode
            preset_mode: eco
    then:
      - service: climate.set_fan_mode
        data:
          fan_mode: "on"
        target:
          device_id: 91ae04294de2ef5b522104c1b2ede415
    else:
      - stop: "In ECO Mode "
mode: restart

The value_template line in your trigger isn’t correct. From what you posted I would guess you actually be better off with a template trigger. While you can do something similar using the Numeric state trigger with a value template, it has a major drawback when comparing two entities with highly dynamic states.

trigger:
  - platform: template
    value_template: |
      {{ states('sensor.lumi_lumi_weather_temperature')|float(0) -
      states('sensor.nest_thermostat_temperature')|float(0) > 2}}"
    for: "00:05:00"

As shown, there’s no action to turn off the fan.

Thanks for that. I’m not sure what to add to turn off the fan or have the automation recycle.

What you add really depends on how you want the automation to behave. In your first post you wrote:

Generally, it’s more efficient (and less complicated to construct) to not employ polling. Instead you would set up a second trigger based on your temperature delta criteria. The following is an example of that.

alias: "RUN fan "
description: ""
trigger:
  - platform: template
    id: 'on'
    value_template: |
      {{ states('sensor.lumi_lumi_weather_temperature')|float(0) -
      states('sensor.nest_thermostat_temperature')|float(0) > 2}}"
    for: "00:05:00"
  - platform: template
    id: 'off'
    value_template: |
      {{ states('sensor.lumi_lumi_weather_temperature')|float(0) <= 
      states('sensor.nest_thermostat_temperature')|float(0) + 0.5 }}"
    for: "00:05:00"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: 'on'
          - condition: not
            conditions:
              - condition: state
                entity_id: climate.nest_thermostat|
                attribute: preset_mode
                state: eco
        sequence:
          - service: climate.set_fan_mode
            data:
              fan_mode: "on"
            target:
              device_id: 91ae04294de2ef5b522104c1b2ede415
      - conditions:
          - condition: trigger
            id: 'off'
         sequence:
           - service: climate.set_fan_mode
             data:
               fan_mode: "off"
             target:
               device_id: 91ae04294de2ef5b522104c1b2ede415
mode: restart

You will likely need to figure out what other conditions will be necessary for accurately controlling turning the fan on and off.

Thank you. That’s helpful. I’m still learning a lot of this and started the automation in the Automation Editor. I can read YAML sorta, but writing it not so much.

As I understand the code you provided, it looks like it will turn on if the temperature is >2 for 5 minutes and turn off if the sensor is <0.5 degrees delta for 5 minutes. Is that correct? I also see you included the extra but of code for disabling if it’s set to ECO.

I appreciate the help. I’m still learning, as I said.