thomasloven / lovelace-state-switch

🔹Dynamically replace lovelace cards depending on occasion
MIT License
382 stars 27 forks source link

Switched cards don't use the first available area on screen #9

Closed bjornesjogren closed 4 years ago

bjornesjogren commented 4 years ago

I've come to like the state-switch a lot and use it now quite exensively. One problem I see is that if I have like 5 switched cards on a page (just use state 'on' to show the cards) the cards that are 'on' aren't placed at the nearest possible area but instead where they are when all switches are 'on'. That is in Chrome on a PC. On my android phone, the switches show all cards switched 'on' one just after another, no blank space in between, so a different behaviour on different machines.

I don't have any state 'off' in my setup since I don't know what to put there since 'off' in my case mean nothing to show. Maybe that's the problem? But why in that case does it work just magically on the android phone (chrome there as well)?

thomasloven commented 4 years ago

That's how the default layout engine of lovelace works. You could try layout-card to see if that helps.

I suppose you mean that there are gaps horizontally, i.e. there are no large gaps above the cards, but only beside them? In that case, the reason that it works on your phone is that it only shows one column of cards. You'd probably get the same behavior with a very narrow browser window.

pergolafabio commented 4 years ago

hi @bjornesjogren

did you figure this out? i also have some state-switches, with no "off", so i dont want to display anything if i do, when there is no card displayed, m page is getting filled with gap/spaces

so lets say, i have 5 state-switches below each other, first one is on, and last one is in, i see a lot of space between card 1 and 5

this didn happen on conditional cards, when it didnt need to display anything

i think we should have some kind of default, thats really blanc?

bjornesjogren commented 4 years ago

Sorry I have no solution for this. I stopped looking for one when Thomas answered my original post. I've moved parts of the GUI to HADashboard to get more control even though what can be done there does not match what are the the good parts of lovelace. But a possibility to control item placement in the GUI in lovelace is the thing I find most lacking. (At least I haven't found any way to have control).

pergolafabio commented 4 years ago

yea, i am back to conditional cards, not using state*switch anymore if needed conditional cards dont have the issue

thomasloven commented 4 years ago

That's a different issue entirely.

thomasloven commented 4 years ago

That's soon to be fixed, I can add.

pergolafabio commented 4 years ago

Good to hear, thnx in advance