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

Live Update of Entities #229

Closed martydingo closed 1 year ago

martydingo commented 1 year ago

Hiya there,

This is a lovely tool, thanks very much!

I would like to have the ability for cards to live update based on their states.

As of currently, I have a card set up with the following animation:

                - type: "circle"
                  entity_index: 0
                  position:
                    cx: 150
                    cy: 90
                    radius: 47
                  styles:
                    circle:
                      stroke: "var(--secondary-background-color)"
                      filter: url(#sak-nm-default)
                  animations:
                    - state: "[[[ return (state); ]]]"
                      styles:
                        circle:
                          filter: url(#nm-1-reverse)
                          fill: >-
                            [[[ return
                            `rgb(${states["light.office_door_spotlight"].attributes.rgb_color})`
                            ]]]
                    - state: "off"
                      styles:
                        circle:
                          filter: url(#sak-nm-default)

This card does change color based on the light, however upon updating the color on the same card, on a different tool (but within the same toolset), the card does not update the new light color on the card itself.

github-actions[bot] commented 1 year ago

Thank you for creating your first issue for the Swiss Army Knife custom card!

AmoebeLabs commented 1 year ago

I'm not sure what your actual problem is but...

If entity light.office_door_spotlight is not entity_index: 0, then the circle will not get updated if that attribute color changes. Only entities or attributes listed in the entities section are requested and updated by HA.

Try to add that light entity with attribute 'rgb_color', and see if that helps.

martydingo commented 1 year ago

I had spotted that and come back to report that fixed the issue, thanks.