Ecobee Aux Heat Automation Trigger

Which method did you use to arrive at that conclusion:

  1. You used the automation’s Run command and observed it executed the automation’s actions regardless of the conditions.

  2. You waited for the automation’s State Trigger to trigger and observed it executed the automation’s actions regardless of the conditions.

  • If #1 then it’s normal; the Run command only runs the actions.

  • If #2 then it’s abnormal and you should check the automation’s trace to determine why the condition was fulfilled when it should not have been.

Reference

Troubleshooting automations

Thanks for the assurance with this, I ran the automation manually instead of waiting for trigger point. I will try it again with condition triggers and report back.

If you want to test the automation’s State Trigger but not wait for the value of the sensor’s active_peak attribute to change to on_peak, you can manually set the value (the new value is temporary but sufficient to “force” a trigger).

  1. Go to Developer Tools > States
  2. Find sensor.toronto_hydro_electric_system_limited_residential_rate in the list and click it.
  3. Scroll to the top of the page where all of the sensor’s properties are displayed in a form.
  4. Take note of the current value of active_peak (perhaps make a copy of it)
  5. Change the value of active_peak to on_peak
  6. Click the Set State button

That should trigger your automation. Use the same method to set the attribute back to its original value.

Tried those steps in developer tools but it would not trigger and state change back very quickly. I guess will wait to confirm full function till state changes tomorrow from addon for hydro rate.

Check the automation’s trace…

Thanks, trace seems to show it did run and exited out since condition was not met as expected.

One last question, if the condition is not met and it exists out without triggering, can a notification be sent out and if so where would I add it?

No, because the purpose of an automation’s condition is to determine if the automation should, or should not, execute its actions.

What you can do is move the conditional logic out of condition and into action. Specifically into an if-then-else.

alias: example
trigger:
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: on_peak
condition: []
action:
  - if:
      - condition: state
        entity_id: climate.my_ecobee_3
        state: heat
      - condition: numeric_state
        entity_id: sensor.toronto_temperature
        below: -1
    then:
      - service: climate.set_aux_heat
        target:
          device_id: e144dbd5b26383e5540eb630baa31d66
          entity_id: climate.my_ecobee_3
        data:
          aux_heat: true
    else:
      - service: notify.notify
        data:
          message: "Currently on peak but conditions were not met."

BTW, the climate.set_aux_heat service call is setting two entities, one by entity_id and another by device_id. Are they in fact two different entities?

Thanks again for your help, I implanted the changes you provided on the example. I also eliminated the service call for climate having device and entity id and just have entity id now. Will see how it works through the rate changes through the day.

I think I have most of most of the logic flow worked out and automation to turn on and off Aux heat based on TOU rate and weather seems to be working. I would just like to add one more condition on setting back from Aux to heat pump heat where it checks detla between current_temperature and set temperature attributes on Ecobee so if the delta is more than 1 it keeps Aux running. Any help with adding this check will be greatly appreciated.

description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: on_peak
condition: []
action:
  - if:
      - condition: state
        entity_id: climate.my_ecobee_3
        state: heat
      - condition: or
        conditions:
          - condition: numeric_state
            entity_id: sensor.toronto_temperature
            below: -1
          - condition: state
            entity_id: weather.toronto
            state: snowy
          - condition: numeric_state
            entity_id: sensor.toronto_humidity
            above: 90
            enabled: true
    then:
      - service: climate.set_aux_heat
        data:
          aux_heat: true
        target:
          entity_id: climate.my_ecobee_3
      - service: notify.notify
        data:
          message: Ecobee switched from Heat Pump heating to Aux heating.
          title: Aux Heat
    else:
      - service: notify.notify
        data:
          message: >-
            Ecobee remained on Heat Pump heating, conditions were not met to
            switch to Aux Heat.
          title: Aux Heat
mode: single
alias: Aux Off non-peak rate
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: off_peak
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: mid_peak
  - platform: state
    entity_id:
      - climate.my_ecobee_3
    attribute: aux_heat
    to: "on"
condition: []
action:
  - if:
      - condition: numeric_state
        entity_id: sensor.toronto_temperature
        above: -5
    then:
      - service: climate.set_aux_heat
        data:
          aux_heat: false
        target:
          entity_id: climate.my_ecobee_3
      - service: notify.notify
        data:
          message: Ecobee switched from Aux heating heating to Heat Pump.
          title: Aux Heat
    else:
      - service: notify.notify
        data:
          message: >-
            Ecobee remained on Aux heating, conditions were not met to switch to
            Heat Pump.
          title: Aux Heat
