Disable Automation for X

I understand that I can script this (and I have for more predicable automations), but sometimes I just want to disable an automation, randomly, for a set period of time.

For example, I have an automation that alerts me if someone is in my backyard after hours, or on the weekends (currently have a crew during the weekdays). Today, they decided to work on Saturday. I would love to be able to disable the automation for the next 10 hours. Same is true with my front door. It relocks after 5 minutes. I had a construction crew in and out yesterday. I disabled the automation so they wouldnā€™t get locked out. I would love to be able to have it auto-reenabled after X time.

Thanks!

FWIW, creating an automation for this is so trivial thatā€™s itā€™s unlikely a developer will invest time to create a dedicated feature for it.

alias: Enable automation
trigger:
  - platform: time
    at: '21:00'
condition: []
action:
  - service: automation.turn_on
    target:
      entity_id: automation.your_automation

If you wish, you can have this automation automatically disable itself so that it doesnā€™t trigger every day at the scheduled time (effectively making it a ā€˜one-timeā€™ automation).

Sure, thatā€™s possible and I do that for another set of automations (I made an input boolean to snooze certain ones for 30 minutes). But Iā€™m thinking as an average user, when I go to the Automation listing, it would be helpful to simply say ā€œDisable for Xā€ instead of making another automation turn it back on. This is a usability request more than an ability request.

Weā€™re all free to make suggestions, just be advised that the majority of them are never implemented, especially if they can be achieved with existing means or they are atypical applications.

1 Like

Occasionally I also have the the need to enable or diable an automation for a certain time; Thanks for the sample code Tara.

Setting a smartphone to ā€œmuteā€ for a certain time is nicely implemented e.g. on Samsung Galaxy devices: you mute and have then the option to limit the time.
The same intuitive approach would be nice for Home Assistant; when you use the slider to en-/disable an automation, optionally select a time.
As was said, everyone can make suggestionsā€¦ :slight_smile:

You can make a script that does this and use this through the UI. Just put it on a dashboard, open the entity more info, fill out the page, press run.

turn_off_automation_for_a_time:
  fields:
    automation:
      name: Automation
      selector:
        entity:
          multiple: true
          filter:
            domain: automation
    duration:
      name: Sleep Duration
      selector:
  sequence:
  - service: automation.turn_off
    target:
      entity_id: "{{ automation }}"
  - delay: "{{ duration }}"
  - service: automation.turn_on
    target:
      entity_id: "{{ automation }}"
1 Like