One-time temporary override/swap of automations

Is there a way to temporarily disable a set of automations and/or scenes and enable a different set based on something like an “input_boolean”?

The use case is “party night”. I want to decide in the afternoon that “Tonight is Party Night” and turn on a state variable which would presumably trigger the cancellation of one set of (e.g., the usual lighting automations) and replace it with a different set of automations (the party automations).

In a small way, this is a bit like a typical temporary thermostat override: you change the temperature for now but it will reset to the usual programming for the next cycle. Except this is really for a ton of devices/entities/scenes/automations to act differently on a last minute decision to have a party night.

Other models are welcome answers to solve the use case scenario.

BTW: Lutron Homeworks QS does this reasonably well for lighting automation, if you have access to the programming of it. (Aside: I even have a designated keypad button labelled Party ON to trigger this.) Anyway, that’s obviously limited to the Lutron world. There are other things than lights that come into play, such as volume levels of audio devices.

BTW2: if you’re ever in my neighborhood, let me know and I’ll press the Party ON button - within Home Assistant, I hope - and you’ll know where to crash the party!!!

Create an input select similar to this, with the different modes you want:

Untitled

Use it in state conditions in your automations to determine if they run or not.

Thanks for your quick response, Tom, and I love your example!

Your selection panel looks almost like a subset of my Lutron keypad except that the buttons on mine are not mutually exclusive: Owners In, Guests In, Party On. To which I would want to add “Movie On” and even “Evening Indoor Pickleball”! At first, these all seem like scenes but they all involve different self-contained automations. Adding conditional logic to many relatively simple automations to cover many bases would be rather complex.

Rather than put such relatively complicated logic into every related automation, I was thinking it would be much cleaner to replace a group of many quite simple automations with a group of other quite simple automations. I know I would have a lot of work to do to check some variable for every automation that I envisage beyond a few basics. For example, if/when to turn spa tub heat on/off could depend upon a lot of state-related factors. It seems like many automations would be very complicated having to cover some many state variables.

Also, it would seem that those separate simple automations/scenes could be valuable without the complexity of the variable logic. So the dynamic enable/disable of automations would seem to keep things much simpler. I’m hoping something like may already be possible within the existing framework.

Can you think of any other existing features that might help? I’m doubting blueprints? Still, perhaps?

Specifically to your example, might there be a trigger action associated with the actual changing of such a state variable that could enable/disable an automation?

- id: b45469a5-05f1-40c7-90ad-9bd2b5a0f208
  alias: Automation Mode Select
  trigger:
    platform: state
    entity_id: input_select.automation_mode
  action:
    service: >
      {% if is_state('input_select.automation_mode', 'Away') %} script.away_mode
      {% elif is_state('input_select.automation_mode', 'Guest Away') %} script.guest_away_mode
      {% elif is_state('input_select.automation_mode', 'Guest Home') %} script.guest_home_mode
      {% elif is_state('input_select.automation_mode', 'Off') %} script.off_mode
      {% else %} script.normal_mode
      {% endif %}

I’m starting to suspect that scripts are part of the answer to my question, in addition to your answer. Not exactly as “pure” as I have in my head but quite reasonable if there’s no way to turn on/off automations dynamically.

Ha, ha! Scripts, it is. Thanks Tom.

Example script:

away_mode:
  sequence:
  - service: homeassistant.turn_off
    entity_id: automation.away_alarm_check
  - service: homeassistant.turn_off
    entity_id: automation.7pm_abc_news_on_tv
  - service: homeassistant.turn_off
    entity_id: automation.in_chair_automation
  - service: homeassistant.turn_off
    entity_id: automation.out_of_chair_automation
  - service: homeassistant.turn_off
    entity_id: automation.upstairs_aircon_am_schedule
  - service: homeassistant.turn_off
    entity_id: automation.upstairs_aircon_pm_schedule
  - service: homeassistant.turn_off
    entity_id: automation.downstairs_aircon_am_schedule
  - service: homeassistant.turn_off
    entity_id: automation.downstairs_aircon_pm_schedule
  - service: homeassistant.turn_off
    entity_id: automation.master_bedroom_sunrise_simulation
  - service: homeassistant.turn_off
    entity_id: automation.spare_bedroom_sunrise_simulation

Not this is often touted as a bad way to do this but it works for me. The preferred alternative - all automations remain enabled but are prevented from running by a condition that checks the state of the input_select.

I really appreciate your detailed replies, Tom. Might you refer me to the conversation about that being “a bad way”?

Search the forum for “automation mode”. Here’s one I tuned up in a long discussion about initial_state (you can ignore that, it has been fixed, and automation restore works now).

https://community.home-assistant.io/t/automations-not-working-1-month-now/120000/24?u=tom_l

Interesting read and thanks for linking. I spent ages trying to find anything related to my question and that discussion might have helped but your succinct answers here have helped me tremendously and hopefully will for others going forward.

1 Like