Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card-mod cards causes all dashboard cards to flicker after the HA update and when Entity-filter in the same dashboard." #407

Open
RobusX opened this issue Sep 29, 2024 · 10 comments

Comments

@RobusX
Copy link

RobusX commented Sep 29, 2024

My Home Assistant version: 2024.9.3

My lovelace configuration method (GUI or yaml): Yaml

After updating from 2024.6.4 to 2024.9.3, all dashboard cards with modified colors or card-mod hidden buttons are flickering (colors and hidden buttons blink) when an entity-filter card with color-changing mode is also present on the dashboard. The issue cannot be reproduced in safe mode, as no cards are displayed.

Flickering appeared with Firefox, Google Chrome and also within latest HA Android Companion app.
Slider button on the right browser side also blinks.

If the dashboard displays cards in the bottom part, browser due to flickering issue moves to the upper dashboard side, where the right slider also blinks.
As was discovered, issue disappears when entity-filter card is removed from the dashboard or dashboard in edit mode.
The problem is very annoying; please resolve it. The uses of the card-mod card are endless, and it would be a pitty to abandon it.

"Please review the detailed issue description and dashboard card codes (link below), where it was stated from the frontend developer that the problem is caused by card-mod not being updated to follow the latest HA frontend releases."

home-assistant/frontend#22084

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

  • X Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).
  • X Have made sure I am using the latest version of the plugin.
  • X Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.
  • X 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.
@RobusX RobusX changed the title Card-mod cards causes all dashboard cards to flicker after the HA update when Entity-filter in the same dashboard." Card-mod cards causes all dashboard cards to flicker after the HA update and when Entity-filter in the same dashboard." Sep 29, 2024
@ildar170975
Copy link
Contributor

ildar170975 commented Sep 29, 2024

Please post a SHORT minimal code to reproduce the issue.
With stock cards only.

@RobusX
Copy link
Author

RobusX commented Sep 30, 2024

Yes, no problem.

Firstly, there are two automations which generate blinking lights for aqara lights (2 fields - columns in the entitiy-filter card -> please accommodate it to your entities and remove alarm/sun conditions, only blinking is needed:

alias: Light Night Blinking RED when Armed
description: Light Night Blinking RED when Armed
trigger:
  - platform: state
    entity_id:
      - switch.alarm_plug
    to: "on"
    id: alarm
  - platform: numeric_state
    entity_id: sun.sun
    value_template: "{{ state_attr('sun.sun', 'elevation') }}"
    below: -3
    id: sunset
  - platform: numeric_state
    entity_id: sun.sun
    value_template: "{{ state_attr('sun.sun', 'elevation') }}"
    above: -3
    id: sunrise
  - platform: time_pattern
    minutes: /3
    id: alarm
condition:
  - condition: or
    conditions:
      - condition: and
        conditions:
          - condition: state
            entity_id: switch.alarm_plug
            state: "on"
          - condition: trigger
            id: sunset
          - condition: time
            after: "18:00:00"
            before: "07:00:00"
      - condition: and
        conditions:
          - condition: state
            entity_id: switch.alarm_plug
            state: "on"
          - condition: trigger
            id: sunrise
          - condition: time
            after: "06:30:00"
            before: "18:00:00"
      - condition: and
        conditions:
          - condition: state
            entity_id: switch.alarm_plug
            state: "on"
          - condition: trigger
            id: alarm
action:
  - choose:
      - conditions:
          - condition: trigger
            id: sunset
        sequence:
          - repeat:
              sequence:
                - target:
                    entity_id:
                      - light.aqara_hub_m1s_5fc8_lightbulb
                      - light.aqara_hub_m1s_64d3_lightbulb
                  data:
                    color_name: red
                    brightness_pct: 70
                  action: light.turn_on
                - delay: "00:00:00.6"
                - target:
                    entity_id:
                      - light.aqara_hub_m1s_5fc8_lightbulb
                      - light.aqara_hub_m1s_64d3_lightbulb
                  data:
                    brightness_pct: 3
                    kelvin: 3800
                  action: light.turn_on
                - delay: "00:00:05"
              until:
                - condition: state
                  entity_id: switch.alarm_plug
                  state: "off"
      - conditions:
          - condition: trigger
            id: sunrise
        sequence:
          - repeat:
              sequence:
                - target:
                    entity_id:
                      - light.aqara_hub_m1s_5fc8_lightbulb
                      - light.aqara_hub_m1s_64d3_lightbulb
                  data:
                    color_name: red
                    brightness_pct: 70
                  action: light.turn_on
                - delay: "00:00:00.6"
                - target:
                    entity_id:
                      - light.aqara_hub_m1s_5fc8_lightbulb
                      - light.aqara_hub_m1s_64d3_lightbulb
                  data:
                    brightness_pct: 3
                    kelvin: 3800
                  action: light.turn_on
                - delay: "00:00:05"
              until:
                - condition: state
                  entity_id: switch.alarm_plug
                  state: "off"
      - conditions:
          - condition: trigger
            id: alarm
        sequence:
          - repeat:
              sequence:
                - target:
                    entity_id:
                      - light.aqara_hub_m1s_64d3_lightbulb
                      - light.aqara_hub_m1s_5fc8_lightbulb
                  data:
                    color_name: red
                    brightness_pct: 70
                  action: light.turn_on
                - delay: "00:00:00.6"
                - target:
                    entity_id:
                      - light.aqara_hub_m1s_64d3_lightbulb
                      - light.aqara_hub_m1s_5fc8_lightbulb
                  data:
                    brightness_pct: 3
                    kelvin: 3800
                  action: light.turn_on
                - delay: "00:00:05"
              until:
                - condition: state
                  entity_id: switch.alarm_plug
                  state: "off"
mode: restart

And here is other automation needed which blinks additionally two kuril bulbs in the entity-filter card (when those bulbs blink, there are four columns in the entity-filter card (2 for aqara+2x kuril), so entity-filter card is stretching from 2 to 4 fields:


alias: Light Kuril Blinking RED when Armed
description: Light Kuril Blinking RED when Armed
trigger:
  - platform: state
    entity_id:
      - switch.alarm_plug
    to: "on"
    id: day
  - platform: time_pattern
    minutes: /3
    id: day
condition:
  - condition: state
    entity_id: switch.alarm_plug
    state: "on"
action:
  - choose:
      - conditions:
          - condition: trigger
            id: day
        sequence:
          - repeat:
              sequence:
                - target:
                    entity_id:
                      - light.kurilbulb1
                      - light.kurilbulb2
                  data:
                    color_name: red
                    brightness_pct: 2
                  action: light.turn_on
                - delay: "00:00:00.1"
                - target:
                    entity_id:
                      - light.kurilbulb1
                      - light.kurilbulb2
                  data: {}
                  action: light.turn_off
                - delay: "00:00:00.1"
                - target:
                    entity_id:
                      - light.kurilbulb1
                      - light.kurilbulb2
                  data:
                    color_name: white
                    brightness: 2
                  action: light.turn_on
                - delay: "00:00:00.1"
                - target:
                    entity_id:
                      - light.kurilbulb1
                      - light.kurilbulb2
                  data: {}
                  action: light.turn_off
                - delay: "00:00:06"
              until:
                - condition: state
                  entity_id: switch.alarm_plug
                  state: "off"
          - data:
              brightness_pct: 20
              kelvin: 3500
            target:
              entity_id:
                - light.kurilbulb1
                - light.kurilbulb2
            action: light.turn_on
          - delay: "00:00:01"
          - data: {}
            target:
              entity_id:
                - light.kurilbulb1
                - light.kurilbulb2
            action: light.turn_off
mode: single


And here is entity-filter card for the dashboard which contains those four bulbs:

type: entity-filter
title: Lights/Sensors ON
show_header_toggle: false
entities:
  - entity: light.aqara_hub_m1s_5fc8_lightbulb
    name: AqSFlL
    tap_action:
      action: toggle
  - entity: light.aqara_hub_m1s_64d3_lightbulb
    name: AqStrL
    tap_action:
      action: toggle
  - entity: light.kurilbulb1
    name: Kur_1
    tap_action:
      action: toggle
  - entity: light.kurilbulb2
    name: Kur_2
    tap_action:
      action: toggle
state_filter:
  - 'on'
  - open
  - detected
  - operator: '>'
    value: 4
show_empty: false
sort:
  method: domain
card:
  type: glance
  title: ' '

And finally, here we have other (two for example) entities card in the same dashboard, which contains some car-mod code and are flickering (NOK):
1. Here on-off switch on the right near "Main Door" text, which is hidden by  card-mod, flickers:

type: entities
entities:
  - type: custom:template-entity-row
    entity: binary_sensor.contact_sensor
    name: Main Door State
    toggle: false
    secondary_info: last-updated
    secondary: >
      {% set state = states('binary_sensor.contact_sensor') %} {% if state ==
      'off' %}
        Closed
      {% elif state == 'on' %}
        Open
      {% else %}
        {{ state }}
      {% endif %} | Last: {{
      states.binary_sensor.contact_sensor.last_updated.astimezone().strftime('%m-%d
      %H:%M:%S') }}
    card_mod:
      style: |
        :host {
          --mdc-icon-size: 40px;    
          --paper-item-icon-color: {%
            if is_state('binary_sensor.contact_sensor', 'off') %}
            green;
          {%- elif is_state('binary_sensor.contact_sensor', 'on') or
              is_state('switch.shelly_main_door_12v_switch_0', 'on') %}
            red;
          {%- else %}
            grey;
          {%- endif %};
              }
  - type: custom:fold-entity-row
    head:
      entity: switch.shelly_main_door_12v_switch_0
      name: Main Door
      toggle: false
      state_color: true
      card_mod:
        style: |
          :host {
            --card-mod-icon-color: 
            {% if is_state(config.entity, 'on') %}
              orange;
            {% else %}
              grey;
            {% endif %};
          }
          .entities .state-card-toggle .state-card {
            display: none !important;
          }
          ha-entity-toggle {
            display: none !important;
          }
    entities:
      - type: custom:template-entity-row
        entity: switch.shelly_main_door_12v_switch_0
        name: Main Door 12V Switch
        tap_action:
          action: toggle
        toggle: true
        secondary_info: last-updated
        secondary: >
          Last: {{
          states.switch.shelly_main_door_12v_switch_0.last_updated.astimezone().strftime('%m-%d
          %H:%M:%S') }}
      - type: custom:template-entity-row
        entity: switch.2pm_main_door_switch_1
        name: Main Door 230V Supply
        tap_action:
          action: toggle
        toggle: true
        secondary_info: last-updated
        secondary: >
          Power: {{ states('sensor.2pm_main_door_switch_1_power') }} W |  Last:
          {{
    states.switch.shelly_main_door_12v_switch_0.last_updated.astimezone().strftime('%m-%d
          %H:%M:%S') }} 
title: ''
state_color: true
show_header_toggle: false


2. And in this entities card on the same dashboard all three doors, colored with green when closed (car-mod) are flickering:

type: entities
title: ' '
show_header_toggle: false
state_color: true
entities:
  - type: custom:template-entity-row
    entity: binary_sensor.contact_sensor
    name: Main Door
    icon: mdi:door
    style: |
      :host {
        --mdc-icon-size: 30px;
        --card-mod-icon-color: 
          {% if is_state(config.entity, 'on') %}
            red
          {% elif is_state(config.entity, 'unavailable') or is_state(config.entity, 'unknown') %}
            yellow
          {% else %}
            green
          {% endif %};
      }
    secondary: |
      {% if is_state(config.entity, 'on') %}
        Door Open
      {% elif is_state(config.entity, 'off') %}
        Door Closed
      {% elif is_state(config.entity, 'unavailable') %}
        Sensor Unavailable
      {% elif is_state(config.entity, 'unknown') %}
        Sensor State Unknown
      {% endif %}
  - type: custom:template-entity-row
    entity: binary_sensor.contact_sensor_3
    name: App Door
    icon: mdi:door
    style: |
      :host {
        --mdc-icon-size: 30px;
        --card-mod-icon-color: 
          {% if is_state(config.entity, 'on') %}
            red
          {% elif is_state(config.entity, 'unavailable') or is_state(config.entity, 'unknown') %}
            yellow
          {% else %}
            green
          {% endif %};
      }
    secondary: |
      {% if is_state(config.entity, 'on') %}
        Door Open
      {% elif is_state(config.entity, 'off') %}
        Door Closed
      {% elif is_state(config.entity, 'unavailable') %}
        Sensor Unavailable
      {% elif is_state(config.entity, 'unknown') %}
        Sensor State Unknown
      {% endif %}
  - type: custom:template-entity-row
    entity: binary_sensor.contact_sensor_2
    name: Cellar Door
    icon: mdi:door
    style: |
      :host {
        --mdc-icon-size: 30px;
        --card-mod-icon-color: 
          {% if is_state(config.entity, 'on') %}
            red
          {% elif is_state(config.entity, 'unavailable') or is_state(config.entity, 'unknown') %}
            yellow
          {% else %}
            green
          {% endif %};
      }
    secondary: |
      {% if is_state(config.entity, 'on') %}
        Door Open
      {% elif is_state(config.entity, 'off') %}
        Door Closed
      {% elif is_state(config.entity, 'unavailable') %}
        Sensor Unavailable
      {% elif is_state(config.entity, 'unknown') %}
        Sensor State Unknown
      {% endif %}   

I hope it is more clear now. Thanks for looking into it !

@ildar170975
Copy link
Contributor

Sorry, this is not a short MWE.

@ildar170975
Copy link
Contributor

Also, the posted code is not formatted and cannot be analyzed.

@RobusX
Copy link
Author

RobusX commented Sep 30, 2024

I shorted code as much i could..but entities for blinking should be present in the dashboard and in both automations. And also in the flickering cards.
I pasted yaml code for both automations, entity-filter card and both entities cards (flickering) and save it into notepad (.yaml file not supported to enclose). AS i see formatting is preserved, although txt format. I hope, this is ok.
Thank you for your effort.

cards.txt

@RobusX
Copy link
Author

RobusX commented Sep 30, 2024

I uploaded "flickering" video from the test dashboard to Youtube.

Link is here:
https://youtu.be/a7kE-vaaDT4

IN original dashboard with much more cards, flickering is much more intenstive (with sliders up down flickering) and as i noticed also tab with mini graphic cards flickers:

In video below i switched between two tabs to show flickering on both:
https://www.youtube.com/watch?v=t6JGUY2BK_0

@pickonedev
Copy link

pickonedev commented Oct 1, 2024

Here you are :-D

I have a sample as well.

2024-10-01.18-41-35-1.mp4

@RobusX
Copy link
Author

RobusX commented Oct 1, 2024

Thanks @ pickonedev .
Can you confirm too that in dashboard editing mode it is no flickering at all ?
Thanks for the info.

@pickonedev
Copy link

That is right.

@RobusX
Copy link
Author

RobusX commented Oct 2, 2024

Yes, today i also tried your case. I turned one switch to ON in the entities card and all cards that use card-mod code flickered at the same time.
So problem appears not connected with the entity-filter card, if this is the same cause, as my other issue when entity-filter is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants