Olen / lovelace-flower-card

Lovelace Flower Card to match the custom plant integration

Home Page:https://github.com/Olen/homeassistant-plant/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flower Card stopped working without change on my side

bolderbast opened this issue · comments

As of this morning, Flower Card is no longer loading and shows: Custom element doesn't exist: flower-card.

Hitting F12 and reloading the page, shows the following errors:

GET https://unpkg.com/lit-html@3.0.0/lit-html.js?module net::ERR_ABORTED 500 (Internal Server Error) unsafe-html.js:1
Uncaught (in promise) https://my-server-name:8123/hacsfiles/lovelace-flower-card/flower-card.js?hacstag=297423025300 load_resource.ts:13

So it seems the card connects to unpkg.com (why?) and that server may have changed something or has an issue?

commented

Likely dupe of: #44

Installing 2.1 works for now, for me anyway. If you open the link you quote:

https://unpkg.com/lit-html@3.0.0/lit-html.js?module

It shows:

Cannot generate module for lit-html@3.0.0/lit-html.js

Opened a new issue as I wasn't sure it was a dupe. The issue mentioned there started in the beginning of september, and references an HA update. This isn't the case for me. So I figured this migt be a separate issue.

I'll wait for a bit, to see if it resolves itself, or if an update of the card fixes it. No critical enough to perform a rollback for. :-)

commented

It's only a roll back of this card, so it works - not the plugin, or HA :)

... and as it's a card, it doesn't even require a restart.

I know, but still not worth the effort if it's resolved automatically or with an update in a few hours. :-)

Would be nice if the card would work without public-internet dependencies though. It would prevent this type of breakage and make the card also work at "dark" sites where there's no internet connection available. (which I suspect it doesn't now)

Not sure if that's possible though. I'm not a programmer.

commented

Couldn't see anything referenced on the lit github, so opened the below:

lit/lit#4281

NPM shows an update 6 hours ago:

https://www.npmjs.com/package/lit-html

commented

Submitted a pull request to roll back the 'latest' version of lit-html, to version 2.8.

#49

same error here: Custom element doesn't exist: flower-card.
Home Assistant 2023.10.1

commented

?module
Expands all “bare” import specifiers in JavaScript modules to unpkg URLs. This feature is very experimental

source: https://www.unpkg.com

The code references 'latest' for lit-html - the version 'latest' changed to 3.0.0 earlier today. Work around, is to change back to a specific/explicit version:

  • Delete lovelace-flower-card/flower-card.js.gz
  • Edit lovelace-flower-card/flower-card.js
  • Change to:

import {unsafeHTML} from 'https://unpkg.com/lit-html@2.8.0/directives/unsafe-html.js?module';

Details in pull: fafafc2

Code should definitely not use an unversioned unpkg.com link. Even if unpkg.com worked, you could load a breaking change that you code doesn't work with.

Is there a reason this card is using unpkg and not including it's own dependencies locally?

having the same problem since this morning. will try the proposed fix later today. thank you all.

I was facing the same issue and it was almost driving me crazy as I hadn't changed something.
Never mind, the interim solution by @iMiMx solved it for me. Thanks!

same issue here. but neither the interim solution did solve it, nor installing 2.1 or any of the beta versions.

edit: I hadn't fully cleared the cache on Mac OS and iOs app - my fault. Solution from @iMiMx works for me too!

Solution from @iMiMx works for me.
Don't forget to clear the cache in browser

interim fix worked for me as well. Thanks @iMiMx for the quick turnaround.

I did install the 2023.10.3 version. Now it work but the appearance changed... Not as good looking than before

commented

Closing this issue, please open another one about any changes between the old and new version.
There could be minor differences in the styling of the card.

PRs are more than welcome.