How to wait until a state reaches a defined threshold and then perform an action?

Hi, I’m trying to create an automation that allows me to set the thermostat to 70 degrees, wait until it reaches that temperature and then set the temperature to 65.

Here’s as far as I’ve gotten after several attempts and reading a few posts:

alias: Thermostat - to 70 then off
description: ""
trigger:
  - platform: event
    event_type: ""
condition: []
action:
  - service: climate.set_temperature
    data:
      temperature: 70
    target:
      entity_id: climate.hallway
  - wait_for_trigger:
      - platform: state
        entity_id:
          - climate.hallway
        attribute: current_temperature
        to: "70"
        for:
          hours: 0
          minutes: 3
          seconds: 0
    continue_on_timeout: false
  - service: climate.set_temperature
    data:
      temperature: 65
    target:
      entity_id: climate.hallway
mode: single

I imagine I need to add an action after the wait for trigger state is met but no sure how to do that in the UI?

Just a comment: I would change the wait for trigger “to: 70” → “above: 70” to avoid a situation where the temperature rises beyond 70 without triggering. That or add some other failsafe.

Not an expert in automation, but what is it that makes you think you need something else in there? If it triggers it looks quite similar to one I created in the GUI now as a test.

My attempt at code below via GUI (untested, probably contain errors)

description: BasementTempTo70
mode: single
trigger:
  - platform: state
    entity_id:
      - climate.basement
    attribute: temperature
    to: "70"
condition: []
action:
  - wait_for_trigger:
      - platform: numeric_state
        entity_id: climate.basement
        for:
          hours: 0
          minutes: 3
          seconds: 0
        attribute: current_temperature
        above: 69
  - service: climate.set_temperature
    data:
      temperature: 65
    target:
      entity_id: climate.basement

Thanks for your help @hutre!

I’m a little confused on what sets the temperature to 70 - does your trigger change the temperature?

I’m trying to use a button on my dashboard to call this automation which is why in my automation I had tried using an action to first set the climate and then wait. Perhaps the part that I have wrong is the triggering of this automation?

Here’s the code from mushroom card I’m using in a grid:

square: false
columns: 2
type: grid
cards:
  - type: custom:mushroom-template-card
    entity: climate.hallway
    icon: mdi:thermometer
    tap_action:
      action: call-service
      service: automation.trigger
      target:
        entity_id: automation.temp_to_70
      data:
        skip_condition: false
    secondary: Turn heat to 70°
    primary: '{{ state_attr(''climate.hallway'',''current_temperature'') }}°'
    fill_container: true