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

Can't get it working with Home Assistant Cast #29

Closed
rubenni opened this issue Dec 1, 2021 · 4 comments
Closed

Can't get it working with Home Assistant Cast #29

rubenni opened this issue Dec 1, 2021 · 4 comments
Labels
bug Something isn't working possible fixed Fix has been applied. No confirmation from the community yet.

Comments

@rubenni
Copy link

rubenni commented Dec 1, 2021

Hello!
Thank you for this good-looking card! But as the title states, I got a little issue with it. I can't get it working using Home Assistant Cast on my Nest Hub 2. Looking at the FAQ of Home Assistant Cast, it states that the most common mistake is that the LitElement is extracted from an element that is not available on the page. I got a lot of other custom cards working on the Nest Hub like the custom button card. So I guess it should be possible.

Would someone mind taking a look? If someone needs help with testing, you can contact me!

Regards!

@aex351 aex351 added the bug Something isn't working label Dec 1, 2021
@aex351
Copy link
Owner

aex351 commented Dec 3, 2021

Home Assistant does not provide a mechanism for custom integrations to use the already present Lit-element package. This means custom integrations have 2 options. 1) Embed the Lit-Element package within the custom integration (massive overhead) or load the Lit-element package from an external URL (massive overhead and requires internet connectivity) or 2) Use the already present Lit-element that is bundled and used within Home Assistant. This is formally not supported by Home Assistant, because of how things are loaded internally and that they probably don't want to maintain such dependencies.

The Neerslag Card uses option 2. It uses the Lit-element package that is bundled with Home Assistant. This option will only work if certain official Home Assistant elements are being rendered on your screen.

It seems the Home Assistant Cast integration is not loading the required elements or these elements are not accessible by the Neerslag Card. I will need to do a bit of research to see if option 2 can be continued. Otherwise the Neerslag Card needs to switch to option 1. This will increase the overhead, however at the same time it will make the Neerslag Card more robust as it isn't depended on Home Assistant anymore for Lit-element.

@rubenni
Copy link
Author

rubenni commented Dec 3, 2021

Thank you for the quick reply and extensive explanation! If you got a beta version or think it's fixed (or know a way to fix the issue), I'm here to try it out and test it. Due to a lack of time atm, I won't be able to check out the code myself...

aex351 added a commit that referenced this issue Jan 30, 2022
The Neerslag Card will now import LitElement from unpkg (external site). This removes the dependency with Home Assistant.
@aex351
Copy link
Owner

aex351 commented Jan 30, 2022

LitElement is now being imported from a CDN (unpkg.com). This should resolve the issue with Home Assistant Cast as there is no longer a dependency on internal Home Assistant components. This is also one of the recommended methods in the developer document of Home Assistant for using LitElement.

@rubenni
Copy link
Author

rubenni commented Jan 30, 2022

LitElement is now being imported from a CDN (unpkg.com). This should resolve the issue with Home Assistant Cast as there is no longer a dependency on internal Home Assistant components. This is also one of the recommended methods in the developer document of Home Assistant for using LitElement.

Yes, I just tested it and the issue is resolved. Thank you!

@rubenni rubenni closed this as completed Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working possible fixed Fix has been applied. No confirmation from the community yet.
Projects
None yet
Development

No branches or pull requests

2 participants