lovelace-layout-card: Layout-break doesn't cause a column break in HA 2024.6
My Home Assistant version: 2024.6
Layout-card version v2.4.5
What I am doing: Just updated to 2024.6 (on two different HA instances). The layout-break card no longer creates a column break; all cards appear in a single column. The dashboard is set to Vertical (layout-card).
What I expected to happen: The two or three columns in my dashboards would all continue to render as previously.
What happened instead: All cards appear in a single column.
Minimal steps to reproduce: Upgrade to HA 2024.6 and clear cache.
# The least ammount of code possible to reproduce my error
title: Cameras
path: cameras
theme: ios-light-mode-blue-red-alternative
type: custom:vertical-layout
layout:
width: 400
max_width: 1000
max_cols: 2
badges: []
cards:
- type: vertical-stack
cards:
* * *
- type: custom:layout-break
# End of code
Error messages from the browser console:
By putting an X in the boxes ([X]) below, I indicate that I:
- Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).
- Have made sure I am using the latest version of the plugin.
- Have followed the troubleshooting steps of the “Common Problems” section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.
- Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 43
- Comments: 72 (5 by maintainers)
For those migrating to a Sections layout, you can actually adjust the yaml to convert your existing layout-card dashboard to a sections one, despite it warning you that migration is not supported.
First, I recommend backing up your dashboards entirely before you begin (hit edit, then click the ••• and pick “Raw configuration editor,” then copy all into a backup file).
To do this:
Edit your dashboard, then click the Edit pencil on the dashboard itself, then the ••• in the popup, then choose “Edit in YAML”
Change
type: custom:vertical-layouttotype: sectionsRemove
badges: []Add
max-columns: 3(or your preference)Above the ‘cards’ key, add a couple new lines:
Indent the existing ‘cards’ and everthing below it, to line up with the t in ‘type’, so it looks like, for ex:
Now, you can either save it, making all of your cards flow into one column (where you can then drag them around in the UI)… or, you can add the other columns manually, wherever you had a
- type: custom:layout-breakline.In place of the
- type: custom:layout-breakline, add the following two lines to make a new column, reducing the indentation by two levels to make the things under ‘cards:’ line up properly.And the remaining cards go underneath the
cards:key as with the first column.If you don’t want to do this part, you can skip this step and just use the UI to make new columns and drag cards into them.
This made the migration much faster for me, but of course using copy-paste isn’t so bad either if you can’t do this.
Seems to still be the same bug as #288.
It is possible to restore the multi-column layout by editing the YAML of the tab as indicated there:
BUT… Then, when switching the tab to edit mode, the “Modify” buttons no longer appear and actually editing any card becomes impossible.
I open a PR to fix the issue: https://github.com/thomasloven/lovelace-layout-card/pull/293
There are several theme variables available for section view. That should fix your theme issues 🙂
ha-view-sections-column-max-width(default:500px)ha-view-sections-column-min-width(default:320px)ha-view-sections-column-gap(default:32px)ha-view-sections-row-gap(default:8px)ha-section-grid-column-gap(default:8px)ha-section-grid-row-gap(default:8px)I tried grid layouts and combinations of vertical stacks within horizontal stacks, but nothing reproduced the simplicity and clean function of the layout-break card. Like a lot of others, I eagerly await a fix to this incredibly useful and vital frontend.
I guess the issue still exists with core 2024.6.1 that has been released 12h ago…?
All working with the ha-section-grid-row-… variables, thanks all!
You have to create a theme to add these variables. You can create one with these variables only.
With 2024.6 card are now wrapped with a
hui-cardso the layout card needs to support that.I went ahead and copy-pasted my dashboards to the new Drag and Drop dashboard layout, and it works quite well with similar Column concepts.
This spells the end of the road for Layout Card for me, and I expect due to the new layout tools, there will be decreasing need for it in the future. Maybe not time for everyone, but for me it works.
Thanks for all the fish. Cheers.
I have gone back to 2024.5.5 as I have this layout in 95% of my UI … I did stare at the source code for 2 seconds then quickly closed it again … hoping someone with understanding of how it works can fix it …
still waiting on 2024.5 release
I mentioned the
--row-height: 66pxissue in this comment, and it also affects Mushroom chips.@Montreal666, so far it doesn’t seem there’s a way to configure that value.
@iptvcld, you can create a custom theme and use in the dashboard, using these variables posted earlier. This will solve all issues, except the vertical spacing you see below short cards.
As a summary, given I also had some hiccups trying to create my own theme as well:
Thin sectionsis the theme name in this example):configuration.yaml:configuration.yamlfrontend.reload_themes. That would refresh all themes, without the need for you to press F5 on the pages. Don’t forget to select the theme in the Dashboard, Tab or Card. @Montreal666, that’s probably what you missed that made the theme change not reflect in the UI.Good luck!
Here a build (on macOS) of layout-card.js (gzipped for github): layout-card.js.gz
I copied/pasted everything into a Sections dashboard. I set up my 3 columns as before, but I’m missing the width element that I used for a 7’ tablet, I had:
Now I’m getting only 2 columns with the 3rd appearing under the first. On my desktop I see 3 columns. Is there a way to use percentages or something for this new Sections view?
That’s good to know. The main thing holding me back from Sections is that I’ve not been able to figure out how to increase the width of a section (or all sections, doesn’t have to be per-section, though that would be nice as well). Maybe I’m overlooking something obvious?
Also, when editing YAML, if you highlight a bunch of lines (or several thousand lines…) you can hit tab to indent it all two spaces, twice for 4 spaces which is what we need here, making quick work of the above. I was able to recreate my substantial dashboard using Sections following the above steps in only a few minutes! And be able to drag stuff around is great.
Just that they’re not as wide as they need to be 😦 And if someone knows how to address that, maybe they also know how to adjust the gap between sections? That’d be handy too.
Change the layout type on the card from “default” to either horizontal or vertical, then it will fill the whole row. I had the same issue at first.
Thank you, it works again with https://github.com/sdrapha/lovelace-layout-card/blob/fix_break_card_ha_2024.6/layout-card.js. 👍 Don’t forget to replace file in
layout-card.js.gzas well (or maybe just remove this gz file), and increase version in resource URL.is this mod even still being maintained??
If you look back through this thread, there are steps to migrate manually. I did this with a dashboard with dozens of complex cards and it only took about five minutes. Super happy with the result. Note that for the bit about having to indent everything (thousands of lines in my case) you can just highlight the text and hit tab (twice here) to make quick work of it.
Adding the layout type was a work around but caused the edit button issue. The fix in the .js file made it all work again so you don’t need layout type in the yaml … but remember to clear browser cache after replacing the .js file
Where do I add the ha-view-sections-… variables in the yaml - to the dashboard raw config? what if I’m not using a theme?
I moved to a grid-layout, it works as expected without using layout-break card and I can still use UI to edit elements.
You can customize the width and the height on the card using
yamlin section card. We are looking to bring that to the UI. This feature is not documented yet because it’s experimental and may change (although I don’t think that will change 😅)Just found a work around. Add a vertical stack to the Section that contains the cards you want to occupy a whole row.
Yep. I transferred one of my views to a “Sections” type today and it works great plus displays more consistently across devices for me. I think I’ll probably be doing the rest of my views when I have time and then bin this.