iantrich / config-template-card

📝 Templatable Lovelace Configurations
MIT License
425 stars 55 forks source link

Custom element doesn't exist: config-template-card #96

Open jmcollin78 opened 2 years ago

jmcollin78 commented 2 years ago

Checklist:

Release with the issue: 1.3.6

Last working release (if known):

Browser and Operating System: Chrome. MacOS Monterey 12.1

Description of problem: After successful installation with HACS, I try to use the card. I manually insert the following card code:

type: custom:config-template-card
entities:
  - light.lampe_entree_1
card:
  type: entities
  entities:
    - entity: light.lampe_entree_1
      name: Ca roule ?

And Whatever I do I've got the error:

Custom element doesn't exist: config-template-card.
type: custom:config-template-card
entities:
  - light.lampe_entree_1
card:
  type: entities
  entities:
    - entity: light.lampe_entree_1
      name: Ca roule ?

Javascript errors shown in the web inspector (if applicable): No specific errpr

Additional information: Of course light.lampe_entree_1 exists. I read this post https://github.com/iantrich/config-template-card/issues/76 which is the same kind of problem

miglor-bcn commented 2 years ago

Hi, one more with the same issue like @jmcollin78

ghost commented 2 years ago

I also have this issue with HA core 2022.2.9

iantrich commented 2 years ago

I'm unable to replicate. I'm on 2022.3.0 and things are working as expected

TheRealBenForce commented 2 years ago

Also having this issue on 2022.5.5

gasman1844 commented 2 years ago

I had this issue after installing with HACS and I restarted core and it then worked fine

Yari117 commented 1 year ago

Same here. Installed manually to www/config-template-card/ Then added lines to configuration.yaml at resources Still it does not work

HA 2022.12.1

BertKleewein commented 1 year ago

I had this problem. I fixed it with some fumbling and stumbling. I tried to figure out exactly what made it work, but I can't get it to break again to figure out what actually fixed it.

I'm using config-template-card version 1.3.6, manually installed with Home Assistant 2022.11.4 and Frontend 20221108.0 - latest. I'm using Firefox 104.0.2 on Linux Mint.

While I was doing this, I learned two things:

  1. If you have trouble loading a resource (like config-template-card), browser caching might be causing it to use an older version of the code. Adding ?v=<something> to the end of the resource_url will supposedly force the code to reload. It doesn't matter what is as long as it's something you haven't used before. For example, this is from my lovelace_resources.yaml:

    - url: "/local/config-template-card.js?v=7"
    type: module

    ?v=7 just means I did 7 experiments, starting at ?v=1 and going up.

  2. If you're changing resources, you also need to refresh the browser to make sure the new code loads. I was just leaving my test page open in the browser and restarting my hass docker container every time I edited lovelace_resources.yaml. This wasn't enough to load the new JavaScript code. I also needed to F5 to refresh the page.

Because I didn't know these things an hour ago, I can't be sure what exactly I did to make it work. I do have some theories:

  1. It's possible that adding ?v=1 to the url in lovelace_resources.yaml fixed it. I can't be sure because I didn't refresh my browser.

  2. It's also possible that I fixed this by opening a browser tab and loading http://automation.localdomain:8123/local/config-template-card.js (automation.localdomain is my home assistant install). I did this because I wanted to see if some permission problem was preventing the file from being served, but it's possible that this forced a preload or refreshed a cache somewhere.

  3. As part of my experiments, I tried reverting config-template-card.js to version 1.3.5 to see if something in 1.3.6 caused this bug. Because of the two things I learned above, I'm not sure if this did anything. I seems to work well with 1.3.5 or 1.3.6 now. (BTW, awesome size improvement from 1.3.5 to 1.3.6 @iantrich! 160 KB to 67 KB! I assume this was because of your dependency changes.)

I'm guessing that theory # 1 (adding ?v=1) fixed it for me. It's possible that it was theory # 2. I doubt it was # 3.

Aaroneisele55 commented 1 year ago

I also have it (#126)

resultzh commented 11 months ago

I also have it

victor-popescu90 commented 5 months ago

I just had this problem and I think I know what the problem is.

It only shows this when the config-template-card syntax is not correct. If anything is slightly wrong then this error shows up, and it highlights all code related to config-template-card as error.