Ability to duplicate scenes with a service

Hi there, I’d love to be able to create (termporary) scene copies with a service, eg “scene.duplicate”. We already have the option to do this through UI, but I’d like to do that from a service so I can do these things from scripts etc. Alternatively, this could possibly be done from “scene.create” if it accepted scenes as an input (and then were to “unpack” all states from that scene).

Why, you may ask? My usecase is this: I want to create local modes for each room. These are a conglomerate of different scenes that are swapped according to area occupancy within the room. However, let’s say I’m sitting on the couch and want to change the brightness of a light. And I want that light setting to come back when I get up from the couch for a while (different scene triggers) and then sit back down. Now what I’d like to, is to have my permanent template scenes. Whenever I change the room mode, I’ll load the corresponding scenes (create copies of the scenes) and then write all changes in light setting to these copies. I can then swap around scenes as much as I want and it’ll keep my new settings - Until I change the overall mode again and it loads my basic settings from the permanent template scenes. I do believe people will think of simpler usecases too, but this is mine :slight_smile:

This is exactly why Scene.create and scene.apply exist.

Scene create snapshots a scene base on the states in the entities selected.

Scene apply can apply a scene that’s not already defined based on yaml config. Between the two you can so basically what you want. Most common use is snap a scene before something changes states so you can return after your done. (scene.create, do the thing, scene.turn_on -name of created scene…)

Goodness gracious I completely missed that there’s a difference between scene.apply and scene.turn_on, slightly ashamed over here, thanks! While it’s still not exactly what I originally wanted, I believe I can work with this for now! Although being able to do something like that in the background (without the secnes being actually activated) would still make things easier as all the prep can be done at once. Now I’ll have to create some mechanic that remembers which scenes have already been activated once and which haven’t - well, I’ll find a way!