Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "Custom element doesn't exist" on builtin cards #104

Closed
rummik opened this issue Oct 21, 2022 · 72 comments · Fixed by #274
Closed

Error: "Custom element doesn't exist" on builtin cards #104

rummik opened this issue Oct 21, 2022 · 72 comments · Fixed by #274
Labels
bug Something isn't working

Comments

@rummik
Copy link

rummik commented Oct 21, 2022

Describe the bug
There seems to be an issue with embedding builtin cards

To Reproduce
Steps to reproduce the behavior:

  1. Create a custom:room-card
  2. Add a sub-card using any builtin card (ex: picture-glance)
  3. Click on 'save'
  4. Reload the page
  5. See error

Example YAML:

type: custom:room-card
title: Kitchen
cards:
  - camera_view: live
    type: picture-glance
    title: Kitchen
    image: https://demo.home-assistant.io/stub_config/kitchen.png
    entities:
      - entity: sensor.uptime

Expected behavior
Custom room card should be visible with builtin card

Screenshots
image

Desktop (please complete the following information):

  • OS: Linux
  • Browser: Firefox
  • Version: 105.0.1

Additional context
Looks like this may be related to #64

@rummik rummik added the bug Something isn't working label Oct 21, 2022
@marcokreeft87
Copy link
Owner

marcokreeft87 commented Oct 21, 2022

Working on my HA. Which version do you use?

image

@rummik
Copy link
Author

rummik commented Oct 21, 2022

Current HA (2022.10.5). Have you saved and reloaded the dashboard?

@marcokreeft87
Copy link
Owner

Ah on mobile I get it too. Weird, but I might know what's the problem

@marcokreeft87
Copy link
Owner

Ah on mobile I get it too. Weird, but I might know what's the problem.

Edit: nope that isn't it

@rummik
Copy link
Author

rummik commented Oct 21, 2022

I've poked at it a little bit the other day, but I don't know enough about how HA handles card loading to submit a fix 😅

At least it's relatively easy to reproduce I guess?

@marcokreeft87
Copy link
Owner

It is easy to reproduce, but since this is an error HA throws it a pain to debug

@marcokreeft87
Copy link
Owner

Weird thing is, for example the "entities" card is working..

@rummik
Copy link
Author

rummik commented Oct 26, 2022

I'm finding that it works if I have the builtin card I want loaded elsewhere on the dashboard. If I can manage to find the time I'll dig around and see if I can get a PR, since I did notice there's an exposed API that doesn't seem to be used by the library you're using, and I'd like to compare what's being done differently

@marcokreeft87
Copy link
Owner

That would be nice. Good find btw

@omayhemo
Copy link

omayhemo commented Nov 1, 2022

I have the same problem.

@omayhemo
Copy link

omayhemo commented Nov 2, 2022

FYI latest version I grabbed from HACS didn't solve, but you probably knew that already.

@marcokreeft87
Copy link
Owner

FYI latest version I grabbed from HACS didn't solve, but you probably knew that already.

Thats why there are release notes in them :P

@marcokreeft87
Copy link
Owner

@omayhemo Weird thing is, I had this error while developing 1.07.01 but its gone now

@omayhemo
Copy link

omayhemo commented Nov 2, 2022

ORLY? I can't be arsed. :)

@omayhemo
Copy link

omayhemo commented Nov 3, 2022

@omayhemo Weird thing is, I had this error while developing 1.07.01 but its gone now

Since its WOM, I wonder if your local differs from the repo?
Don't know if it helps or not, but if I goto the edit popup for the element, the card that errors is properly shown. If I make a change and save, the card will now show on the dashboard as well.

@marcokreeft87
Copy link
Owner

Its the exact same version

@omayhemo
Copy link

omayhemo commented Nov 3, 2022

I haven’t tried other browsers just edge, I’ll test others when I can. Just trying to provide a little data no idea if it helps you or not.

@omayhemo
Copy link

Exists in all browsers, just FYI. Furthermore, I get a a.style can't be on undefined error periodically as well. Refreshes don't help, I have to go in and literally perform an edit on the card and save it and then the whole view will work. There seems to be a rendering timing problem or something. I have to find a different solution at this point.

