thomasloven / lovelace-state-switch

🔹Dynamically replace lovelace cards depending on occasion
MIT License
382 stars 27 forks source link

Custom element doesn't exist: state-switch #4

Closed mvereecken closed 5 years ago

mvereecken commented 5 years ago

I tried to install the custom card, but it seems LL doesn't recognize it. This is what I added in Lovelace:

- type: module
    url: /local/customcards/state-switch.js

(I both tried "module" and "js", the documentation is not clear about this) The js-file was stored in www/customcards/state-switch.js It's visible in the custom card list of the tracker-card, so it must be at least a little bit recognized :-). Hass.io-version: 0.88.2 I also checked permissions; they are the same as the other custom cards. Do you have any idea what can be wrong?

mvereecken commented 5 years ago

Also, I rebooted Home Assistant and my server a couple of times, just to make sure...

mvereecken commented 5 years ago

Also, I ruled out the fact that I use a subdirectory for the card, so it's now under www (root) /local/state-switch.js The problem remains.

mvereecken commented 5 years ago

Some more info (Chrome debug)! image

image

thomasloven commented 5 years ago

Do you have the latest version of card-tools?

mvereecken commented 5 years ago

Hi Thomas,

Yes I have: image

mvereecken commented 5 years ago

Well... it turned out that, although the tracker shows the last version, it's not what was in the card-tools.js file! In the code it checks for 0.3 version, while in your latest source file it checks for 0.4. I don't know how this is possible, but anyway, it's not an error in your code. Thank you for making me think in the right direction :-). And keep up the good work, your tools are amazing!