Trigger Furnace Fan if Ecobee Sensor Below Desired Temperature

I am brand-new to Home Assistant. I’m trying to turn on my furnace fan when my basement temperature is 2 degrees lower than desired, basement is occupied & the fan isn’t already running. Why doesn’t this work:

The following in my “configuration.yaml” file:

binary_sensor:
     - platform: template
       sensors:
         basement_cold:
           value_template: "{ {states('target_temperature_low') -  states('sensor.basement_temperature')| float > 2 } AND {states(‘binary_sensor.basement_occupancy’)}}"

And the following in my "automations.yaml file:

- id: Circulate Air
  alias: 'Circulate Air'
  trigger:
    platform: state
    entity_id: binary_sensor.basement_cold
    to: 'on'
  condition:
    condition: state
    entity_id: 'climate.my_ecobee3.fan'
    state: 'off'
  action:
    service: climate.set_fan_mode
    entity_id: climate.my_ecobee3
    data:
    fan_mode: ‘on’

Your condition is set so the action only triggers if the Fan is already on.
This is not what you explain you want to do.

Does the binary sensor change its state correctly?

Thank you @datamonkey, I have changed that to “off”.

I can’t even get to testing because I receive the following error message when I click “Check Config”:

Configuration invalid
Invalid config for [automation]: Entity ID climate.my_ecobee3.fan is an invalid entity id for dictionary value @ data[‘condition’][0][‘entity_id’]. Got None
expected dict for dictionary value @ data[‘action’][0][‘data’]. Got None
extra keys not allowed @ data[‘action’][0][‘fan_mode’]. Got None
extra keys not allowed @ data[‘condition’][0][‘state’]. Got None
not a valid value for dictionary value @ data[‘condition’][0][‘condition’]. Got None. (See /config/configuration.yaml, line 67). Please check the docs at https://home-assistant.io/components/automation/

Unless you plan on using that template sensor in multiple places, I would just ditch the sensor and include all of that in the automation.

You’d have two triggers, one for occupancy, one being a template trigger for the temperature differential going over two, and three conditions, one for the fan, one for occupancy, and one for temperature differential.

The automation would be less succinct, but wouldn’t depend on some other code (the template sensor), and be easier to read and understand in the future when you’re looking back or looking to tweak it.

If you do have other additional uses for that template sensor… Never mind!

I am indeed planning to use the template sensor in a number of places - Actually, one per EcoBee sensor.

But the sensor code seems to validate - I think it is my automation code that is the issue. Any ideas what’s causing the error message?

You are using climate.my_ecobee3.fan as an entity ID but it’s an attribute, hence why you are getting an “invalid entity id” error. The entity id is climate.my_ecobee3 and the attribute is fan. You either need to use a value_template for the condition, or create another binary_sensor to extract it.

Maybe this:

condition:
  condition: state
  entity_id: climate.my_ecobee3
  state: 'off'
  value_template: "{{ state_attr('climate.my_ecobee3', 'fan') }}"

Or make a binary_sensor with the same template, call it something like ecobee3_fan_on, and replace climate.my_ecobee3.fan with binary_sensor.ecobee3_fan_on.

Also, be careful about your quotes. It might have just been a result of copying into the post here.

Bad: fan_mode: ‘on’
Good: fan_mode: 'on'

Thank you @freshcoast, that is very helpful.

However, the following still gives me an error message:

- id: Circulate Air
  alias: 'Circulate Air'
  trigger:
    platform: state
    entity_id: binary_sensor.basement_cold
    to: 'on'
  condition:
    condition: state
    entity_id: climate.my_ecobee3
    state: 'off'
    value_template: "{{ state_attr('climate.my_ecobee3', 'fan') }}"
  action:
    service: climate.set_fan_mode
    entity_id: climate.my_ecobee3
    data:
    fan_mode: 'on'

Not sure what is still wrong…

What’s the error message, something different?

Looks like there could be an indentation problem with the action. I think it should look like this:

  action:
    service: climate.set_fan_mode
    data:
      entity_id: climate.my_ecobee3
      fan_mode: 'on'

There’s an example here: https://www.home-assistant.io/components/climate/#service-climateset_fan_mode