@marcokreeft87
Copy link
Owner

Unfortunately I can't test all cards. And tbf it's a nice extra feature, but cards will always work best in a seperate instance.

@csthomas2
Copy link

I built a dashboard specifically for mobile with this card. I still get the a.style undefined and element doesn't exist. I temporarily fixed by adding the two built-in cards at the bottom, but I have to scroll all the way down then refresh the page for the a.style error to go away. Then I have to wait until the picture entity cards refresh by themselves for the undefined element to fix itself. I'm using latest versions of the card and HA.

@marcokreeft87
Copy link
Owner

Can you share your yaml?

@csthomas2
Copy link

csthomas2 commented Feb 9, 2023

Sure
yaml.yaml.txt

@marcokreeft87
Copy link
Owner

Sure yaml.yaml.txt

I think the problem here is that you put cards in a horizontal stack in a room card.

@csthomas2
Copy link

csthomas2 commented Feb 9, 2023

I removed the horizontal-stacks from the room-cards and loaded the dashboard up in an incognito window. I first get this error (got this before as well). Then the page reloads itself (in incognito, I have to sign in again). Then I proceed to get the "Custom element doesn't exist". I would also get the "Custom element doesn't exist" for the horizontal-stack. Scrolling down and waiting eventually loads my horizontal stacks and the pictures within. The pictures do end up loading without the horizontal-stack as welll, since I have the extra card at the bottom.
image
image

edit: actually, this is really weird. The behavior is different without the horizontal-stacks. Even with the built in card at the bottom, I can't get it to eventually load without editing the dashboard as mentioned above.

@marcokreeft87
Copy link
Owner

Hmm some cards of HA work different from the others. For example the picture entity. But you now get the error like the rest in this topic. I will take the horizontal-card into the test when I finally find the solution to this bug :)

@NeonOby
Copy link

NeonOby commented Feb 28, 2023

Not sure if this is helpfull but this problem also happens when I nest the mushroom card inside the room card.
When I reload the dashboard in chrome or when restarting the android app I get either this:
image
or
image
Room cards without nested cards work fine and the mushroom card by itself also works fine.

@marcokreeft87
Copy link
Owner

marcokreeft87 commented Feb 28, 2023

Why would you put the mushroom card in a room card? Thats just weird haha. But you have this error because you dont pass any entities to the room card @adoby

@NeonOby
Copy link

NeonOby commented Mar 1, 2023

"Why would you put the mushroom card in a room card?"
Because I want to categorize my entities by room, I thought this is the meaning of the room/entities/auto entities cards.
Create one room card and then add all the entities that are inside that room inside the room card.
This way it's just a little bit faster and nicer looking to change the brightness or change the cover position.

"But you have this error because you dont pass any entities to the room card"
Doesn't seem so. I have multiple room cards in my dashboard every card that doesn't contain "cards:" works fine.
As soon as I add a single nested mushroom card it breaks the room card.

I tested nesting the build in light card and it works.
At least for me it happens for custom cards, not build in cards even though I haven't tested all of them.

I did change the entitiy ids in the screenshot.
The screenshot only shows one of the possible errors, the other one "custom element doesn't exist" still also happens randomly.
image

@marcokreeft87
Copy link
Owner

Ah ok. I think this will help. It gives me a direction to search for at least. Thanks for trying multiple configurations

@cookie050
Copy link

In app, still same problem. If i change webviewer on android to chrome it works

@marcokreeft87
Copy link
Owner

Crap @paulonutor seems like your solution doesn't seem to work for everyone. Can you check my note to self solution?

@paulonutor
Copy link
Contributor

My PR fixed something else. Nested entities didn't update on state change. This bug seems interesting and I'm going to take a look at it.

@elninosi
Copy link

Looks like some elements are loaded before room card's code and this is causing a problem on slow mobile connection dashboard is almost always loaded properly.

@paulonutor
Copy link
Contributor

Could anyone check if it was fixed by #248 ?

@elninosi
Copy link

@paulonutor I can't see that there are any updates available (current version 1.07.24).

