Help with heating automation wait for trigger

Hi I’m trying to have my heating turn on in the morning then go off when it meets a certain temp. I’ve done it in the UI here’s my automation in .yaml

alias: he morning bedroom heat
description: ''
trigger:
  - platform: time
    at: '09:45:00'
condition: []
action:
  - service: climate.set_temperature
    data:
      temperature: 22
    target:
      entity_id: climate.bedroom
  - wait_for_trigger:
      - platform: numeric_state
        attribute: current_temperature
        above: '20'
        entity_id: climate.bedroom
  - service: climate.set_temperature
    data:
      temperature: 15
    target:
      entity_id: climate.bedroom
mode: restart

It runs as far as the wait for trigger then stops there. Can anyone please advise where I’m going wrong.

What does a trace show?

This sort of thing is much easier to implement & debug in NodeRed IMHO. I have mine linked into presence so it only heats if the house is occupied otherwise it goes into a standby that stops the house from freezing.

It looks like you are setting the thermostat to 22 and then as soon as it reaches 20 you are asking it to set to 15, it will never reach the target?

Not sure the best way to show trace to you but this is where it gets stuck

Yes that’s what I want it to do and the target temp is met but the automation doesn’t advance

A Numeric State Trigger is triggered when the value rises above the threshold. In other words, when the value crosses the threshold. If the value is already above the threshold (like 20.3), it won’t trigger.

Replace the wait_for_trigger with a wait_template and the Numeric State Trigger with a Numeric State Condition. EDIT No. It must be a template. See follow-up post below.

Example (contains an error)
  - wait_template:
      # This is invalid ...
      - condition: numeric_state
        attribute: current_temperature
        above: '20'
        entity_id: climate.bedroom

I assume you realize that if the temperature is 20.3 at 09:45:00, the automation will set the bedroom thermostat to 22 and then immediately set it to 15.

How do I enter that in the yaml.


I’m obviously wrong there

That’s due to my mistake. In an attempt to make it an easy change for you, I overlooked the fact it must be a template (after all, it’s a wait_template). :man_facepalming:

Use this:

  - wait_template: "{{ state_attr('climate.bedroom', 'current_temperature') | float(0) > 20 }}"
1 Like

That’s got it. Thank you so much for your time

1 Like