Script to turn off group of switchs fails

Hello!

I’m having trouble with running a script to turn of several groups of shelly switches, ikea zigbee plugs and shelly rgbws. When running the script from a lovelace button card, only the shelly switches turn off, the rest stays on, any idea why? thank you

Here’s my groups:

group:
  sala:
    name: Sala
    entities:
      - switch.shelly_jantar
      - switch.shelly_sala
      - switch.candeeiro_sala
      - media_player.philips_tv
  cozinha:
    name: Cozinha
    entities:
      - light.shelly_leds_cozinha_bancada
  casa_de_banho:
    name: Casa de Banho
    entities:
      - switch.shelly_wc
      - switch.shelly_wc_espelho
  casa_de_banho_laura:
    name: Casa de Banho da Laura
    entities:
      - switch.shelly_wc_laura
      - switch.shelly_wc_espelho_laura
  escritorio:
    name: Escritório
    entities:
      - switch.shelly_escritorio
      - switch.impressora_3d
      - switch.camera
  entrada:
    name: Entrada
    entities:
      - switch.shelly_entrada
      - switch.shelly_porta_rua
      - light.shelly_leds_entrada_amarelo
  corredor:
    name: Corredor
    entities:
      - switch.led_corredor
      - switch.cabeceira
      - light.candeeiro_quarto
      - light.shelly_leds_pc
      - switch.colunas_pc
  quarto:
    name: Quarto
    entities:
      - switch.shelly_quarto

and script:

script:
  modo_comer:
    sequence:
      - service: homeassistant.turn_off
        data:
          entity_id: group.casa_de_banho
      - service: homeassistant.turn_off
        data:
          entity_id: group.casa_de_banho_laura
      - service: homeassistant.turn_off
        data:
          entity_id: group.cozinha
      - service: homeassistant.turn_off
        data:
          entity_id: group.entrada
      - service: homeassistant.turn_off
        data:
          entity_id: group.escritorio
      - service: homeassistant.turn_off
        data:
          entity_id: group.corredor
      - service: homeassistant.turn_off
        data:
          entity_id: group.quarto

That isn’t the correct format

The basic format is:

script:
  modo_comer:
    sequence:
      - service: homeassistant.turn_off
        target:
          entity_id: group.quarto

And you can combine them all into one service call by listing the entity_ids:

script:
  modo_comer:
    sequence:
      - service: homeassistant.turn_off
        target:
          entity_id: 
          - group.casa_de_banho
          - group.casa_de_banho_laura
          - group.cozinha
          - group.entrada
          - group.escritorio
          - group.corredor
          - group.quarto
1 Like

It worked flawlessly and looks clean, will definitely try rewrite all code to look like this. Thanks for the quick response and for helping out a noob =)

cheers!