Action/template is working in develeoper tools but not in button

You can’t use templates in the standard Button card.

Move the action to a script then configure the Button card’s tap_action to call the script.