Entity ID for snapshot entities

I have a working automation which turns on 5 light entities when triggered by a motion sensor, and then those entities are turned off after a few minutes. I’m trying to modify the automation so that instead of turning off all the lights, it returns them to their prior states. I’m trying to do that by creating a scene at the beginning of the actions and using the scene as the final action.

Here is the YAML version of the Scene Create service that doesn’t work:

service: scene.create
  scene_id: garage_motion_light_scene
  snapshot_entities: >-
    -light.garage_spotlights -light.overhead_lights -light.game_light
    -light.breakfast_room_lights -light.living_room_2

This follows the pattern I find in the documentation (Creating scenes on the fly) and elsewhere on the web. But I keep getting the following error message: Entity ID (of the five lights) is an invalid entity ID for dictionary value @ data[‘snapshot_entities’]

What is the proper entity ID to use in the Scene.create service? Or is this a wrong approach?

Remove this:

It is used to indicate a multi-line template not a list of items. Also you should put a space after the list dashes:

service: scene.create
  scene_id: garage_motion_light_scene
    - light.garage_spotlights -light.overhead_lights -light.game_light
    - light.breakfast_room_lights -light.living_room_2

Thanks, Tom. I made those changes, but still get the same error message. Interestingly, when I go back to “Edit in visual editor”, the >- is reinserted and the space is removed, so I made sure to stay in “Edit in YAML”.

Tom, FYI it now seems to be working. I put the spaces after the dashes and then added paragraph breaks after each of the first four entities, and that seems to have done the trick. Thanks again for your help.