thomasloven / lovelace-template-entity-row

🔹 Display whatever you want in an entities card row.
MIT License
210 stars 16 forks source link

Possible to get rid of the jinja2 display when first shown? #16

Closed i00 closed 3 years ago

i00 commented 4 years ago

When the a template-entity-row first loads, you can see a flash of the template text before it is replaced with the actual data... Is it possible to stop this from happening ... or display no data (in fields with {{ {% {# etc)until the template is evaluated?

Mariusthvdb commented 3 years ago

please let me add here, the templates keep showing up on each reload. I have a set of light_level sensors that update as light changes (meaning very frequently...) and upon each change, the frontend first show the template and then the values, which is really not as it should be.

Seem to recall this was a design choice, so would appreciate a re-think of that.

this is what I setup:

    filter:
      include:
        - entity_id: '*_sensor_light_level'
          options:
            type: custom:template-entity-row
            name: >
              {{state_attr(config.entity,'friendly_name').split(' sensor light level')[0]}}
            state: >
              {{state_attr(config.entity,'lightlevel')}} lm
            secondary: >
              {% set light_level = state_attr(config.entity,'lightlevel')|int %}
              {% if light_level < 1 %} dark
              {% elif light_level < 3000 %} bright moonlight
              {% elif light_level < 10000 %} night light
              {% elif light_level < 17000 %} dimmed light
              {% elif light_level < 22000 %} 'cosy' living room
              {% elif light_level < 25500 %} 'normal' non-task light
              {% elif light_level < 28500 %} working / reading
              {% elif light_level < 33000 %} inside daylight
              {% elif light_level < 40000 %} maximum to avoid glare
              {% elif light_level < 51000 %} clear daylight
              {% else %} direct sunlight
              {% endif %}

thanks for having a second look.

thomasloven commented 3 years ago

I belive this is fixed, right?

Mariusthvdb commented 3 years ago

yes! it is, had noticed but forgot to mention. And thank you.... sorry!