AmoebeLabs / swiss-army-knife-card

The versatile custom Swiss Army Knife card for Home Assistant allows you to create your unique visualization using several graphical tools, styling options and animations.
236 stars 20 forks source link

'unavailable' state as a working state for animations etc #195

Closed stinobook closed 1 year ago

stinobook commented 1 year ago

The Problem To Be Solved

When retrieving state, the 'unavailable' one doesn't seem to be parsed to SAK. so animation state 'unavailable' can't be used. image

this state is useful for displaying if there is a connection issue with an entity.

Additional background:

tried both with and without ' '


        animations:
          - state: 'off'
            styles:
              rectex:
                fill: rgba(97, 69, 71, 1)
                transition: fill 0.5s linear
          - state: 'on'
            styles:
              rectex:
                fill: rgba(0,0,0,0)
                transition: fill 0.5s linear
          - state: 'unavailable'
            styles:
              rectex:
                fill: rgba(97, 69, 71, 1)
                transition: fill 0.5s linear

(Optional): Suggested Solution

make 'unavailable' a working state

current workaround i use is to use the is not operator:

        animations:
          - state: 'off'
            styles:
              rectex:
                fill: rgba(97, 69, 71, 1)
                transition: fill 0.5s linear
          - state: 'on'
            styles:
              rectex:
                fill: rgba(0,0,0,0)
                transition: fill 0.5s linear
          - state: 'on'
            operator: '!='
            styles:
              rectex:
                fill: rgba(97, 69, 71, 1)
                transition: fill 0.5s linear

example, my garage light has lost its connection to the zigbee network, now displayed in my card: image

AmoebeLabs commented 1 year ago

What if you use ‘-ua-‘, instead of ‘unavailable’ in the animations section?

stinobook commented 1 year ago

We have a winner! thanks man!

image