Simple AC Off timer

I want to be able to have a field on a dashboard, where i can select how many hours my AC will run, then click a button and the AC will turn on, then off after the selected amount of hours.
I have fiddled a bit, but i havent found a simple yet robust way to achieve this, while providing simplicity for my partner to use.
What are your go to’s for achieving this?

Input number helper and Toggle helper (input boolean) on the dashboard. Then two automations:

  • Entity state trigger off the input boolean going to on; action is a service call to turn on the AC.
  • Entity state trigger off the input boolean being on for the number of hours in the input number; action is a service call to turn the AC off and another to turn the input boolean off.

Since the delay is multiple hours, wouldn’t it be better to use a timer so it survives a restart? Or is it already your assumption ?

To give you an idea of a simple, but not really robust way to switch off the air conditioning, you will find an example below.
In the example, HA turns off the air conditioning after an hour, but you have to turn on the air conditioning with the remote control.
The automation only works if the air conditioning is set to heating.

alias: Airco off
description: ""
trigger:
  - platform: state
    entity_id: climate.airco
    from: "off"
    not_to:
      - unknown
      - unavailable
    for:
      hours: 1
      minutes: 0
      seconds: 0
condition:
  - condition: state
    entity_id: climate.airco
    state: heat
action:
  - service: climate.turn_off
    data: {}
    target:
      entity_id: climate.airco
mode: single

Timer is definitely better way than 1 hour delay in automation. Been there, done that… exactly because timer survives restart, while delay in automation doesn’t.

Create a timer and two automations: first one will trigger when timer will start (thus starting climate) and second one will trigger at timer end and shut down climate.
For starting / changing timer you can use “flipdown timer card” from hacs, or if you want to automate climate (starting based on temperature) you can also use scheduler card.

1 Like