Syntax to provide arguments from a button to call a script

I have the following problem:
I want to use one script to be able to reset light entities to 80% brightness, and 2700K. This script shall be triggered by buttons, which shall provide the entity of the light, the script shall reset.

I created that with a script using the “fields” option, to specify the input arguments. The script itself works. When i start it directly in the service area, i can provide entities as arguments - no problem.

However, if i do the same thing as a service call from a button, the system will respond, that it does not get the required arguments.

First i recognized, that the UI automatically removed the quotation marks, and i thought, this might be the problem, but it was not. On a direct call it works with or without quotation marks. I asked the copilot and tried several ways to transform the argument in something better to read, such as using “-> " in front or " {{’ '}}” around, or even to split the entity in domain and id, and to connect them back in the script - nothing worked.

I am fairly sure i am doing a simple mistake somehow, but i just cannot find it.

Would somebody have a fool proof way to use a service call from a button to provide the entity of a light (like light.living_room) to a script like script.reset_light, so that the script will reset the light entity? This should be easy and i cannot believe nothing i tried worked, but i just do not recognize my mistake.

Any suggestion is welcome. Thanks

Please show some real code instead of ‘describing’ it.

It will give the other users a better view of what/how to answer.

Please see here for help:
https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371/3

No problem. Here some code.

I first tried to send the entity directly like this:
UI:

type: custom:button-card
icon: mdi:home
tap_action:
  action: call-service
  service: script:reset_light
  service_data:
    entity_id: light.strahler_dachuberstand_garten_fassung_1

Script:

alias: Licht zurücksetzen
description: Setze eine Lichtentität auf Standardwerte
fields:
  entity_id:
    description: >-
      Die ID der Lichtentität (z.B.
      'light.strahler_dachuberstand_garten_fassung_1')
    example: light.strahler_dachuberstand_garten_fassung_1
sequence:
  - target:
      entity_id: "{{ entity_id }}"
    data:
      brightness_pct: 80
      color_temp: 2700
    action: light.turn_on

That did not work, as the system responded with:

Die Aktion script:reset_light/undefined konnte nicht ausgeführt werden. required key not provided @ data['service']. Got None

which sounds like it did not get any data. I then tried it with a direct call in the developer section, and it worked. The call from the button did not work.

Next try was do do some different syntax. like

entity_id: "light.strahler_dachuberstand_garten_fassung_1"

and

entity_id: ->
    light.strahler_dachuberstand_garten_fassung_1

and

entity_id: "{{ 'light.strahler_dachuberstand_garten_fassung_1' ]]"

None of that worked

Next try was to split the entity
UI:

type: custom:button-card
icon: mdi:home
tap_action:
  action: call-service
  service: script:reset_light
  service_data:
    domain: light
    entity_id: strahler_dachuberstand_garten_fassung_1

Script

alias: Licht zurücksetzen
description: Setze eine Lichtentität auf Standardwerte
fields:
  domain:
    description: Die Domain der Lichtentität (z.B. 'light')
    example: light
  entity_id:
    description: Die ID der Lichtentität (z.B. 'strahler_dachuberstand_garten_fassung_1')
    example: strahler_dachuberstand_garten_fassung_1
sequence:
  - target:
      entity_id: "{{ domain }}.{{ entity_id }}"
    data:
      brightness_pct: 80
      color_temp: 2700
    action: light.turn_on

No success. All same problem.

Again, i am a beginner. I will likely do a simple mistake. Maybe someone could tell me how it works. Thanks