Home » Blog » Scenes on Steroids in Home Assistant – How To – Tutorial

Scenes on Steroids in Home Assistant – How To – Tutorial

Watch video

With scenes, you can take snapshots of a certain status of your devices in Home Assistant. This allows you to quickly transform your house into a certain status. This is not only possible for your lighting, but for every device in your home. You can even quickly take a snapshot on the fly to jump back to the last state before your devices’ settings changed. In this Home Assistant Tutorial, I show you how scenes in Home Assistant work and how you can use them to the max! Let’s dive right in.


โญโญโญ NOTE: โญโญโญ

This article accompanies a YouTube video. I wrote it for people who would rather read than watch a video. To keep doing this, I want to ask you to check out the video, leave a comment under the video, give the video a thumbs up, and subscribe to my YouTube channel. This means that the video is offered more often to new visitors so that they also stay informed of the latest Home Assistant tutorials.

Thank you for your support!

Ed

Watch the video here


You can download the code used in this video here so that you can just copy and paste it to get it to work.

Scenes are perhaps the most underrated feature in Home Assistant, while they can greatly help you put your home in a certain state and quickly switch between them. There are several ways to deal with scenes.

In this Home Assistant tutorial I will cover the following topics:

  1. How do I set up a simple scene?
  2. How can edit a scenes in Home Assistant?
  3. How can I use scenes in automations?
  4. Scenes on steroids: How can I quickly create a temporary scene “on the fly” and jump back to this scene after adjusting the statuses of some devices?

How do I set up a simple scene?

You can set up scenes in a few different ways. The easiest way is to create a scene of the current status of your devices. Suppose you have set your room to a color and a certain temperature. When you are very satisfied with that setting and want to save that setting so that you can quickly recall it later.

You do that as follows:

  1. Go to “Settings”
  2. Go to “Automations & Scenes”
  3. Click on “Scenes”
  4. Click on “Add Scene”
  5. Name your scene
  6. Choose an icon
  7. Choose an Area
  8. Now add all devices that you want to save in this scene by clicking on Add a device.
  9. You see that I can add different types of devices. What I can’t add here are my climate entities. You can do that under “Add an entity”.
  10. Add your climate entity by clicking on “Add an entity”.

You can of course add many more devices and entities, depending on which devices you have in your house.

  1. Now click on Save
  2. Click on the back arrow

Adding the Scene to our dashboard in Home Assistant

Now we’re going to add the scene to our dashboard.

First I’m going to add the scene to my dashboard so I can use it quickly.
To do this, go to your dashboard where you want to place your scene.

  1. Click on the three dots at the top right
  2. Click “Edit dashboard”
  3. Click on “Add card”
  4. Locate the grid card
  5. Leave the columns at 3
  6. Put Render cards as squares if you like
  7. Now search for the button card or mushroom entity card

I use Mushroom cards for my dashboard. If you want to use those too, you can install them via HACS, but you can also use the standard cards.

  1. At entity, select the scene you just created.
  2. If necessary, set the layout to Vertical layout
  3. Click on “Tap Action”
  4. Select “Toggle”
  5. Click on “Save”
  6. Place your grid card in a location you like
  7. Now click on “Done”

Let’s test it!

We will now first give some lamps a different color in our room and we will also switch off some lamps.
We also give the heating a different temperature.

Here we go! Now click on your scene and BAM, everything is back to the way you set it up!

Changing a scene

We just saw how to create a scene based on the current status of devices.

To edit a scene, go back to the scene you created. By clicking on the icon of the device or entity, you can adjust the properties of the device or entity. Then click on save and your device within the scene is adjusted.

Now your scene has been edited. If I adjust the settings of the devices and then press the scene button again, you will see that all devices get the new settings.

Alright, let’s quickly move on to Automations!

Activating scenes in Home Assistant through automations

Suppose we have two scenes, one that we use when we are working during the day and one that we use when we want to watch a movie at night.
I created two scenes for this.

I have a Work Scene that gives off a bluish light and I have a Movie Scene that creates a cozy environment. We are now going to create an automation that switches these two scenes based on the time.

I need your help!

You will be doing me a huge favor if you subscribe to my channel if you haven’t already. And, you will help me a lot if you also give this video a thumbs up and leave a comment. This way, YouTube will present this video to new people, making the channel grow! In the video description, you will also find information about how you can sponsor me so that I can continue to make these tutorials for you.

Thank you!

Let’s set it up!

  1. Go to Settings
  2. Go to Automations & Scenes
  3. Click on “Create Automation”
  4. Select “Start with an empty automation”
  5. Give your automation a name
  6. Leave mode on “Single”.
  7. Select “Time” at Trigger type
  8. Set At time to 9:00 AM
  9. Give your Trigger the Trigger ID “Work”

If you don’t know how Trigger IDs work, check out my video on Trigger IDs. The link can be found in the description below.

  1. Click on “Add Trigger”
  2. Choose “Time” again at Trigger Type
    12 Set At time to 7:00 PM
  3. This trigger does not require a Trigger ID. You can give it a trigger ID, but we are not going to do anything with that in this automation.

