Easiest way set up an "do x in y minutes"

Hi all,

What’s the easiest way to say, run operation X in Y minutes/hours?

There is automation/scripting, but those aren’t readily usable for changing states of various items.

What I’m trying to achieve is functions like this:

  • turn off the air conditioner (already integrated into HASS via a plug-in) in N minutes
  • turn off the immersion heater in N minutes
  • stop charging the car in N minutes

Where “N” minutes is an input value I can set depending on what I want at the time.

What’s the best way to achieve this?

I was hoping Assist/Intents/Conversations would facilitate that going forward, but for now, it doesn’t.

Set a timer for N minutes.

Trigger an automation when that timer finishes.

  trigger:
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.run_operation_x_delay
  action:
  - service: run operation X here. 

Use a delay action or a timer helper.

You can set up a for:

  - platform: state
    entity_id:
      - switch.car
    to: "on"
    for: "{{ states('input_number.car_charging_in_seconds') | int }}"

That’s great for something put on a timer regularly, but I was thinking more of the ability to quickly request a 1-off from the system, kind of like how a google home can be asked to set a timer when cooking, for example.

For this I use a datetime input that triggers an automation when tap-held. The automation starts a timer based on the value of the input.

      - entity: input_datetime.thermo_timeout
        name: Turn off for (HH:MM)
        hold_action:
          action: call-service
          service: automation.trigger
          service_data:
            skip_condition: false
            entity_id: automation.thermo_lower_floor_pause_timer_start
1 Like

There’s no such thing in Home Assistant. You’ll need to create something in advance (like a Blueprint).

Yeah, and it isn’t awesome that there’s no such thing.
Creating an automation or setting up a blueprint is really heavyweight for a one-off, off the cuff need.
I’ve got automations set up for the things I use regularly, but sometimes there’s something you need to have done just once, but ‘not right now’, and it’s not very friendly for users who aren’t inclined (or skilled enough) to set anything up, but could happily use the conversations feature.

Open a feature request.

Bemoaning the feature’s absence doesn’t inspire anyone to implement it.

  • If you have the required python development skills, you can submit a PR in Home Assistant’s GitHub Core repository. It will be vetted by a member of the core development team and, if accepted, merged into the codebase.

  • If you don’t have the necessary programming skills (like many users), you can write a detailed and well-reasoned Feature Request or, if one already exists for the feature you want, vote for it. There’s no guarantee it will ever be implemented; Feature Requests amount to a wish list. Volunteer developers may peruse the FRs and implement whatever interests them; only a small fraction of FRs are fulfilled.

While waiting for an FR to be implemented (again, it may be never), you may wish to explore one of the suggestions that have been offered.