Automation Conundrum

Hi Folks,
Have been trying for almost a week to make this automation work, but I just cannot get it to work.

alias: Start Fan
description: Start fan based on damper status and temperature
trigger:
  - platform: numeric_state
    entity_id: sensor.inside_temp_temperature
    below: '25'
    above: '20'
condition:
  - condition: state
    entity_id: switch.damperrelay
    state: 'On'
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.fanrelay
mode: single

There has to be something I am missing? No matter how many setting I change, or other automations I modify this will just not trigger?

What am I missing?

try low cap on.

state: 'on'

remove the quotes for the temp.

below: 25
above: 20
2 Likes

You know this automation will only trigger when a threshold is crossed, so when

  • The temperature was e.g. 26 and drops below 25
  • The temperature was e.g. 19 and goes above 20

That is how the numeric trigger works.

And states are always lowercase, so indeed ‘on’

Thanks for the feedback… I want the ‘fan’ to turn on if the temperature in the room is between 20 and 25 degrees celsius. So are you saying this script will not trigger based on the automation I shared?

It will trigger when it changes from outside the threshold to inside the threshold as explained by Francis.

Temp was 26 goes to 24 -> trigger
Temp was 18 goes to 22 -> trigger
Temp was 21 goes to 22 -> no trigger
Temp was 24 goes to 22 -> no trigger

Thank you for the feedback, it is a big help. I have changed the automation to have a Start Fan and Stop Fan.

Here’s the Start Fan

alias: Start Fan
description: Star Fan Based on Temperature and Damper Status
trigger:
  - platform: numeric_state
    entity_id: sensor.inside_temp_temperature
    above: '25'
condition:
  - condition: state
    entity_id: switch.damperrelay
    state: 'on'
action:
  - service: switch.turn_on
    target:
      entity_id: switch.fanrelay
mode: single

My thinking is that when the temperature exceeds 25 then the fan should turn on?

And the Stop Fan is…

alias: Stop Fan
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.inside_temp_temperature
    below: '22'
condition: []
action:
  - service: switch.turn_on
    target:
      entity_id: switch.fanrelay
mode: single

The Stop Fan should turn off the fan when the temperature goes below 22 degrees?

Once I get these working I will add some more conditions/triggers… but I’d like to get this simple setup working first.

The first one triggers when the temp goes from below 25 to above 25 and then only trigger again when it goes below 25 and then above 25.

The second one triggers when the temp goes from above 22 to below 22 and then only trigger again when it goes above 22 and then below 22 again.

Based upon the feedback here I think I have solved the automation, so another small success as I move forward. Thanks everyone :slight_smile: