question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mod-card causes flickering if jinjia2 used for styling

See original GitHub issue

My Home Assistant version: 2021.11.5 My lovelace configuration method (GUI or yaml): yaml, storage

What I am doing: Applying card-mod styles dependingly on some condition.

What I expected to happen: Styling is applied, picture is stable.

What happened instead: Picture is flickering - styles are not applied sometimes.

The code below contains 4 rows (template-entity-row) with card-mod:

  1. Styles are constant.
  2. Styles are constant, the row is placed into mod-card.
  3. Styles depend on input_boolean value.
  4. Styles depend on input_boolean value, the row is placed into mod-card.

The 4th row is flickering (video): azcdewsd

Do not observe this with card-mod 3.0.13.

Minimal steps to reproduce:

type: entities
entities:
  - type: custom:template-entity-row
    name: simple row
    icon: mdi:account
    secondary: sec
    card_mod:
      style:
        div#wrapper: |
          .info.pointer .secondary {
            color: orange;
          }
          state-badge {
            display: none;
          }
  - type: custom:mod-card
    card:
      type: custom:template-entity-row
      name: row inside mod-card
      icon: mdi:account
      secondary: sec
    card_mod:
      style:
        template-entity-row$div#wrapper: |
          .info.pointer .secondary {
            color: orange;
          }
          state-badge {
            display: none;
          }
  - type: section
    label: conditional styling
  - input_boolean.test_boolean
  - type: custom:template-entity-row
    icon: mdi:account
    name: simple row
    secondary: sec
    card_mod:
      style:
        div#wrapper: |
          .info.pointer .secondary {
            {% if is_state('input_boolean.test_boolean','on') %}
            color: orange;
            {% endif %}
          }
          state-badge {
            display: none;
          }
  - type: custom:mod-card
    card:
      type: custom:template-entity-row
      icon: mdi:account
      name: row inside mod-card
      secondary: sec
    card_mod:
      style:
        template-entity-row$div#wrapper: |
          .info.pointer .secondary {
            {% if is_state('input_boolean.test_boolean','on') %}
            color: orange;
            {% endif %}
          }
          state-badge {
            display: none;
          }

Error messages from the browser console: image

Info: image


By putting an X in the boxes ([]) below, I indicate that I:

  • Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).

  • Have made sure I am using the latest version of the plugin.

  • Have followed the troubleshooting steps of the “Common Problems” section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.

  • Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ildar170975commented, Feb 7, 2022

Thomas, seems to be fixed!!! Thank you very very much

1reaction
DavidFW1960commented, Dec 8, 2021

OK so it’s flicking like crazy here. But when I turned the input_boolean on it stoppen off and on again and it’s flickering with no real reason I can see. I’m really sorry I have been shitty and slow trying to help with this but I’ve been under the hammer here…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdown cards are flashing when using Jinja/Template #114
The markdown card flicker in both Chrome/Firefox on PC/Android. Refreshing the page from the HA menu seems to fix the issue untill it's ......
Read more >
A different take on designing a Lovelace UI
This issue might be related to that mod-card causes flickering if jinjia2 used for styling · Issue #165 · thomasloven/lovelace-card-mod ...
Read more >
Template Designer Documentation - Jinja
This document describes the syntax and semantics of the template engine and will be most useful as reference to those creating Jinja templates....
Read more >
Jinja2 template not rendering if-elif-else statement properly
You are testing if the values of the variables error and Already are present in RepoOutput[RepoName.index(repo)] . If these variables don't ...
Read more >
Useful Jinja Snippets - Bloomreach Documentation
In this article, you will find several useful pieces of code that you might commonly use in Bloomreach Engagement, from simple personalization to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found