thomasloven / lovelace-template-entity-row

🔹 Display whatever you want in an entities card row.
MIT License
210 stars 16 forks source link

TypeError: Cannot read properties of undefined (reading 'styleSheet') #108

Closed osnwt closed 1 year ago

osnwt commented 1 year ago

Since one of past updates my dashboard stopped showing template rows. Nothing was changed/added to the configuration.

Console shows series of the following errors:

caught TypeError: Cannot read properties of undefined (reading 'styleSheet')
    at template-entity-row.js:1:4391
    at Array.map (<anonymous>)
    at template-entity-row.js:1:4352
    at Et.createRenderRoot (template-entity-row.js:1:4555)
    at Et.createRenderRoot (template-entity-row.js:1:14978)
    at Et.connectedCallback (template-entity-row.js:1:4666)
    at Et.connectedCallback (template-entity-row.js:1:15564)
    at M.S (lit-html.ts:1402:53)
    at M.T (lit-html.ts:1445:36)
    at M.$ (lit-html.ts:1551:12)

Interesting, sometimes it still shows all, and no such errors logged. But most of the time it does not work.

Tested with MacOS Safari and MacOS Chrome - exactly the same issue.

Do you have any ideas why it can misbehave? If not, I should try to bisect versions and try to find the one caused this change. But maybe it's something already known.

All cards installed as modules:

frontend:
  extra_module_url:
    - /hacsfiles/lovelace-auto-entities/auto-entities.js
    - /hacsfiles/lovelace-card-mod/card-mod.js
    - /hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js
    - /hacsfiles/lovelace-template-entity-row/template-entity-row.js

In Safari: image

ildar170975 commented 1 year ago

Post a minimal test card where you faced the issue.

osnwt commented 1 year ago
type: entities
entities:
  - type: custom:template-entity-row
    entity: input_number.health_charge_threshold
ildar170975 commented 1 year ago

I see no issues (Chrome, Win10):

image

Works in iOS Companion App as well. Cannot test in Safari.

Not sure this is a correct way:

frontend:
  extra_module_url:
    ...
    - /hacsfiles/lovelace-template-entity-row/template-entity-row.js
osnwt commented 1 year ago

I saw neither until some update. Well, it seem the only way is to try on a fresh system.

As for the correct installation way, it was taken from here: https://github.com/thomasloven/lovelace-template-entity-row

image

Then from here: https://github.com/thomasloven/lovelace-card-mod#installing

image

Would be great to update the manual where it suggests to install it as a module, but below shows an example of installation as a resource.

ildar170975 commented 1 year ago

Then from here: https://github.com/thomasloven/lovelace-card-mod#installing

That was about card-mod.

Btw, I myself using HACS, no issues...

osnwt commented 1 year ago

But that was also about "installing as a module", no?

And this worked few months with no issues.

thomasloven commented 1 year ago

As for the correct installation way, it was taken from here: https://github.com/thomasloven/lovelace-template-entity-row

image

That's a different thing https://www.home-assistant.io/dashboards/dashboards/#resources

osnwt commented 1 year ago

Wow, it was a bit confusing due to different configs where both refer to a "module":

lovelace:
  resources:
    - url: /hacsfiles/lovelace-template-entity-row/template-entity-row.js
      type: module

frontend:
  extra_module_url:
    - /hacsfiles/lovelace-card-mod/card-mod.js

But after changing like above, everything now works!

Thanks a lot!