button-card icon indicating copy to clipboard operation
button-card copied to clipboard

Trigger_updates template support

Open basbruss opened this issue 4 years ago • 0 comments

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.

basbruss avatar Feb 17 '22 11:02 basbruss