This is the main button-card thread.
As I said, the stock Button card cannot be used with jinja templates:
type: button
...
icon: >-
{{ ... some jinja code ... }}
But the custom:button-card accepts JS templates:
type: custom:button-card
...
icon: >-
[[[ ... some JS code ... ]]]