custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.93k stars 233 forks source link

blink animation not working with template #788

Open maverik80 opened 11 months ago

maverik80 commented 11 months ago

Checklist

Describe the bug hi guys, I have this card that should make the status flash if it's different from zero, but instead it's not like that, it only flashes if I go from zero to a value xx.xx, this sensor is a scale sensor so it's made up of xx .xx.

Version of the card Version: 1.3.0

To Reproduce This is the configuration I used:

      type: custom:button-card
      entity: sensor.bilancia_xiaomi_vins
      show_units: false
      show_state: true
      show_icon: false
      show_name: false
      styles:
        card:
          - border-width: 0px
          - font-size: 35px
        state:
          - animation: >
              [[[ if (states['sensor.bilancia_xiaomi_vins'].state != 0) return
              'blink 5s ' ]]]
      card_mod:
        style: |
          ha-card {
            color: white;
            text-align: center;
            font-family: digital;
            text-shadow: 1px 1px 0px white,  0 0 0.2em white;
            letter-spacing: normal;
          }

Screenshots If applicable, add screenshots to help explain your problem.

Expected behavior I would expect that at every change of state other than zero the state would flash for 5 seconds

Desktop (please complete the following information):

Smartphone (please complete the following information):

ngocjohn commented 11 months ago
  - animation: >
      [[[ return entity.state !== 0 ? 'blink 5s' : null; ]]]
maverik80 commented 11 months ago
  - animation: >
      [[[ return entity.state !== 0 ? 'blink 5s' : null; ]]]

Unfortunately it doesn't work like that either... the card is in a custom_fields and when I enter your string it gives me an error