maxwroc/battery-state-card

Displaying batteries in a grid

magune opened this issue · 8 comments

magune commented

I have many battery driven devices and the card has full screen width; it would be nice if the list of battery status can wrap over to more columns automatically; so I get all entities sorted by batter without having to create several cards with different filtering conditions (like column 1 for 0-25%, column 2 for 25-50% etc). Being able to have one long list of entities just wrapping over to a new column would be great.

TBH standard Lovelace cards have a fixed width (per screen width) and forcing them to be wider won't looks nice. I think that when you will have some other cards at the same dashboard you will see misalignment which will be hard to solve. Another tricky thing would be to handle mobile screens.

Do you have any other cards which do something similar?

In general I think that when you have a lot of battery devices/entities it is better to use groups (which will hide the batteries with higher levels and show the ones which require your attention).

I'm not rejecting the idea but I'd like to know what is the exact expectation (example screenshots would be the best)

magune commented

Ok now I get what you mean...

I have played with CSS little bit and it looks like it is achievable although the order is not column-wise but row-wise otherwise we would need to have a fixed number of items in column (I think)

This is the result
image

The CSS I've added is the following

.card-content {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}
.entity-spacing {
    margin: 0;
    width: 300px;
    flex: 1 1 auto;
    border-radius: 6px;
    background-color: rgba(0,0,0,.1);
    padding: 5px 10px;
}

TBH the above CSS code wont give you much now. But I'm planning to bring back the style to the card config which will allow you to apply custom styles.

If you want to can experiment now with card-mod card which allows to apply custom styles to the other cards (and use the above css code, although some basic knowledge about CSS would need to be needed as this CSS is not complete and probably some adjustments would be needed)

Hmm maybe it make sense to add these styles by default and enable them on some config option/switch. I'll think about it

magune commented

This is great progress, and I am fine with the battery-level sorting being row wise and not column wise, if that is far easier to implement.

Hey I am not sure if this is the right place to ask, but I am trying to get the battery percentages to show more compact, possibly with card mod or some other CSS stuff,

I am mostly trying to decrease the amount of space between the icon, name and mostly the percentage.

It's very wide right now.
image

EDIT:

I guess that is what you menat above with readding the style flag into the config? :P