Call script with parameters

Tags: #<Tag:0x00007f7395f5fbd0>

I am a starter with a home assistant.
I have a question about controlling a script

On an action of a button:
tap_action:
action: call-service
service: script.change_schedule_livingroom
service_data:
program: ‘12’
With this code my script works
Now I want to change the code to now (). weekday () + and button number
How do I get this working

Is dit de juiste plaats om dit soort vragen te stellen ??

You will need to either use a custom card or include the data you want to template in your script. See How to use template in service_data?

My button

  • type: “custom:button-card”
    color_type: button-card
    entity: input_boolean.woonkamer_weg
    name: Weg
    icon: mdi:logout
    styles:
    card:
    - height: 75px
    tap_action:
    action: call-service
    service: script.wijzig_regeling_woonkamer
    service_data:
    programma: 11 (i need now().weekday() + “1” for this button)

My script
wijzig_regeling_woonkamer:
alias: wijzig_regeling_woonkamer
sequence:
- service: input_text.set_value
data_template:
entity_id: input_text.woonkamer_stap
value: ‘{{ programma }}’

I think it would be easier to use the lovelace-card-templater for this.

- type: "custom:card-templater"
  entities:
    - input_boolean.woonkamer_weg
  card:
    type: button
    name: Weg
    tap_action:
      action: call-service
      service: script.wijzig_regeling_woonkame
      service_data:
        programma_template: >
          {{ now().weekday() + 1 }}

It works fine now.
Thanks for your help.
If there’s something else I can hopefully ask you again