thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.27k stars 116 forks source link

switching from monster card (fast) to auto entities (slow) #36

Closed h4nc closed 3 years ago

h4nc commented 4 years ago

Wanted to move my last few monsters cards to auto entities, because it's marked as deprecated.

The thing is my card gets extremely slow with auto entities, it's gets stuck when scrolling it. When I switch back to monster card it works flawlessly.

This is an example:

    - type: custom:monster-card
        show_empty: false
        card:
          type: entities
          title: 'On'
        filter:
          include:
            - entity_id: "automation.*"
              state: "on"

      - type: custom:auto-entities
        show_empty: false      
        card:
          type: entities
          title: 'On'
        filter:
          include:
            - entity_id: "automation.*"
              state: "on"  

Why does it work fine with monster card?

kmlucy commented 4 years ago

I have the same issue. I'm on v1.1 until the auto hide bug is resolved, but on Chrome on my Android phone, the auto-entities cards almost freeze the whole site trying to scroll through them. No issues on Chrome on Windows.

syphernl commented 4 years ago

This is probably a duplicate of #32

h4nc commented 4 years ago

Looks like this issue is resolved with 1.3 (or 1.2). Was switching from 1.1 because 1.2 had another issue (cards not showing up).

h4nc commented 4 years ago

It still seems a little bit slower than monster card. Monster card was just there. Auto entities pops up and takes around a second or two.

h4nc commented 4 years ago

To those who switched to auto entities.

I noticed something strange, while comparing monster and auto. I deletet monster card within hacs. HACS successfully deleted the folder in the www/community folder. After that it isn't available in the HACS store any more. The thing is even after restarting my home assistant instance the "monster card" cards still work.

I double checked it, the .js file isn't there any more but it still works. @kmlucy could you pls try to reproduce this. You could move the folder somewhere else and try if lovelace still accepts the cards. Looks like it's saved somewhere else too. Unfortunately we can't open an issue in the monster card repo any more.

kmlucy commented 4 years ago

I see the load time, but it's minor enough to not be a nuisance with my cards, probably less than one second.

I can't replicate the behavior you are seeing, but it sounds like it may be a cache issue to me.

h4nc commented 4 years ago

Monster Card had no delay.

Thanks for trying it out.

I already tried deleting the cache of my browser. Did not help. Is there a way to delete the cache of Home Assistant?

thomasloven commented 4 years ago

Load times should be shorter now.

(Monstercard did have a measureable delay, but that doesn't really matter, I'm just nitpicking)

h4nc commented 4 years ago

Unfortunaltely I have to tell that in my experience auto entities is much slower than monster card. I can't tell why. Maybe it's too much to go through all the automations (see example in first post).I have around 200 automations.

Monstercard did not load, it was just there. When I click the view with the automations now (auto entities) it first loads for seconds (3-4s).

Could you try my view?

  - title: Automations
    icon: mdi:home-automation
    id: automations
    cards:
      - type: custom:auto-entities
        show_empty: false      
        card:
          type: entities
          title: 'Off'
        filter:
          include:
            - entity_id: "automation.*"
              state: "off"  
      - type: custom:auto-entities
        show_empty: false      
        card:
          type: entities
          title: 'On'
        filter:
          include:
            - entity_id: "automation.*"
              state: "on"  
thomasloven commented 4 years ago

With the latest release on hacs it's pretty much instant for me on a page with 20 auto-entities cards and approximately 200 entities, so I don't know what to say...

I had some trouble with the release tagging, so it is possible (but unlikely) that you got an in-between version if you're using hacs. In that case, reinstalling might help.

h4nc commented 4 years ago

Did reinstall it, thanks. Will keep an I on it. Now it almost loaded instantly.

Still weird that monster cards worked instantly for me and you measured a noticeable delay there.

h4nc commented 4 years ago

@thomasloven do you have an idea why my monster cards still work, although I deinstalled monster card. I even checked that the folder is deleted in the www/community folder.

thomasloven commented 4 years ago

I can think of three options.

h4nc commented 4 years ago

Yes, I have the monster card reference still in my resources section. The thing is this points to a folder that didn't exist any more. The monster card file isn't in that folder any more.

I commented "in" the resources section of monster card again to try it out and even with our incognito mode, the monster card isn't available any more. Custom element doesn't exist. This is what I expected from the beginning.

Still had it working on another PC. After clearing my cache like this:

Push F12 to open dev console. Right click refresh button. Select bottom option to clear cache and do a hard reload.

It now also has this "not exist" warning. Did not know that the Browser saves the .js file in it's cache.

Thanks for clearing that up for me!

thomasloven commented 4 years ago

Is this resolved then?

h4nc commented 4 years ago

Well, not really.

For me still monster card worked instantly and auto entities takes a moment to load. Would like to leave it open to see if other users that switch from monster to auto have this too.

1SK98 commented 9 months ago

Hello everyone,

currently i run into a similar problem. I use a browser-mod popup to control my lights in detail. Within the popup i use auto-entities to populate a grid layout. Because i want to style the grid-layout i need to nest everything within a custom:mod-card. With this configuration i get a visible delay until the items in the grid layout appear (about 2 seconds), after i open the popup. When i remove the custom:mod-card everything is instantly loaded without any delay.

- type: custom:mod-card
  view_layout:
    grid-area: "szenen"
  card_mod:
    style:
      #apply styles here
  card:
    type: custom:auto-entities
    card:
      type: grid
      square: false
      columns: 4
    card_param: cards
    filter:
      include:
        - domain: scene
          entity_id: "*wohnzimmer*"
          options:
            type: "custom:button-card"
            template: hue_scene_circle

Is this behaviour reproducible?

ildar170975 commented 9 months ago

This shows immediately after F5:

image

type: custom:mod-card
card_mod:
  style: |
    ha-card {background-color: lightgreen}
card:
  type: custom:auto-entities
  card:
    type: grid
    square: false
    columns: 4
  card_param: cards
  filter:
    include:
      - domain: light
        options:
          type: custom:button-card

Suggest to test with as minimal amount of code as you can. Start with removing a "layout-card" code & revise your filter to smth easier.