custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.93k stars 233 forks source link

Trigger_updates template support #558

Closed basbruss closed 1 year ago

basbruss commented 2 years ago

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.

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 4.1.0-dev.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 4.1.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: