Turn off some lights with scrpit

What I want to do is to create a button “Scene” and when I press one scene want to turn off some lights.

I tried to create this script:

'1568028538963':
  alias: Movie Scene
  sequence:
  - alias: Movie Scene
    data:
      entitiy_id: switch.slot_one
      to: 'off'
    service: light.turn_off

but when I call the script it says:

Failed to call service script/1568028538963. extra keys not allowed @ data[‘entitiy_id’]

and how should I do if I want to turn off multiple lights?

Three things:

  1. Spelling error. Replace entitiy_id with entity_id
  2. Service error. If you want to turn off a switch, use switch.turn_off
  3. Syntax error. Remove this line: to: 'off'
    data:
      entity_id: switch.slot_one, switch.slot_two, switch.etc

If you want to mix lights, switches, etc like this:

    data:
      entity_id: switch.slot_one, light.something, switch.etc

then you should change the service to homeassistant.turn_off

1 Like

It worked perfectly, to have multiple switch, I added with “,”. Thank you so much

I learnt you can mix entities, thanks for that ; - ))))