Triggers + conditions not working?

Hi,

i tried several automations, whenever i use conditions its never starting?

alias: Keller Lüfter an
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.h_t_keller_temperature
    above: input_number.temp_target_keller
condition:
  - condition: time
    after: input_datetime.lufter_keller_zeit_an
    before: input_datetime.lufter_keller_zeit_aus
action:
  - type: turn_on
    device_id: 4fdaae088d55c3016498072f793df76f
    entity_id: switch.keller_luefter
    domain: switch
mode: single

What am i doing wrong? Need to figure this out to make any good use of automations

Thanks!

This automation will only trigger if the temperature is going above the target between the two hours you have defined… If the temperature is already above the target before the timeframe, this automation will not trigger when you are in the timeframe, it has to go below and than above the target again to trigger…
In fact the automation triggers and conditions are evaluated only when the trigger is becoming true and not when the trigger is true…
To be noticed, the switch will stay on (if turned on) even when you reach the “aus” time… So you have to write another automation or modify this one if you would like to switch it off at the “aus” time…

So what you have to do, in the trigger, is to add one to check that you have reached the “an” time like:

  - platform: time
    at: input_datetime.lufter_keller_zeit_an

and add a condition that the temperature should be above the target:

  condition: numeric_state
  entity_id: sensor.h_t_keller_temperature
  above: input_number.temp_target_keller

so that your automation is becoming:

alias: Keller Lüfter an
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.h_t_keller_temperature
    above: input_number.temp_target_keller
  - platform: time
    at: input_datetime.lufter_keller_zeit_an
condition:
  - condition: time
    after: input_datetime.lufter_keller_zeit_an
    before: input_datetime.lufter_keller_zeit_aus
  - condition: numeric_state
    entity_id: sensor.h_t_keller_temperature
    above: input_number.temp_target_keller 
action:
  - type: turn_on
    device_id: 4fdaae088d55c3016498072f793df76f
    entity_id: switch.keller_luefter
    domain: switch
mode: single

So if the temperature is going above the target or you reach the timeframe, conditions of time and temperature will be evaluated, if both are true, the switch will be turned on… but again will not be turned off at the end of the timeframe (you need a specific action/automation to do that)… Same behaviour for the switch in case of temperature going below target, it will stay on…

1 Like

Fantastic explanation :smiley: :raised_hands:
will try it out tonight :slightly_smiling_face:

1 Like