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.

`card_mod` styles not being re-injected after HA state change

See original GitHub issue

Is your feature request related to a problem? Please describe. I’m using custom:frigate-card-menu-icon to toggle input_boolean entity state which hides/unhides conditional Picture Elements in Frigate Lovelace card views. For Picture element icon I’m using usual icon type but for text after the icon I’m using card-mod with ::after selector. The problem I’m having is that when I hide elements, switch/refresh a view and then toggle elements again, card-mod won’t get injected until I press menu button for view. I think this GIF would make more sense for you:

issue

Describe the solution you’d like I think you know better how to solve this, but I can suggest adding special action to custom:frigate-card-action to refresh current view that acts just like when you press menu button for view. Though I don’t know if that would solve anything, because I tried Defining multiple actions for Elements to toggle the elements and switch the view, but it didn’t work for me(maybe there is a need for some delay before view is switched).

elements:
  - type: custom:frigate-card-menu-icon
    icon: mdi:information
    tap_action:
      - action: call-service
        service: input_boolean.toggle
        service_data:
          entity_id: input_boolean.switch_elements
      - action: custom:frigate-card-action
        frigate_card_action: image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
peledziuscommented, Feb 17, 2022
  1. Have a configurable list of entities (render_entities) that will cause a card re-render when their state changes. This is very similar to update_entities that the card already supports, except instead of updating to the default view it would re-render the current view. In this case, we’d set this to the input_boolean entity.

I actually thought same thing at first and wanted to suggest, but considered there’s an easier approach for fixing this issue.

Also, I don’t know if you noticed this thing, but somehow it renders elements fine when toggling state(outside of card or with custom menu button) without changing the view. I noticed in Web Inspector that elements disappear when they don’t meet the condition, but when they do, they reappear again with card-mod injected. Is there an explanation why it’s working fine that way?

Maybe we can use(if possible) this behaviour for moving forward with this? If not, then option 2 is the only way I can think of now.

P.S I really appreciate your work and time with this issue(and with whole card). You’re amazing!

1reaction
dermotduffycommented, Feb 10, 2022

[Not ignoring this, it’s just a pretty advanced usecase so going to dig into the other v3-rc.1 issues first. Thanks for reproduction config!]

Read more comments on GitHub >

github_iconTop Results From Across the Web

Card-mod - Add css styles to any lovelace card
Hi, can I change state color ? ... style: | ha-card { --my-icon-color: {% if ... No matter what I do the auto...
Read more >
Use card-mod and some css to give your cards a little umph.
Im just curious as I'm getting into web development and not only was I ... I want to make a donation, HA has...
Read more >
5 FRONTEND HACS (Cards and Elements) - YouTube
In todays video I will be showing you 5 Front End HACS that you can make use of in your Home Assistant Lovelace...
Read more >
card-mod-helper
card-mod -helper. A Home Assistant tool for figuring out card-mod element selectors for themes. Open Chrome DevTools by right-clicking on a card and ......
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