How to address ALL lights in scene automation

I wish to create (and later call on) a snapshot scene of all my lights as part of an automation (to turn on movie light scene at start of movie and return all lights to their previous state when playback stops).

I know that I can manually create a group, including all lights individually one-by-one, but I imagine that there is a more user-friendly way to do this. As I have about 40 lights, I rather not add them one by one.

The idea (that does not work) is:

service: scene.create
data:
  scene_id: lights_before
  snapshot_entities: all

If there’s no solution from within the automation, is their an easy script to make a group containing all lights?

Put all your lights in a group and then save that? At least that’s doable quickly via the GUI.

service: scene.create
data:
  scene_id: lights_before
  snapshot_entities: "{{ states.light | map(attribute='entity_id') | list }}"
1 Like

That’s neat but it’s every light in the house. If, for example, a bathroom light is off when you create the scene and someone is in the bathroom when the scene is recalled - they are plunged into darkness :rofl:

That’s exactly what jvdburgt requested.

If you or jvdburgt have other requirements, describe them and I can help devise an appropriate template.

Well, if he wants to set all lights like that he will encounter the above issue. Anyway … I’d be interested if you could limit it to an area - is that possible?

{{ area_entities('kitchen') 
  | select('match', 'light')
  | list }}

Reference:
Templating - Areas

1 Like

Thanks - I will file that away for future use :slight_smile:

Very much appreciated.

Hi,

The request was as intended. Living in a two person household, when we watch a movie, it’s always the two of us. So when movie starts I want the living room set to movie scene, and all other lights in the house off. When movie pauses or is finished, all lights should return to previous state :slight_smile:

If reality turns out to be harsher then I now imagine, I will use the proposed area approach. Many thanks!

1 Like

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

1 Like