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

Displaying batteries in a grid #605

Open
magune opened this issue Nov 24, 2023 · 5 comments
Open

Displaying batteries in a grid #605

magune opened this issue Nov 24, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@magune
Copy link

magune commented Nov 24, 2023

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.

@magune magune added the enhancement New feature or request label Nov 24, 2023
@maxwroc
Copy link
Owner

maxwroc commented Nov 26, 2023

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
Copy link
Author

magune commented Nov 27, 2023 via email

@maxwroc
Copy link
Owner

maxwroc commented Nov 27, 2023

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)

@maxwroc
Copy link
Owner

maxwroc commented Nov 27, 2023

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
Copy link
Author

magune commented Nov 27, 2023

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.

@maxwroc maxwroc changed the title Add support for columns of data Displaying batteries in a grid Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants