custom-cards / button-card

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

Templated expressions not updated in browser_mod popup window #880

Open mosave opened 1 week ago

mosave commented 1 week ago

Issue description:

button-card displayed in browser_mod popup window properly reacts to triggering entities according to styling/states configuration but NOT updates templated expression. It looks like templates calculated only once after I open/reopen browser_mod popup window.

Exactly same button-card definition placed directly to dashboard trigger updates as expected both with styling/states definition and templated expressions

Button-card version: 4.1.2 browser-mod version: 2.3.1

To Reproduce This is the configuration I used:

        - type: custom:button-card
          entity: binary_sensor.17_heater_error
          icon: mdi:water-boiler-alert
          color: rgb(192,0,0)
          name: "Water heater mode"
          state_display: '[[[ return states["binary_sensor.17_heater_error"].state; ]]]'
          show_name: true
          show_icon: true
          show_state: true
          triggers_update: all
          tap_action:
            action: more-info
            entity: binary_sensor.17_heater_error
          state:
            - value: 'off'
              icon: 'mdi:water-boiler'
              color: 'var(--paper-item-icon-active-color)'
              styles:
                name:
                  - color: 'var(--paper-item-icon-active-color)'
                state:
                  - color: 'var(--paper-item-icon-active-color)'
          styles:
            card:
              - margin: 0
              - padding: 0
              - border: none
              - box-shadow: none
            icon:
              - margin: 0
              - padding: 0
            grid:
              - grid-template-areas: "'i n s'"
              - grid-template-columns: 1fr 6fr 3fr
            name:
              - justify-self: start
              - margin: 0
              - padding: 0
              - color: "rgb(192,0,0)"
            state:
              - margin: 0
              - color: "rgb(192,0,0)"

Desktop (please complete the following information):

Mariusthvdb commented 1 week ago

so probably better posted as an issue in browser-mod repo, as button-card behaves properly? Check issues, seems an obvious issue to already exist

btw, why use the

state_display: '[[[ return states["binary_sensor.17_heater_error"].state; ]]]'

if you show state of this entity it already should be there

why the use of

triggers_update: all

? you shouldnt need that at all in this case

mosave commented 1 week ago

btw, why use the

state_display: '[[[ return states["binary_sensor.17_heater_error"].state; ]]]'

It is reduced template to locate issue itself, as well as "all" flag Actual template more complex and constructs text based on several entities.

Thank you for answer, I will chase browser_mod then :)

Mariusthvdb commented 1 week ago

I see.

not sure how many entities but you better just list them than use ‘all’ as that is really what it is. All. In your system. And thus very inefficient….

mosave commented 1 week ago

Thanks, it is exactly as I do usually, but trying every possibility in attempts to make dashboard alive again :)