How to run a scene for specific duration (or how to set a value for specific time and go back to previous value?)

Hi, I need some help please.

I have connected a HmIP-WUA 0-10V actuator to my Central House Ventilation System (something like an AC). With it i can now control the fanspeed by entering values between 0-100.

I would like to realize the following function:
Press a button =

  1. Remember current value,
  2. set fanspeed to 90 for 15 minutes,
  3. set the original value again.

I thougt about using a scene, so that 1) and 3) are checked. But how do i run a scene for a specific duration? Or are there other ways to achieve my goal?

Use the Scene: Create to save current settings
Load desired scene
Start timer for desired duration
At timer.finished, load the saved scene from step 1.

Tanks a lot!

alias: Stoßlüften
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.stossluften
    from: "off"
    to: "on"
condition: []
action:
  - service: scene.create
    data:
      scene_id: snapshotfanspeed
      snapshot_entities:
        - number.hmip_wua_002edf29ad209d_level_ch3
  - service: scene.turn_on
    target:
      entity_id: scene.test
    metadata: {}
  - service: timer.start
    target:
      entity_id: timer.stossluften
    data: {}
  - delay:
      hours: 0
      minutes: 15
      seconds: 0
      milliseconds: 0
  - service: scene.turn_on
    target:
      entity_id: scene.snapshotfanspeed
    metadata: {}
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.stossluften
    data: {}
mode: single

Dont use delays. They will stop working if HA reboots. Timers will restart when HA reboots.
Use trigger IDs. See below. I threw together something I believe is similar to what you want. You need to create a timer in the helper section for this.

mode: single
trigger:
  - platform: state
    entity_id:
      - input_boolean.mini_split
    to: "on"
    id: Switch on
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.mini_split_timer
    id: Timer finished
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Switch on
        sequence:
          - service: scene.create
            data:
              scene_id: mini_split_current_state
              snapshot_entities:
                - climate.midea_climate
          - service: scene.turn_on
            metadata: {}
            target:
              entity_id: scene.activate_summer_climate_control
          - service: timer.start
            target:
              entity_id: timer.mini_split_timer
            data:
              duration: "900"
      - conditions:
          - condition: trigger
            id:
              - Timer finished
        sequence:
          - service: scene.turn_on
            data: {}
            target:
              entity_id: mini_split_current_state
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.mini_split
            data: {}

Thanks! Works like a charm :slight_smile: