Lovelace Card Preloader

Did you refresh the page in the browser after updating the preload section? This plugin only runs on page load, so you will need to do that after any changes you make.

Thanks. Thatā€™s what I was missing :slight_smile:

This is the config:

    - type: custom:vertical-stack-in-card
      cards:
        - type: entities
          style: |
            ha-card {
              border: solid 1px var(--dark-primary-color);
              border-radius: 12px;
              overflow: hidden;
              width: 97%;
              margin: 0 auto;
              padding-top: 0px;
            }
            .card-content {
              padding-top: 0px;
              padding-right: 4px;
              padding-bottom: 0px;
              padding-left: 3px;
            }
          show_header_toggle: false
          entities:
            - type: 'custom:hui-picture-elements-card'
              image: 'http://via.placeholder.com/500x450/1d1d1d/1d1d1d'
              elements:
                - type: image
                  entity: camera.rockrobo_map
                  camera_image: camera.rockrobo_map
                  style:
                    top: 50%
                    left: 50%
                    width: 100%

I have another card in the vertical-stack-in-card but i hade to take it out since its a custom card i made for myself which is not published. It shouldnt affect the result tho per my understanding

Hi, so I bit the bullet and finally upgraded to 107. I use custom:hui-markdown-card for a lot of things. It seems to working fine with your preloader, however I am having an issue. It works fine on the HA apps (iOS and Android) and Chrome browser (macOS). But I get the ā€˜custom element doesnā€™t existā€™ error when opening it through Applicationize (wich is simply a stripped down Chrome browser).

I have is setup correctly on my lovelace yaml.
</s> <s>preload:</s> <s> - markdown</s> <s>

Tried CMD+R and reloaded a bunch of times, but keeps giving the error. Also restarted HA server. Again, it works fine on a Chrome browser tab and HA apps, just not an a Chrome browser based ā€˜applicationā€™.

Any way to fix this?

Edit: I wasnā€™t paying attention. I needed to change the resource path of the plugin. All works!

Has this been updated to be able to work with rows like the ā€œdividerā€ row yet?

0.107 seems to break more than one hui-cards and preloader does not help, at least to me.

In my case do not work: divider, entity-filter, input select :frowning:

I have deployed a new version, 0.0.3, which allows preloading of rows as well as cards. This means a change in the configuration, so you now use preload_cards and preload_rows to load cards and rows respectively, like this example:

preload_cards:
  - markdown
  - gauge
  - entity-filter
preload_rows:
  - divider
  - input-select-entity

The old preload option still works for now, but is deprecated (and only allows cards to be preloaded) and may be removed in a future version.

3 Likes

fork meā€¦ i love fixes like thisā€¦ nice work, and thanks very muchā€¦ :smiling_face_with_three_hearts:

Sorry, also changing the config option to preload_cards i am still getting this:
Schermata 2020-03-25 alle 12.02.48

Did you reload resources, clear cache and reload page?

just so you know this is needed, and does work:

preload_rows:
  - custom:secondaryinfo-entity-row

Hi, can you tell me why the ā€œalarm-panelā€ cards donā€™t work?

Unknown type encountered: alarm-panel.

this is the code:

preload_cards:
  - picture-entity
  - picture-elements
  - alarm-panel

- entity: alarm_control_panel.home_alarm
  name: Allarme
  states:
     - arm_away 
  type: alarm-panel

thank you very much

Where exactly do you have that in your Lovelace config? It isnā€™t valid on its own and it depends on where you are using it.

If you are trying to use alarm-panel as a type within an entities card it should be referred to as ā€˜custom:hui-alarm-panel-cardā€™, like this:

type: entities
entities:
  - entity: alarm_control_panel.home_alarm
    type: 'custom:hui-alarm-panel-card'
    name: Allarme
    states:
      - arm_away

Iā€™m using home assistant core 0.107.6 and I have two errors:
ā€œCustom element doesnā€™t exist: config-template-cardā€ and ā€œCustom element doesnā€™t exist: bar-cardā€.

I have this:

preload_cards:
  - custom:bar-card
  - custom:config-template-card

into the configuration file of lovelace view.

How can I solve this issue?

EDIT: I put the preload_cards configuration also into the dashboard config file but Iā€™ve the same error.
EDIT 2 : Solved - There was a typo error into the declaration of resources in yaml file.

Hi, Iā€™m trying to put the custom cards color-lite-card. and I donā€™t get it. I am very new to this, could you explain what should I do? Because Iā€™m not getting it, much more than I try.
Thank you

Anyone tried preloading shopping-card (hui-shopping-list-card)? I believe this is a built-in card; Its not working for meā€¦

ui-lovelace.yaml:

preload_cards:
  - markdown
  - gauge
  - shopping-list
preload_rows:
  - divider

Iā€™m using this and it works well for me but I still donā€™t really understand what is going on.

The only card I had that was causing a problem was a hui-markdown-card when inside a picture-elements card and in some cases when it was used a popup.

The thing is, on my desktop PC it wasnā€™t a problem at all in the case of the use inside the picture-elements but was with some popups.

On my cheap Chinese tablet (running Android 9) it seemed to be a problem in all cases.

If there is a deep technical reason why this is so, then maybe I donā€™t need to know but if not, I am very curious about what is going on.

Thanks.

Hi! Great work doing this. Saw a lot of people complaining about the lazy-load feature after 0.107.* upgrade. Thanks for everything! Still not working for me though. I have no custom cards, just a vertical stack with two conditionals that used to work before upgrading to 0.107.7. Right now, everything works as expected after a refresh. If i switch the condition, the other conditional card does not appear, until i press the configure ui button at the top. After that, it works as expected.

So I found this preloader, installed it using HACS, added to resources by pressing the button on the notification pop-up card. Added everything in my mind, trying to make it work in raw configuration editor before anything else:

preload:
  - vertical-stack
  - horizontal-stack
  - entities
  - entity
  - entity-button
  - conditional
  - picture-elements
  - picture-entity

Looking in the console, everything seems fine( i know the ā€˜preload:ā€™ is deprecated), it shows that all the types are preloaded, no errors at all. Still nothing changes in the behaviour of my setup. Any idea?

cards:
  - card:
      elements:
        - entity: switch.bar_lights
          icon: 'mdi:lightbulb'
          style:
            left: 63%
            top: 30%
          tap_action:
            action: toggle
          type: state-icon
      image: /local/images/Smarthome-parter-alloff.png
      type: picture-elements
    conditions:
      - entity: switch.bar_lights
        state: 'off'
    type: conditional
  - card:
      elements:
        - entity: switch.bar_lights
          icon: 'mdi:lightbulb'
          style:
            left: 63%
            top: 30%
          tap_action:
            action: toggle
          type: state-icon
      image: /local/images/Smarthome-parter-bar.png
      type: picture-elements
    conditions:
      - entity: switch.bar_lights
        state: 'on'
    type: conditional
type: vertical-stack

If this is in a regular vertical-stack card, this isnā€™t the lazy load issue that my preloader was designed to fix. It actually looks like this issue that was reported as having started in the 0.108 beta, so maybe it actually started in 0.107.7.

1 Like

Thank you! I have posted my problem there. I think I will wait a little, until the next release to see if thereā€™s any improvement on this topic and then Iā€™ll dig more if nothing changes.