Having trouble toggling ecobee fan mode

I created a script to allow me to toggle my ecobee fan mode between auto and on. It works fine when toggling to on but does not work at all when trying to switch back to auto. The trace shows it’s working fine, requesting auto mode, but nothing happens. Any suggestions would be appreciated.

BTW I have tried adding quotes around “auto” but they are removed by the editor.

alias: HVAC - Toggle Fan Mode
sequence:
  - if:
      - condition: state
        entity_id: climate.my_ecobee
        attribute: fan_mode
        state: auto
    then:
      - service: climate.set_fan_mode
        metadata: {}
        data:
          fan_mode: "on"
        target:
          entity_id: climate.my_ecobee
    else:
      - service: climate.set_fan_mode
        metadata: {}
        data:
          fan_mode: auto
        target:
          entity_id: climate.my_ecobee
mode: single
icon: mdi:fan

Did you ever figure out a solution? I’m experiencing the same exact issue and can’t figure out how to fix it.

Yes and no. I never got the script to work and dropped it for a while. Went back to it recently and created what I really wanted which was a one button press for a 10 min fan cycle.

Now I have an input boolean for the timed fan. When that turns on an automation runs a script.

alias: HVAC - Timed Fan - On / Start Timer
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.timed_fan
    from: "off"
    to: "on"
condition: []
action:
  - service: script.hvac_toggle_fan_mode
    metadata: {}
    data: {}
mode: single

The script turns the fan on and starts the timer.

alias: HVAC - Timed Fan Start
sequence:
  - if:
      - condition: state
        entity_id: climate.my_ecobee
        attribute: fan_mode
        state: auto
    then:
      - service: climate.set_fan_mode
        metadata: {}
        data:
          fan_mode: "on"
        target:
          entity_id: climate.my_ecobee
      - service: timer.start
        target:
          entity_id: timer.hvac_fan_timer
        data: {}
    else:
      - service: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.timed_fan
mode: single
icon: mdi:script-text

Then an automation is used to stop timer and/or turn off fan based on ecobee input, input boolean, or timer. I think ecobee.resume_program was the key.

alias: HVAC - Timed Fan - Off
description: ""
trigger:
  - entity_id:
      - climate.my_ecobee
    platform: state
    to: auto
    attribute: fan_mode
    from: "on"
  - platform: state
    entity_id:
      - input_boolean.timed_fan
    to: "off"
    from: "on"
  - platform: state
    entity_id:
      - timer.hvac_fan_timer
    from: active
    to: idle
condition:
  - condition: template
    value_template: >-
      {{(as_timestamp(now()) -
      as_timestamp(state_attr("automation.hvac_fan_timer_finish",
      "last_triggered") | default(0)) | int > 60 )}}
action:
  - service: timer.finish
    target:
      entity_id: timer.hvac_fan_timer
    data: {}
  - service: input_boolean.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.timed_fan
  - service: ecobee.resume_program
    metadata: {}
    data:
      resume_all: false
mode: single
1 Like

Fantastic, thanks so much! Calling ecobee.resume_program did the trick for me in terms of cancelling the manual turning on of the fan.