@marcokreeft87
Copy link
Owner

I need to make a release for that. But I have to review it first

@marcokreeft87
Copy link
Owner

@elninosi I've made a new release, can you try now?

@elninosi
Copy link

elninosi commented Jun 30, 2023 via email

@NeonOby
Copy link

NeonOby commented Jun 30, 2023

Home Assistant didn't show me any update, so I clicked on the redownload button in the options menu which let me select the .25 version and install it.

I have the same errors like before

  • Cannot read properties of undefined
  • Custom element doesn't exist
    Randomly one of them or rarely it will work.
    Both in the mobile app and desktop browser (chrome)
    Also cleared the browser cache for the website.

I did not yet restart Home Assistant yet.
Do I need to restart to check if it works?

@elninosi
Copy link

elninosi commented Jul 14, 2023 via email

@marcokreeft87
Copy link
Owner

I havent had this in a while now. Anyone in here who has had it since the october release?

@marcokreeft87 marcokreeft87 linked a pull request Oct 14, 2023 that will close this issue
3 tasks
@marcokreeft87 marcokreeft87 reopened this Oct 14, 2023
@marcokreeft87
Copy link
Owner

@elninosi Can you try with the new release?

@cookie050
Copy link

Use latest update, and still got this error. Before the update i modified it a little bit that if it errors it reloads. Not perfect and loop sensitive but it worked

@marcokreeft87
Copy link
Owner

Use latest update, and still got this error. Before the update i modified it a little bit that if it errors it reloads. Not perfect and loop sensitive but it worked

Can you share your yaml?

@cookie050
Copy link

It js but i can look in backup if i can find it. It updated and i forgot to pull the js before updating.

@marcokreeft87
Copy link
Owner

I mean your yaml of the Configuration in HA

@cookie050
Copy link

cookie050 commented Oct 14, 2023

But the error and yaml,

Cannot read properties of undefined (reading 'style')

type: custom:room-card
title: Overloop & Sanitair
style: []
cards:
  - type: vertical-stack
    cards:
      - square: true
        columns: 4
        type: grid
        cards:
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: toggle
            entity: light.lamp_hal_boven
            name: Hal boven
            icon: mdi:ceiling-light
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: toggle
            entity: light.lamp_hal_voordeur
            name: Hal beneden
            icon: mdi:ceiling-light
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: toggle
            entity: light.lamp_overloop_z
            name: Overloop
            icon: mdi:ceiling-light
          - show_name: true
            show_icon: true
            type: button
            entity: switch.lamp_zolder_switch
            tap_action:
              action: toggle
            name: Zolder
            icon: mdi:ceiling-light
  - type: vertical-stack
    cards:
      - square: true
        columns: 4
        type: grid
        cards:
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: toggle
            entity: light.lamp_badkamer
            name: Badkamer
            icon: mdi:ceiling-light
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: toggle
            entity: light.lumi_lumi_switch_l1aeu1_light
            icon: mdi:ceiling-light
            name: Toilet

The style is still in there because i test it if that's the problem .

Screenshot_2023-10-14-14-17-14-248_io homeassistant companion android

And still this one time by time

@marcokreeft87
Copy link
Owner

But why do you use room-card for this? You are using room-card like a container now, and not where it is designed for: Showing entities per room

@marcokreeft87
Copy link
Owner

Doesn't take away the fact that it should work btw

@marcokreeft87
Copy link
Owner

@cookie050 can you test it with v1.08.00 thanks to Scott ( don't know your github handle bro ) it should be fixed :)

@cookie050
Copy link

Seem to do the trick, have used it on multiple devices all work in one time now :)

@marcokreeft87
Copy link
Owner

Seem to do the trick, have used it on multiple devices all work in one time now :)

Finally! Haha thanks for testing

@marcokreeft87
Copy link
Owner

@rummik can you test this?

@mdecourcy
Copy link

Works for me across several devices so far

@NeonOby
Copy link

NeonOby commented Oct 15, 2023

I also tested version 1.08.00 and can not reproduce the problems anymore.
Tested with mobile browser, android app and latest chrome browser.

Thanks, now I can finally use my new dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants