Perform-Action with template data

Hello !

I’m quite confuse. I’m trying to use the button badge in the Heading card. but I have trouble performing an action :

Here is my code for the heading

type: heading
icon: mdi:sofa
heading_style: title
badges:
  - type: button
    icon: hue:scene-nightlight
    color: deep-purple
    tap_action:
      action: perform-action
      perform_action: cover.set_cover_position
      target:
        area_id: salon
      data:
        position: "{{ states('input_number.ui_covers_night_position') | int }}"

When I press the button, I get the following error

Failed to perform the action cover/set_cover_position. expected int for dictionary value @ data['position']

But when I go to Developer Tools > Action to do :

action: cover.set_cover_position
target:
  area_id: salon
data:
  position: "{{ states('input_number.ui_covers_night_position') | int }}"

It work like a charm !

what’s the difference between perform-action and action ?
What can I do to make my button work ?

Sadly the answer is to remove the template.
Most cards do not allow templates.

There are card mods that can add template functionality, but standard HA does not allow templates in the card.

However, you could have the card run a script and the script can use the template.

Oh that sucks ! :frowning:

I was trying to remove some custom card, but it seems that won´t be possible

Back to Custom Card Feature then…

Or use a script as I said