Now go to Actions.

  1. At “Action type” choose “If Then”
  2. At If, choose Condition Type “Triggered By”
  3. Select Trigger “Work”
  4. Now go to “Then”
  5. Select by Action Type “Activate Scene”
  6. Select by Entity “Work Scene”
  7. Now go to “Else”
  8. Click on “Add Action”
  9. Select at Action type “Activate Scene”
  10. and at Entity select “Movie Scene”
  11. Click on “Save”

Wow, you’ve now created your automation that turns on the Work scene at 9am and turns on the Movie scene at 7pm.

You can of course make this much smarter by turning on the Movie Scene when you turn on your TV, but I’ll leave that to you. I just want to show here how to switch a scene. The exact trigger will be different for everyone. Let me know in the comments what your use cases for scenes are and which triggers you use. I am very curious!

And nowโ€ฆ. tatatatata (Drumroll). Scenes on steroids!

Cosy Scene
Cosy Scene

Okay, now you know how to create scenes, edit them and call them from your dashboard and automations, but there’s more! And that’s a really great feature!

We are now going to use scenes on the fly.

Imagine that the devices in your house are set to a certain mode. Some lights are on, some lights are off and the heating is nice and high. Then someone in the house decides to open a window in the evening. At that moment you want the heater to stop heating because the heat then goes outside. You also want the lights to be turned off or dimmed so that you don’t get mosquitoes in the house. When the window is closed again, you want all devices to be set up again as they were before the window was opened. And this is possible! You can take a snapshot of the status of your devices and restore this snapshot later. This is what we are going to do with Scenes on the fly!

Note: such a snapshot does not survive a restart of Home Assistant, so if you restart Home Assistant while the window is open, the devices will not be restored afterward!

Let’s set this up!

  1. To do this, go to Settings
  2. Go to Automations & Scenes
  3. Click Create Automation
  4. Select “Start with an empty Automation”
  5. Give your automation a name
  6. Leave the mode on “Single”
  7. Go to triggers
  8. At Trigger type, select “Device”
  9. At Device, select the door or window sensor you want to use
  10. Select the trigger that indicates the contact is open.
  11. Give this trigger the trigger ID “Window Opened”
  12. Now click on “Add Trigger”
  13. Select the same door or window sensor at Device
  14. Select the trigger that indicates the contact is closed
  15. You don’t need to create a trigger ID here.

Go to Actions now

  1. Select Action type for “If Then”
  2. Select at “If” as Condition type “Triggered by”
  3. Select at “Trigger” for “Window Opened”
  4. Now go to “Then”

We will now first take a snapshot of all devices that we want to restore when the window is closed again.

  1. Select “Call Service” at Action type
  2. At Service, choose “Scene: Create”
  3. Give this “snapshot” scene an id. For example: “before”
  4. Now indicate in a list for which devices the status should be saved in this scene. Make sure you put a dash before each entity. In my case, I enter the heating and a light group here.
  5. Now click on Add Action
  6. We are now going to adjust the temperature of our heating
  7. Choose “Call service” at the Action type
  8. At Service I select “Climate: Set temperature”
  9. Select your heating entity
  10. and I set the target temperature to “10”
  11. Now click on Add Action again
  12. Select “Call service” at the Action type.
  13. Select the service “Light: Turn on”

You can also turn off the light here, of course, but for this tutorial, I change the light to a different color. That looks a bit nicer in the video. ๐Ÿ˜‰

  1. Select the entity. In my case, that’s Office Back.
  2. Choose a color at “Color Name”
  3. now go to “Else”

Restore the status of the devices

Now we are going to set up that all devices are put back to their old position when the window is closed.

  1. Choose “Call service” at the Action type.
  2. Choose “Scene: Activate” at Service
  3. Click on Targets on Choose entity
  4. Now type in the name of the scene that you have temporarily created. In our case, that’s “scene.before”. It won’t be recognized, but you can just press “Enter” afterward.
  5. Now click on “Save”

Let’s test this!

There we go then. Let’s test this! Ooh, how exciting!

I open the dashboard with my devices to see if it works.

Here I have the door/window sensor that I just made the automation for. Here we go. I now open the window and you see the lights change color and the heating is set to a different temperature.

And then I close the window again. 1-2-3โ€ฆ.

And BAMMM, the lights are restored to their old values โ€‹โ€‹and the heating is back on!

Please note, in the case of a heater, it may respond a bit more slowly. I have a Honeywell Evohome and it is slow to respond because it only syncs the heating values โ€‹โ€‹with the cloud every 3 minutes.

You can download the code used in this video here so that you can just copy and paste it to get it to work.

Okay, if you’ve made it this far in the video, you’ve now become an expert on scenes in Home Assistant. Super! Let me know in the comments if you made it this far!

I hope this video helped you and I want to thank everyone who has supported me in making these videos and tutorials so far. I could never have done this without you. Thank you! If you also want to support me, you can see how you can do that in the description below this video. With that, you make it possible that I can continue to make these videos for you.

Oh, don’t forget to give this video a thumbs up, subscribe to my channel, and hit the notification bell.

I will see you soon!

Bye bye!


,

Back to all articles