Savjee/button-text-card

Templating spin animation not working

Closed this issue · 2 comments

Hello!

First: a huge thankyou for providing this awesome card!

Now my issue: If I try to template the spin animation, nothing happens. Using icon_animation: spin works fine. Here's my card config:

type: custom:button-text-card
entity: sensor.systemauslastung
icon: mdi:server-network
font_color: |
  [[[ return (entity.state < 45) ? 'rgb(96, 125, 139)' : 'white' ]]]
background_color: |
  [[[ if (entity.state < 45) return 'white';
      if (45 <= entity.state < 50) return 'orange';
      if (50 <= entity.state < 65) return 'red';
      return 'rgb(168, 20, 25)' ]]]
icon_animation: |
  [[[ return (entity.state > 65) ? 'spin' : 'blink' ]]]

I've tried with

  [[[ return (entity.state > 65) ? 'spin' : ' ' ]]]

  [[[ return (entity.state > 65) ? 'spin' : '' ]]]

  [[[ if (entity.state > 65) return 'spin'; return ' ' ]]]

  [[[ if (entity.state > 65) return 'spin'; return '' ]]]

Any hint is much appreciated.

Core version 2023.0b6
Card version 0.6.2

The README file wrongly indicates that icon_animation supports templates.
I've fixed that with v0.6.3.

Thanks for reporting. Update the card and try again. Should work now ;)

Ref: ae2ee76

Works like a charm! 👍🏻