Lights off script not working

I want to create a script that turns off all of my lights and turns off some motion sensor automations. The automations turn off after executing the script but the lights stay on. Can anyone help me with this issue?
Thanks!

This is my cofig in scripts.YAML:

'1566292949598':
  alias: Morning
  sequence:
    service: automation.turn_on
    data:
      entity_id: 
       - group.all_automations
'1566293130015':
  alias: Night
  sequence:
    - service: automation.turn_off
      entity_id: group.all_automations
    - service: light.turn_off
      entity_id: group.all_lights

Maybe try:

    - service: light.turn_off
      entity_id: all

Nope! still doesn’t work :thinking:

There’s no reason I can see that it shouldn’t work. Have you checked the log for errors? Have you tried executing the service from the Services page?

I just fixed it! It was just a dumb mistake. I forgot that my sonoffs obviously count as switches so I just added a turn off switch service and now it works a treat.