maxwroc/battery-state-card

Do not render card if there are no entities to show

maxwroc opened this issue · 1 comments

Describe the bug

Card renders without entities

How to reproduce

Empty entity list or filter which hides batteries above the threshold

Expected behavior

YAML configuration

# please paste here your card config

Screenshots

Version

Hey @maxwroc thanks for this fix! However, it looks like the card is still displayed partially. I believe we should apply a display: none style to the card. See auto-entities for comparison:

Screen Shot 2022-12-23 at 12 53 57 PM

You can see the battery card next to another card with the element highlighted in dev tools:

Screen Shot 2022-12-23 at 12 55 11 PM

That part highlighted in orange is due to a 4 pixel margin on the top and bottom. Small nitpick of course, but it adds a noticeable gap when nested between other cards.

Note that this could be due to something particular in my setup, but I think adding display: none would be the proper way to handle this regardless. Let me know what you think!