Ecobee and Sonoff Switch Humidity control

Hello everyone. I have a Ecobee 3 t stat and want to use " hvac_action:heating" and humidity level(like humidity <=40 %) to turn my sonoff switch( whole house humidifier) On and Off. My Ecobee entitie is climate_upstairs
Basically I want my humidifier start working only when my heater is Running and Humidity less or equal 40%
Thank you

Try the following automation. You will need to change the following entity names to match whatever you are using:

  1. climate.upstairs
  2. sensor.humidity
  3. switch.humidifier
- alias: Humidifier Controller
  trigger:
  - platform: template
    value_template: >
      {{ is_state_attr('climate.upstairs', 'hvac_action', 'heating') and 
         states('sensor.humidity')|float <= 40 }}
  - platform: template
    value_template: "{{ not is_state_attr('climate.upstairs', 'hvac_action', 'heating') }}"
  action:
  - service: "switch.turn_{{'on' if trigger.to_state.attributes.hvac_action == 'heating' else 'off' }}"
    entity_id: switch.humidifier

Thank you,Taras
I will try tonight

Tried and for some reason have a error message

The example I posted was designed to be copied and pasted into your automations.yaml file.

You are trying to paste it into the Automation Editor but it’s not in the correct format for that. Change it to this:

alias: Humidifier Controller
trigger:
- platform: template
  value_template: >
    {{ is_state_attr('climate.upstairs', 'hvac_action', 'heating') and 
       states('sensor.humidity')|float <= 40 }}
- platform: template
  value_template: "{{ not is_state_attr('climate.upstairs', 'hvac_action', 'heating') }}"
action:
- service: "switch.turn_{{'on' if trigger.to_state.attributes.hvac_action == 'heating' else 'off' }}"
  entity_id: switch.humidifier

Good morning
I thought if I switch to Yaml in Automation it’s the same like a automation .yaml
I am not really good in stuff like that , will try
Thank you

Fix my mistakes in automation .Yaml and looks like it’s working fine
Will test again tonight when come home, don’t want to scare my wife turning Heater on and Off remotely
Thanks again

1 Like

It’s not exactly the same. The Automation Editor displays one automation’s YAML code in isolation from all other automations. Multiple automations, like when you look in automations.yaml, have a slightly different appearance.

The following example is fine for a single automation (like when Automation Editor shows you the code for a single automation):

alias: example 1
trigger:
- platform: state
  entity_id: light.something1
action:
- service: notify.notify
  data:
    message: Hello from example 1.

However, when there are multiple automations, they are formatted like this (and you can confirm that by examining automations.yaml

- alias: example 1
  trigger:
  - platform: state
    entity_id: light.something1
  action:
  - service: notify.notify
    data:
      message: Hello from example 1.
- alias: example 2
  trigger:
  - platform: state
    entity_id: light.something2
  action:
  - service: notify.notify
    data:
      message: Hello from example 2.

Let me know the results of your tests this evening.

1 Like

Definitely will.
But so fur it’s seems to work fine
Heater is running, humidity is 38% and Humidifier switch kicked in

1 Like

Glad to hear it works.

Please consider marking my first post (or second post) with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has an accepted solution. It also places a link beneath your first post that leads to the post containing the solution. All of this helps users find answers to similar questions.

1 Like

I did it
Do you want to join us at MEWE for Home assistant group?

I appreciate the invitation but this forum already keeps me busy. :slight_smile:

:+1: :grinning:

Good afternoon Taras
Everything is working like a charm
Thank you again

1 Like