button-card
button-card copied to clipboard
Trigger_updates template support
Is your feature request related to a problem? Please describe.
triggers_update: "all" does not always the right job when using some more advanced javascript.
For instance to many updates for some templates occur, which in this case changes the color to often:
But when not using triggers_update: "all" not all variables states do update directly.
variables:
color: >
[[[
var colors = ['yellow', 'blue', 'red', 'purple','green', 'pink'];
var color = colors[Math.floor(Math.random() * colors.length)];
return color;
]]]
Describe the solution you'd like
Add support for extracting a string from javascript: triggers_update: "[[[ return variables.my_variable ]]]"
So you only have to specify an entity once to a variable instead of adding to a variable and adding to the triggers update list.