swiss-army-knife-card
swiss-army-knife-card copied to clipboard
Feature: Refresh SVG on animation/time/state/...
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`
Hi, try this example (this is how I output the video stream from the camera and album covers from the media player)
####################################################
- type: usersvg
position:
cx: 50
cy: 38
height: 73
width: 97
clip_path:
position:
cx: 50
cy: 50
height: 73
width: 97
radius:
top_left: 1.2
top_right: 1.2
bottom_right: 1.2
bottom_left: 1.2
entity_index: 0
style: 'images'
images:
- default: >
[[[
{
return (entity_config?.entity_picture ||
entity.attributes?.entity_picture || 'none');
}
]]]
####################################################