Question about groups and a goodnight trigger

Hi
I would like to make a simple button in the fronted to manual perform a goodnight automation but I need some help to implement

  1. What trigger I could declare since I want to just manual trigger it?
  2. I have various entities I would like to turn off (light, switches,covers). Can I group all of them, or I should group them by the type of entity?
    3.If I can group all of them, what service I will call in order to turn them off?

Just create a script with all the entities and the states you want and then call it from the UI

Heres what I use, I actually call it from Alexa:

go_to_bed:
  alias: Go to Bed
  icon: mdi:bed-empty
  sequence:

    - service: light.turn_on
      data:
        entity_id: light.living_room_ceiling_light
        brightness_pct: 50
    - service: light.turn_on
      data:
        entity_id: light.landing_light
        brightness_pct: 25
    - service: light.turn_on
      data:
        entity_id:
        - light.ensuite_light
    - service: homeassistant.turn_off
      data:
        entity_id:
          - switch.doorbell_chime_active
          - switch.tv
          - light.living_room_floor_lamp
          - light.living_room_table_lamp
          - light.tv_units_white
          - light.tv_units_colour
          - light.office_lamp
          - light.office_ceiling_light
          - light.wled
          - light.garage_lights
          - light.dressing_table_light
          - light.bedroom_light
          - light.kitchen_units_all
          - light.back_garden
          - fan.ensuite_fan
          - fan.bathroom_fan
          - fan.utility_fan
          - fan.office_fan
          - media_player.monitor

1 Like

Thanks, I like it.
Since I haven’t used for the time being a script, I have to place it in scripts.yaml I think, right?
And I can call it from the button card?

Yes that’s it

I have added a button card, but I don’t know how to call the script. Can you help?

ok now. I was missing the script: !include scripts.yaml in my configuration.
thanks