mode: single

type or paste code here

type or paste code here

type or paste code here

type or paste code here

I think I have most of the logic flow worked out and automation to turn on and off Aux heat based on TOU rate and weather seems to be working. I would just like to add one more condition on setting back from Aux to heat pump heat where it checks detla between current_temperature and set temperature attributes on Ecobee so if the delta is more than 1 it keeps Aux running. Any help with adding this check will be greatly appreciated.

description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: on_peak
condition: []
action:
  - if:
      - condition: state
        entity_id: climate.my_ecobee_3
        state: heat
      - condition: or
        conditions:
          - condition: numeric_state
            entity_id: sensor.toronto_temperature
            below: -1
          - condition: state
            entity_id: weather.toronto
            state: snowy
          - condition: numeric_state
            entity_id: sensor.toronto_humidity
            above: 90
            enabled: true
    then:
      - service: climate.set_aux_heat
        data:
          aux_heat: true
        target:
          entity_id: climate.my_ecobee_3
      - service: notify.notify
        data:
          message: Ecobee switched from Heat Pump heating to Aux heating.
          title: Aux Heat
    else:
      - service: notify.notify
        data:
          message: >-
            Ecobee remained on Heat Pump heating, conditions were not met to
            switch to Aux Heat.
          title: Aux Heat
mode: single
alias: Aux Off non-peak rate
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: off_peak
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: mid_peak
  - platform: state
    entity_id:
      - climate.my_ecobee_3
    attribute: aux_heat
    to: "on"
condition: []
action:
  - if:
      - condition: numeric_state
        entity_id: sensor.toronto_temperature
        above: -5
    then:
      - service: climate.set_aux_heat
        data:
          aux_heat: false
        target:
          entity_id: climate.my_ecobee_3
      - service: notify.notify
        data:
          message: Ecobee switched from Aux heating heating to Heat Pump.
          title: Aux Heat
    else:
      - service: notify.notify
        data:
          message: >-
            Ecobee remained on Aux heating, conditions were not met to switch to
            Heat Pump.
          title: Aux Heat
mode: single

Glad to hear it.

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title and add a link to your first post that leads to the Solution. This helps users find answers to similar questions.

For more information about the Solution tag, refer to Guideline 21 in the FAQ.

Give me a few minutes. The community forum is sluggish (reportedly under heavy load; you may have noticed that your last post was duplicated) and posting is challenging.


EDIT 1

Use this service call in your automation. The template return a boolean true (aux heat on) if the delta is greater than 1 otherwise it returns boolean false (aux heat off).

      - service: climate.set_aux_heat
        data:
          aux_heat: >
            {% set thermostat = 'climate.my_ecobee_3' %}
            {% set current = state_attr(thermostat, 'current_temperature') %}
            {% set target = state_attr(thermostat, 'temperature') %}
            {{ target - current > 1 }}
        target:
          entity_id: climate.my_ecobee_3

EDIT 2

Amendment. Added the balance of the service call, namely the target.


EDIT 3

Correction. Added missing closing parenthesis on lines 2 and 3 of the aux_heat template.

Thanks again, I marked your reply above as the solution.

For the delta check on turning off aux, do I just replace below in YAML view?

From

- service: climate.set_aux_heat
        data:
          aux_heat: false
        target:
          entity_id: climate.my_ecobee_3

