How to make a basic "Something Mode" (e.g. "Movie Mode", "Party Mode)!

There are probably ways to improve this, so please help! And I searched, but didn’t see any similar posts.

This is just a simple how-to, with best practices for creating a simple “Something Mode”, with automations and various triggers and a timeout to end the mode. This will help you eliminate unnecessary redundancies and complexities and edge cases that might occur with other approaches to this problem.

A couple of use cases: changing lights and air purifier when you put on a movie, bumping some tunes and disabling automatic lights for a party, etc etc.

First, create a toggle helper: Settings → Devices & Services → Helpers → Create Helper → Toggle. I name toggles so it’s clear that they’re true or false (boolean) variables, like “Movie Mode” or “Roommate is on a Call”.

Next, create two scripts: Settings → Automations & Scenes → Scripts → Add Script. I use a name that has a prefix of the mode, e.g. “Movie Mode: Activate” and “Movie Mode: Deactivate”. In these scripts, add the necessary actions for starting or stopping things. For example, in my “Movie Mode: Activate” script, I have actions to turn our air purifier to silent mode, turn off the living room lights and their motion sensor activation, and turn the kitchen lights to sleep mode in case someone walks in there (they shine into the living room). (Oh, it also plays this clip on a speaker for fun :stuck_out_tongue:) ✂️ Baby lock the doors and turn the lights down low - YouTube

Finally, create at least two automations: Settings → Automations & Scenes (should already be selected) → Create Automation.

The first two should have, for triggers, state triggers for the toggle helper (“Movie Mode”), one automation for transitioning to “On” and another for transitioning to “Off”. The actions for these automations should be the respective scripts from above. I call them “Movie Mode: Activate on Toggle Turn On” and “Movie Mode: De-Activate on Toggle Turn Off”.

The next automations should be the methods you want to use to toggle/turn on/turn off the mode. For example, you might want a script where the trigger is double-clicking a physical smart button and the action is to toggle the “Movie Mode” helper. You can include all the toggle triggers you want in this one place. Similarly, you can (optionally) create one to just turn on the mode (I haven’t had a use case for this yet). Finally, optionally create one to turn off the mode: I have this happen automatically at 05:00 AM for most modes in case people forget to turn it off manually. I use names like “Movie Mode: Turn Off Toggle Automatically” or “Movie Mode: Toggle”.

Now, you can add a button entity to dashboards of your toggle helper, and it will accurately represent whether the mode is on or off, and toggling it will allow you to toggle the mode!

This is pretty simple, but there are other ways to do it that don’t result in as clean/clear of a set of entities.

I hope this helps some of you!

2 Likes

That’s helpful but I’m curious why create a script and then an automation that uses a script?
Why not just define all the actions in the automation itself.

Also, why two automations ? I have an automation that triggers when the motion sensor turns on, and if sleep mode toggle is not activated. It turns the lights on in the room, then waits until the motion sensor turns off and it turns the lights off. I’m not using a script and turning on and off within the same automation.

Not saying your method is wrong, just wondering what the advantage is

Ha great point re: multiple automations and I’ve since switched to consolidating the activation/deactivation automations into one. Though I still like to have one automation for auto-toggle vs what happens when it’s toggled, this way even if, for some reason, I want to disable the auto toggle (maybe guests are staying and they don’t want it for some reason), triggering things manually still works!

For the script vs in-automation actions, mostly I do that if it’s complex for tidiness (one semi-long yaml for triggers/conditions, one for actions vs one super long for both), but also there could be some scenarios where I want a set of complex actions in multiple automations (e.g. maybe I turn on the party lights to welcome guests as well). The latter is especially true if I break the actions up into multiple scripts for subsets of the actions.