Lovelace Card Preloader

You have to add it as a custom repository.

Sorry, missed that bit. Thanks

so, this preloading thing is just a temporary workaround until the actual custom card (eg: vertical-stack-in-card) is updated for 107, right?

1 Like

Doesnā€™t sound like it for the hui- trick from this comment:

Iā€™m getting the same error in HACS and your suggestion didnā€™t seem to work for me. Forward slash or not, at the end, itā€™s not allowing me to add the repo.

It works: Just add it with the following settings:

URL: https://github.com/gadgetchnnel/lovelace-card-preloader
Type: Plugin

@Steven_Rollason : Where do I put the preload statement if I do not use ui-lovelace.yaml? I manage my Lovelace from the inbuilt editor in the frontend.

1 Like

Use the RAW editor. Put it at the top of your Lovelace config.

So is this going to be added to hacs properly?

Iā€™ve submitted a PR to add to to the default HACS repositories, Iā€™ll let you know when itā€™s completed

1 Like

Itā€™s done :tada:

1 Like

@Steven_Rollason, @ludeeus thanks for the quick responses.

Iā€™m interestedā€¦
Is this a long term solution or anticipated as a workaround until some future change in HA/Lovelace?

I donā€™t fully understand why it is needed in the first place so if the answer is implicit in that then Iā€™m sorry :wink:

Edit: sorry that wasnā€™t a reply only to @ludeeus

Itā€™s needed because of a core change to Lovelace. For performance, they no longer load all cards. Only whatā€™s needed. This impacted the ability to use custom:hui-xxx. Its here to stay.

OK, thanks for that.
Does that mean using Preloader negates the performance benefits or is it on a per view basis?
Not that Iā€™ve ever noticed any issues with the performance of Lovelaceā€¦

Probably not, iā€™d wager that it just preloads the cards you configure, which youā€™ll be using anyways. Itā€™d be identical to normal behavoir without the custom:huiā€¦ But maybe @Steven_Rollason can answer better because Iā€™m making assumptions based on the code.

@klogg @petro Thatā€™s correct. The performance would depend on how many cards you add to the preload list. Iā€™d think that the at the very worst, if you added every single default card to the list, the performance would be around the same as it was before the change was made.

Edit: It also only preloads on a page reload, so that should minimise the effect.

1 Like

Has anyone been able to get this to work with fold-entity-row? Out of the 14 custom plugins I use this is the only one that gives me the error. Coincidentally it also happens to be the one that I use the most.

Iā€™ve added it to my resources like this after trying it the old way first

- url: /hacsfiles/lovelace-card-preloader/lovelace-card-preloader.js
  type: js

I tried /local/www/community/lovelace-card-preloader/lovelace-card-preloader.js
as well as /community_plugin/lovelace-card-preloader/lovelace-card-preloader.js

In my ui-lovelace.yaml I have

preload:
  - fold-entity-row
  - section

Not sure if ā€œsectionā€ is needed but thatā€™s the type thatā€™s giving me problems

This is the error I am getting

image

And this is how it looks in my conifg

image

Iā€™m sure Iā€™m doing something wrong and itā€™s probably a simple fix but I just canā€™t seem to figure it out. Anyone have any idea?

In case you are still in troubleā€¦ I have written a blog post about this. But itā€™s in german so maybe you need to fire up the google translator:

https://www.triumvirat.org/2020/03/19/homeassistant-0-107-custom-element-doesnt-exist/

This may only work with cards currently, not with rows. Can you try it like this?

preload:
  - hui-section-row

If that doesnā€™t work Iā€™ll probably need to update the preloader to add support for rows, but Iā€™ll need to think about how this can be done without breaking existing configs (it will need to know if it is preloading a card or a row).

Ahh that explains it.

That didnā€™t work either unfortunately.