Hypfer / lovelace-valetudo-map-card

Display the map from a valetudo-enabled robot in a home assistant dashboard card.
MIT License
243 stars 36 forks source link

Registering of custom javascript resources broken #123

Closed salim-b closed 2 years ago

salim-b commented 2 years ago

Obviously, registering of the custom javascript resource valetudo-map-card.js is currently broken.

I'm using the latest Home Assistant OS, the latest Valetudo, successfully set up MQTT, and installed the Lovelace Valetudo Map Card via the recommended HACS way.

I'm pretty new to Home Assistant, so I lack the knowledge to fully understand where registering fails. I guess it's due to a wrong path/URL. In the README it currently says the url to the JS file would be /community_plugin/lovelace-valetudo-map-card/valetudo-map-card.js while it actually should be /local/community/lovelace-valetudo-map-card/valetudo-map-card.js.

The exact same issue was reported on the Home Assistant Community Forum almost two years ago (which irritates me a bit)...

TheLastProject commented 2 years ago

Obviously

Why obviously?

I'm pretty new to Home Assistant, so I lack the knowledge to fully understand where registering fails. I guess it's due to a wrong path/URL. In the README it currently says the url to the JS file would be /community_plugin/lovelace-valetudo-map-card/valetudo-map-card.js while it actually should be /local/community/lovelace-valetudo-map-card/valetudo-map-card.js.

Oh, interesting. Feel free to make a MR to update the documentation or I will do it after work if I don't forget.

The exact same issue was reported on the Home Assistant Community Forum almost two years ago (which irritates me a bit)...

Agreed there, it irritates me too that for 2 years nobody bothered to tell me it was broken. The documentation could've been fixed quite quickly.

TheLastProject commented 2 years ago

Actually, I'm pretty sure you misread the documentation.

You say you're using HACS and then you talk about manually setting up the resources but the README states:

  1. It is highly recommended to use HACS for managing custom extensions of Home Assistant. It automatically manages the registration of additional resources required by custom cards and makes it easy to keep them up-to-date.
  2. When using HACS there is no need to manually make Home Assistant aware of custom javascript resources of this custom card.
  3. On older versions you may need to add this to the lovelace configuration yaml manually.

I'll probably just remove this section because I don't use the manual method and given the dashboard location changed it's pretty obvious nobody who uses the manual method cares to keep the instructions up-to-date.

salim-b commented 2 years ago

Why obviously?

Because after installing the card via HACS, the necessary resource was not registered automatically.

I searched a bit and it turns out the issue was that Lovelace was in auto-gen mode (the default after a new installation) and HACS only registers custom resources when Lovelace is in storage mode. See https://github.com/hacs/integration/issues/1659 for the full technical discussion or this thread on the community forum.

Actually, I'm pretty sure you misread the documentation.

Nope. It was outdated. I've updated it in #124. 🙂

TheLastProject commented 2 years ago

You're changing the manual installation instructions (which you shouldn't be running when using HACS) to HACS bugfixing instructions but... that could work.

What a weird HACS issue though...

salim-b commented 2 years ago

Well, as far as I understood, HACS devs don't consider this issue (not auto-registering custom resources when Lovelace is in auto-gen mode) a bug. Thus they won't fix it. So I tried to adapt the README enough to avoid further confusion/frustration for future users. Hopefully it'll work and you don't have to waste time with more issue reports like this one... 🤞😉