Skip to content

Feature: Refresh SVG on animation/time/state/... #249

@stinobook

Description

@stinobook

The Problem To Be Solved

usersvg images are loaded on card load, not on image load.

Additional background:

trying to implement a camera(image stream, not camera stream) view inside the card.

A concise description of your preferred solution. Things to address include:

I have written a derived entity so that my 'state' always updates every few seconds.
It switches between 2 states, and i have 2 images 'coupled' to it.

(Optional): Suggested Solution

how i see it now the images are 'preloaded' by the card as soon as the card is loaded, but if we can just load the image when it is requested instead of on card load this would make it update each time and allow us to insert a stream inside the card.

my tool:

                - type: usersvg
                  position:
                    cx: 50
                    cy: 55
                    height: 35
                    width: 50
                  style: 'images'
                  entity_index: 12
                  derived_entity:
                    input : '[[[ return state ]]]'
                    state: >
                      [[[
                        if (typeof(entity) === 'undefined') return;
                        if (typeof(state) === 'undefined') return;
                        if (state === 'undefined') return;
                        var sec = state.slice(-1);
                        if (sec % 2 == 0) {
                            return ('even');
                        } else {
                            return ('uneven');
                        }
                  images:
                    - default: /api/image_proxy/image.----
                    - even: /api/image_proxy/image.----
                    - uneven: /api/image_proxy/image.----
                  animations:
                    - state: 'even'
                      image: even
                    - state: 'uneven'
                      image: uneven`


Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions