Custom Button Card and triggers_update

Far be it for me to question, I’m sure there were good reasons, but the removal of triggers_update seems like a backwards step.

I use !include with a dictionary of variables (courtesy of lovelace_gen)1 and it looks like v7 of button-card does not update with this line of JS despite the release notes saying it updates on JS variables.

const occupancy = 'binary_sensor.occupancy_rooms_{{ room }}_occupied';

whereas this did update

triggers_update:
  - binary_sensor.occupancy_rooms_{{ room }}_occupied

I have also tried this

variables:
  occupancy: binary_sensor.occupancy_rooms_{{ room }}_occupied

Which also didn’t appear to work.

I have only just upgraded to v7 and done some rudimentary testing so I would love to be told I am wrong!

However if I am right and the only alternative is to use update_timer: 1s that is fine. Kind of. It does seem like it would add an unnecessary albeit small(?) overhead though.


1 I have been doing this for years, possibly since before button templates were a thing so I have a lot in my config. Perhaps I will be told that I should change to templates but it would be a huge amount of work.

Where are you using the variable in the card? Variables are no longer always evaluated, only when used. So if you wish for having an unused variable to trigger updates, use force_eval: true which will always eval the variable which then will be added to entities automatically tracked.

Check the release note regarding variables as well as triggers_update.

update_timer is really only useful if you want to ensure an update, say every second, for the most simplest case say if displaying Date.now()

1 Like

Thanks for that I must admit to having completely missed force_eval.

1 Like