To:

 - service: climate.set_aux_heat
        data:
          aux_heat: >
            {% set thermostat = 'climate.my_ecobee_3' %}
            {% set current = state_attr(thermostat, 'current_temperature' %}
            {% set target = state_attr(thermostat, 'temperature' %}
            {{ target - current > 1 }}

When I do that and save it, the change does not seem to reflect when I go back to the automation and view it, not sire if that is expected

I had only posted part of the service call (the part that should be changed). However I see how that can be misleading so I have amended my original example so that it now includes the entire service call (i.e. including the target part).

Getting error saving the updated code indicating "Message malformed: template value should be a sting for dictionary value @ data [‘action’][0][‘then’][0][‘data’]. Any idea why that is happening?

Message malformed: template value should be a sting

The error message appears to indicate that it wants the template to report a string value as opposed to what it’s currently doing (reporting a boolean value). Worst case is the aux_heat option doesn’t support templates but let’s assume it does for now.

Replace:

{{ target - current > 1 }}

with:

{{ 'true' if target - current > 1 else 'false' }}

I have a feeling that Home Assistant’s native typing feature will convert the string true to a boolean true and result in the same error message. Anyway, try it and let me know the result.

Same result as you had expected after the change.

In that case, I think we will have to resort to brute-force.

alias: Aux Off non-peak rate
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: off_peak
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: mid_peak
  - platform: state
    entity_id:
      - climate.my_ecobee_3
    attribute: aux_heat
    to: "on"
condition: []
action:
  - if:
      - condition: numeric_state
        entity_id: sensor.toronto_temperature
        above: -5
    then:
      - if:
          - condition: template
            value_template: >
              {% set thermostat = 'climate.my_ecobee_3' %}
              {% set current = state_attr(thermostat, 'current_temperature' %}
              {% set target = state_attr(thermostat, 'temperature' %}
              {{ target - current > 1 }}
        then:
          - service: climate.set_aux_heat
            data:
              aux_heat: true
            target:
              entity_id: climate.my_ecobee_3
        else:
          - service: climate.set_aux_heat
            data:
              aux_heat: false
            target:
              entity_id: climate.my_ecobee_3
      - service: notify.notify
        data:
          message: Ecobee switched from Aux heating heating to Heat Pump.
          title: Aux Heat
    else:
      - service: notify.notify
        data:
          message: >-
            Ecobee remained on Aux heating, conditions were not met to switch to
            Heat Pump.
          title: Aux Heat
mode: single

Still getting below error with revised code, may need to give up on that delta check.

Message malformed: invalid template (TemplateSyntaxError: unexpected ‘}’, expected ‘)’) for dictionary value @ data[‘action’][0][‘then’][0][‘if’][0][‘value_template’]

The latest error message identifies a problem that also existing in the original example I had posted. :man_facepalming: There’s a missing closing parenthesis on this line:

{% set current = state_attr(thermostat, 'current_temperature' %}
                                                             ^
                                                             |
                          There should be a ) right here -----

and the next line:

{% set target = state_attr(thermostat, 'temperature' %}
                                                    ^
                                                    |
                 There should be a ) right here -----

I recommend you make the corrections in the “brute-force” version. If that satisfies Home Assistant, I suggest you make the same corrections in the original, non-brute-force version (which is less verbose).

I have corrected the suggested service call posted above but here it is again with the closing parenthesis.

      - service: climate.set_aux_heat
        data:
          aux_heat: >
            {% set thermostat = 'climate.my_ecobee_3' %}
            {% set current = state_attr(thermostat, 'current_temperature') %}
            {% set target = state_attr(thermostat, 'temperature') %}
            {{ target - current > 1 }}
        target:
          entity_id: climate.my_ecobee_3
1 Like

Thanks Again, saved fine now as following, will test to see how it goes.

alias: Aux Off non-peak rate new
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: off_peak
  - platform: state
    entity_id:
      - sensor.toronto_hydro_electric_system_limited_residential_rate
    attribute: active_peak
    to: mid_peak
  - platform: state
    entity_id:
      - climate.my_ecobee_3
    attribute: aux_heat
    to: "on"
condition: []
action:
  - if:
      - condition: numeric_state
        entity_id: sensor.toronto_temperature
        above: -5
    then:
      - if:
          - condition: template
            value_template: >
              {% set thermostat = 'climate.my_ecobee_3' %} {% set current =
              state_attr(thermostat, 'current_temperature') %} {% set target =
              state_attr(thermostat, 'temperature') %} {{ target - current > 1
              }}
        then:
          - service: climate.set_aux_heat
            data:
              aux_heat: true
            target:
              entity_id: climate.my_ecobee_3
        else:
          - service: climate.set_aux_heat
            data:
              aux_heat: false
            target:
              entity_id: climate.my_ecobee_3
      - service: notify.notify
        data:
          message: Ecobee switched from Aux heating heating to Heat Pump.
          title: Aux Heat
    else:
      - service: notify.notify
        data:
          message: >-
            Ecobee remained on Aux heating, conditions were not met to switch to
            Heat Pump.
          title: Aux Heat
mode: single