How to trigger automation from hvac_action

Hello all,

Just getting started in HA and so far it has been great but I am pulling my hair out on this one. I had to put an inline booster fan to one of my HVAC feeds but I would like to have that automatically turn on when the fan is running on my furnace or at least when actively heating or cooling via a smart plug I have. I can handle the rest, I just need some help triggering the automation or monitoring the state of hvac_action.

Best I can tell I should somehow monitor the hvac_action from my ecobee

Thanks!

Have you made any progress?

If not, what climate platform are you using? Can you tell us what the corresponding entity’s attributes are when the fan is running, and/or when it is actively cooling or heating? There are some similarities, of course, between the various climate platforms, but it’s best if you tell us the specifics of yours so we can make a useful suggestion.

Not much, it’s ecobee. Sorry I only had it at the end of the post. Also I’m not exactly sure what you mean by the entity attributes, I’m still very new to HA.

Thanks for the help!

Go to the Developer Tools page. (You many need to go to your profile page and turn on Advanced Mode to enable the Developer Tools page.) Click on the STATES tab. Find the entity for your ecobee in the list (probably climate.something.) It’s current state, and the values of its attributes, will be shown to the right of it.

There may also be other entities created by the ecobee integration (e.g., binary_sensor's or sensor's) that provide some indication of what the ecobee is currently doing.

Monitor the climate entity, and any other sensor entities associated with the ecobee, and see if you can tell what entity or entities, and their corresponding state & attributes, can indicate when the conditions are right to turn on the booster fan. E.g., I’m guessing the climate entity’s hvac_action attribute will at least indicate when the system is actively cooling or heating.

Okay so here is the States when not running:

image

Here are the states when running:

How do I monitor the state changes to use in my automation? I am having trouble with my googlefu with the right terms I think.

Thanks. And sorry I missed you had said ecobee and mentioned the hvac_action attribute in your OP. :sweat_smile: But it’s good to know the fan attribute also seems to be useful here, and probably better than hvac_action given how you said you’d want it to work.

I think something like this should do what you want:

- trigger:
  - platform: state
    entity_id: climate.home
  condition:
  - condition: template
    value_template: >
      {{ trigger.from_state is not none and
         trigger.to_state is not none and
         trigger.to_state.attributes.fan != trigger.from_state.attributes.fan }}
  action:
  - service_template: "homeassistant.turn_{{ trigger.to_state.attributes.fan }}"
    entity_id: switch.FAN_BOOSTER

This assumes the fan attribute always has the values of on or off.

The idea is, the automation is triggered whenever the state of climate.home changes, including when only an attribute changes.

Then the condition checks to see if the fan attribute has changed. If so, then the action will run.

The action uses a service_template to determine whether the switch should be turned on or off, based on the new value of the fan attribute. Of course replace switch.FAN_BOOSTER with the actual entity ID of the smart plug that controls the booster fan.

1 Like

All good!

So I tried to put that into the configuration.yaml (possibly incorrectly) and it didn’t work:

I also tried to put it in a GUI automation and it said unsupported action:

Thanks!

An automation must be listed under the key “automation:”. There are many ways to organize YAML files, but I’m guessing what you have is pretty basic/default. E.g., you probably see this in configuration.yaml:

automation: !include automations.yaml

If so, then you should probably put it in automations.yaml. Note that that file, if you haven’t done anything with it directly or indirectly, probably contains one line that looks like this:

[]

Just remove that line and then enter the automation I suggested. You’ll need to then reload automations, or restart HA.

That worked, thank you so much!

1 Like

This is almost identically what I’m try to do.

Though I’m using a generic thermostat with a portable air conditioner. So I need to use hvac_action

Using the condition

{{ is_state_attr('climate.bedroom_portable_a_c', 'hvac_action', 'cooling')}}`

Is looping sadly. I can’t figure this out.

For whatever reason the IR sometimes don’t go on first try so I simply want to turn off/on a few times given if hvac_action is cooling/idle

Are you using the ecobee integration or integrating the ecobee through HomeKit?

I don’t have all the same attributes in mine and I’m using HomeKit for local control.

I actually started with the cloud integration and then started using the HomeKit integration I believe.

I am kind of looking to do the same thing as the above, and I think this is as close to what I am wanting to do as possible.
Basically, I am looking for Home Assistant to send me a Slack message when the fan on the furnace has been active for over 10 minutes.

alias: Slack Notify
description: “”
trigger:

  • platform: state
    entity_id: climate.home
    condition:
  • condition: template
    value_template: >
    {{ trigger.from_state is not none and trigger.to_state is not none and
    trigger.to_state.attributes.fan != trigger.from_state.attributes.fan }}
    action:
  • service: notify.SlackChannel
    data:
    message: the heat is on
    title: Furnace
    target: home-automation
    mode: single

However, it doesn’t seem to work. I have my ecobee connected via homekit, and I can see in the devoloper tools above when the state changes.