One other thing, have you manually tested the climate.set_fan_mode via the service panel? The Ecobee docs say that set_fan_mode is not implemented for the Ecobee. https://www.home-assistant.io/components/climate.ecobee/#services

1 Like

@freshcoast, thank you for your reply. I believe I have now fixed the indentation:

- id: Circulate Air
  alias: 'Circulate Air'
  trigger:
    platform: state
    entity_id: binary_sensor.basement_cold
    to: 'on'
  condition:
    condition: state
    entity_id: climate.my_ecobee3
    state: 'off'
    value_template: "{{ state_attr('climate.my_ecobee3', 'fan') }}"
  action:
    service: climate.set_fan_mode
    data:
        entity_id: climate.my_ecobee3
        fan_mode: 'on'

…But I still see the following error message:

Invalid config for [automation]: extra keys not allowed @ data[‘condition’][0][‘state’]. Got None
not a valid value for dictionary value @ data[‘condition’][0][‘condition’]. Got None. (See /config/configuration.yaml, line 67). Please check the docs at Automation - Home Assistant

I see what you are referring to in the Ecobee documentation (https://www.home-assistant.io/components/climate.ecobee/#services)…Does this mean I can’t use Home Assistant to trigger my furnace fan?

Sorry, I’m just guessing at this point. Maybe the value_template in the state condition doesn’t work that way. Here’s another way:

condition:
  condition: template
  value_template: "{{ is_state_attr('climate.my_ecobee3', 'fan', 'off') }}"

Does this mean I can’t use Home Assistant to trigger my furnace fan?

Well, the docs could be just be out of date and no longer correct. If you look at the Ecobee thermostat source code, it does allow you to set the fan_mode. Allowed values are “on” and “auto”. core/homeassistant/components/climate/ecobee.py at e28170a0a6fcfd936e1d3ca5a233f2745aaa0c7c · home-assistant/core · GitHub

You can try it yourself by going to the services panel (https://your-url/dev-service), looks like a remote control, and enter in the climate.set_fan_mode, entity_id, and fan_mode to “on” and run it. If you click on the Climate card it might also give you the option to do so.

@freshcoast, I tried the other version of the value_template, but still get the following error message:

Invalid config for [automation]: extra keys not allowed @ data[‘condition’][0][‘state’]. Got None
not a valid value for dictionary value @ data[‘condition’][0][‘condition’]. Got None. (See /config/configuration.yaml, line 67). Please check the docs at Automation - Home Assistant

I am able to trigger the set_fan_mode via the Climate card. Doing so successfully switches my Ecobee from “Auto” to “On” until the next Ecobee “scheduled activity”.

It could be that you have an indentation problem somewhere else. You might try posting the entire contents of your configuration.yaml (minus the secret parts) and automations.yaml (if you have one), that might give a clue. Otherwise, I’m out of ideas.

@freshcoast, I have added the following at the bottom of my configuration.yaml file:

# EcoBee Binary Sensors
binary_sensor:
 - platform: template
   sensors:
     basement_cold:
       value_template: "{ {states('target_temperature_low') -  states('sensor.basement_temperature')| float > 2 } AND {states(‘binary_sensor.basement_occupancy’)}}"

And the following is the complete contents of my automations.yaml file:

- id: Circulate Air
  alias: 'Circulate Air'
  trigger:
  - platform: state
    entity_id: binary_sensor.basement_cold
    to: 'on'
  condition:
    condition: state
    entity_id: climate.my_ecobee3
    state: 'off'
    value_template: "{{ is_state_attr('climate.my_ecobee3', 'fan', 'off') }}"
  action:
  - service: climate.set_fan_mode
    data:
        entity_id: climate.my_ecobee3
        fan_mode: 'on'

Thanks!

Any further insights? I still can’t get this to work…

Sorry, none. Check the formatting of the automation entry in your configuration.yaml, perhaps an issue there. You might also try entering the same automation rules in the UI and see if that works.

Did you get this working? I suspect the problem is simply that ecobee doesn’t listen to the service climate.set_fan_mode and instead you have to use climate.ecobee_set_fan_min_on_time and send it 0 for off and 60 for on, or 30 or whatever if you want it to only run some of the time.

I have my version of this working using an automation and a template sensor.

I also have a custom switch so I can see if the fan is on or off and easily turn it on by hand if I want.

There are a few subtleties in the config that I’ll explain at the bottom.

configuration.yaml:

# Sensors
sensor:
  # Custom Sensors
  - platform: template
    sensors:
      # Difference between max and minimum temperature in the house
      ecobee_spread:
        friendly_name: 'Temperature Spread'
        unit_of_measurement: 'Δ°F'
        device_class: temperature
        value_template: >-
          {% set t = [
            states('sensor.lilbee_temperature'),
            states('sensor.office_temperature'),
            states('sensor.thermostat_temperature')
            ] | map('regex_replace', '(^[-+]?[0-9]*\.?[0-9]+$)|.*', '\\1') 
              | reject('eq', '') 
              | map('float')
              | list %}
          {% set spread = t|max - t|min if t else 0 %}
          {{ spread | round(2) }}

# Switches
switch:
  - platform: template
    switches:
      thermostat_fan_mode:
        friendly_name: "Thermostat Fan Mode"
        value_template: "{{ state_attr('climate.thermostat', 'fan_min_on_time')|int > 5 }}"
        icon_template: >-
          {% if state_attr('climate.thermostat', 'fan_min_on_time')|int > 5 -%}
            mdi:fan
          {%- else -%}
            mdi:fan-off
          {%- endif %}
        turn_on:
          - service: climate.ecobee_set_fan_min_on_time
            data:
              entity_id: climate.thermostat
              fan_min_on_time: 60
        turn_off:
          - service: climate.ecobee_set_fan_min_on_time
            data:
              entity_id: climate.thermostat
              fan_min_on_time: 0

automations.yaml:

- alias: "Normalize Temperature"
  initial_state: off
  trigger:
    - entity_id: sensor.ecobee_spread
      platform: state
  condition:
    - condition: numeric_state
      entity_id: sensor.ecobee_spread
      above: 2.8
  action:
    - service: climate.ecobee_set_fan_min_on_time
      entity_id: climate.thermostat
      data_template:
        fan_min_on_time: >-
          {{- 30 if states('sensor.ecobee_spread')|float >= 3.0 
                   and states('sensor.thermostat_temperature')|float >= 65.0 else 0 -}}

The reason I use such a strange expression for creating sensor.ecobee_spread is that I want to filter out any unknown (non numeric) values because if the ecobee misses a sensor for whatever reason then it ends up causing a naive conversion to float to become 0.0 and that makes the spread rating spike up to something like 60 or 70. I could probably get away with a simple reject('eq', 'unknown') but I got anal and decided to reject anything that isn’t a valid float.

In the automation, I have a kluge that runs the condition any time the spread is > 2.8 degrees, but I actually only set the fan runtime if the spread is >= 3.0 degrees. This is so that there is a chance for the automation to set the fan runtime to zero. Otherwise I’d need 2 automations, one to turn the fan on and one to turn it off. I also restrict the normalize temperature to when the house is above 65 degrees since I find it uncomfortable to blow cold air around at night when we’re sleeping and the house has cooled. I shoudl probably limit it on the high end too to prevent the fan from running when we are gone and/or if nothing is occupied.

Note that I still have a bit of trouble with this automation when the spread is close to 3.0 there is a tendency for this approach to cause the fan to cycle on and off more than it should. Really I should put in a duration constraint somewhere so that the runtime is not changed too frequently.

1 Like

I got something working today that should work for you too.

I created a Template Switch that sets fan_mode to on, thereby forcing the fan to run. It works right away but will take a few seconds, maybe even a minute before the switch will show as on due to the rate the ecobee updates

- platform: template
  switches:
    fan_mode:
      friendly_name: "Force Fan On"
      value_template: "{{ is_state_attr('climate.home', 'fan_mode', 'on') }}"
      turn_on:
          service: climate.set_fan_mode
          data:
            fan_mode: 'on'
      turn_off:
          service: climate.set_fan_mode
          data:
            fan_mode: 'auto'
1 Like