nathanmarlor / foxess_modbus_charge_period_card

Custom Home Assistant Cards for the FoxESS Modbus Integration
MIT License
10 stars 1 forks source link

Card not available for setup in Dashboard #6

Closed screenagerbe closed 11 months ago

screenagerbe commented 11 months ago

Version of the custom_component

v1.0.0 HA 2023.8.1 (did not work on 2023.7.x)

Configuration

Installed it through HACS as described in the README

Describe the bug

The integration is installed via HACS without errors, but the card is just not available when trying to add a new card to any dashboard. I don't see the card, and I don't have a pop-up asking which inverter to add.

Debug log

There is nothing ๐Ÿคทโ€โ™‚๏ธ

screenagerbe commented 11 months ago

FYI, I managed to configure it once on a dev device running HAOS, but now it says image

canton7 commented 11 months ago

Does /config/www/foxess-modbus-charge-period-card.js exist?

Did you click the button to reload the UI when prompted by hacs?

screenagerbe commented 11 months ago

No not really. Unless you mean /config/www/community/foxess-modbus-charge-period-card/foxess-modbus-charge-period-card.js

yes HA was reloaded, restarted and has even been updated too

canton7 commented 11 months ago

If you navigate to HACS on the sidebar, do you see this message?

https://hacs.xyz/docs/faq/status_not_loaded/

canton7 commented 11 months ago

(I managed to reproduce what I think is the issue you're seeing, and saw that message. Going to the 3 dots -> redownload fixed it)

screenagerbe commented 11 months ago

Everything looks OK in HACS, I don't see the "not loaded error", seen it before in other integrations, never in this though. I have redownloaded the integration several times, to no avail

I have currently 3 HA systems running, and all three of them are having issues with the integration. As other users do not encounter these issues I'm starting to think it might have something to do with my FoxESS - Modbus setup

canton7 commented 11 months ago

I'm starting to think it might have something to do with my FoxESS - Modbus setup

No, the card is entirely independent of foxess-modbus, up to the point where it's up and running and tries to read your charge periods.

Are you using a custom ui-lovelace.yaml file by any chance?

canton7 commented 11 months ago

Are you able to install (and use) any other lovelace cards through HACS?

Do you get any errors in the Console of your browser's developer tools when trying to add the charge period card to a dashboard?

screenagerbe commented 11 months ago

Ok, that last tip gave it away It looks like you're side loading js from an external domain? image

Once I allowed unpkg.com in NoScript it started working. Not sure if I like this setup though, because the side loaded js needs to be enabled to have a usable card at all, not only for configuration ๐Ÿค”๐Ÿคจ

canton7 commented 11 months ago

My options are basically:

  1. Have a single vanilla JS file in the repo, which imports Lit from unpkg (which is what the hass docs do)
  2. Set up a whole JS packaging pipeline which bundles together Lit and this card, and commit the minified results to the repo (because HACS can't handle loading custom cards from release artifacts)

I wouldn't call it sideloading: loading a common library from a CDN is fairly standard practice (although admittedly it's less in fashion today than it was a few years ago)

screenagerbe commented 11 months ago

It still is a fairly common practice on websites, but I'm using NoScript for a reason ๐Ÿ˜… It also means it'll stop working once your internet connection goes down (and you refresh your browser).

I can always clone this repo and add the whole JS packaging. Need to think about that one. ๐Ÿ˜

canton7 commented 11 months ago

Looks like HACS does support using release assets, so I'll get this change in.