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.
232 stars 19 forks source link

Support changing name and icon within animations section, ie state dependent #104

Closed AmoebeLabs closed 2 years ago

AmoebeLabs commented 2 years ago

The Problem To Be Solved

In some cases, it is nice if you can change the icon and/or name depending on the state of the entity.

Additional background:

Related Issues (if any)

(Optional): Suggested Solution

Both name and icon can easily be added to the state-dependent animations section, as it is just a field in a JSON struct...

If the animations section handler sets those fields into the animations object, they can be processed elsewhere...

The tool _buildIcon() and _buildName() functions should check the animation settings, and use those instead of the current list of sources to build the Icon and/or Name.

(Optional): Alternative Solutions