question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HACS is not updating the "lovelace_resources" file

See original GitHub issue

Note: After some investigation, I’ve rewritten this initial post with the latest findings. You can find the original text further below.

Steps to reproduce

  1. Make sure you don’t have any lovelace entry in your configuration.yaml.
    • In other words, that means the default configuration for Lovelace.
    • This also means Lovelace dashboards are configured from the web UI.
    • If you check System Health (at /config/info), it will show the Lovelace mode as auto-gen.
  2. Go to /hacs/frontend.
  3. Click on +, search for any card.
  4. Install it.
  5. Observe it doesn’t work. No error message, no warning.
  6. Try to reinstall it. Still doesn’t work.
  7. Alternatively, find an already installed frontend card and uninstall it. Observe Lovelace will still try to load the removed JavaScript file.

No matter what combination of reboots or clearing cache, lovelace resources aren’t updated by HACS.

Reason

When there is no explicit lovelace configuration, Home Assistant will return lovelace mode as auto-gen, while behaving like storage.

Before May 2020, HACS would auto-update lovelace resources if the mode was !== "yaml". After May 2020, HACS behavior was changed to only update lovelace resources if mode was === "storage". This was done to fix some other issues.

So, you can consider this issue a REGRESSION.

Impact

Out-of-the-box, installing front-end modules through HACS is broken/incomplete: After clicking (re)install, a user would expect to have it fully installed and ready to use. However, that’s not the case anymore.

On a basic/default/empty lovelace configuration (I believe most users start out like that), HACS will no longer update lovelace resources, leading to frustration, confusion, extra manual work (which kind of defeats the purpose of HACS). This is specially confusing for users updating from an earlier version (when things “just worked”) to a later version.

Potentially related issues:

Suggestions

  • HACS could update lovelace resources even on auto-gen mode.
    • This restores the older HACS behavior, and solves this issue for me.
    • However, this may cause some other issues. I’m curious to know which other issues, and I wonder if they can be solved in a different way.
  • HACS could have a configuration option to “Update lovelace resources even on auto-gen mode”.
  • HACS could have a warning message in /hacs/frontend whenever lovelace resources and installed repositories get out-of-sync.
    • Similar to https://hacs.xyz/docs/faq/status_not_loaded.
    • Such message should have action points:
      • Either a button to fix the issue automatically (i.e. HACS would add/remove items from lovelace resources).
      • Or clear instructions on how to fix it manually. (Either by manually editing the lovelace resources, or by adding a trivial lovelace entry to configuration.yaml.)

This is the original text from this issue:

Installation details

Description Value
HACS version 1.6.2
Home Assistant version 0.117.6
Installation method for HA HassOS 4.15

Running on a Raspberry Pi. The installation is already several months old, and was “gradually” updated over time. (Well, I skipped a few versions because I forgot to update it for a couple of months; but right now it is up-to-date.)

Checklist

Describe the issue

Upon (re)installing a frontend component, HACS is not updating the lovelace_resources files, and thus the component is never available in the browser.

Steps to reproduce

  1. Go to /hacs/frontend.
  2. Click on +, search for a vacuum card.
  3. Install it.
  4. Observe it doesn’t work, try to reinstall it.

No matter how many times I do it, or if I restart Home Assistant, or if I restart the whole HassOS… The javascript file never gets added to /config/.storage/lovelace_resources.

Yes, my lovelace dashboard is custom-built. fgrep mode /config/.storage/lovelace_dashboards shows "mode": "storage" (twice, because I built two dashboards).

Some more background info

Weeks ago, I noticed that custom-header component was not available anymore, so I removed it in HACS.

However, upon restarting and observing logs, I noticed messages that Home Assistant was trying to load custom-header.js, even though it had been removed through HACS. This was likely the first sign something is wrong. I solved this by manually editing /config/.storage/lovelace_resources to remove that item. (Or maybe I asked HACS to reinstall some component, in the belief HACS would regenerate that file from scratch; I don’t remember well, it was a while ago.)

Fast-forward to today, and I try to install some vacuum cards through HACS. By looking at the files, I can see those were installed:

$ find /config -name '*vacuum*'
/config/www/community/vacuum-card
/config/www/community/vacuum-card/vacuum-card.js.gz
/config/www/community/vacuum-card/vacuum-card.js
/config/www/community/lovelace-xiaomi-vacuum-card
/config/www/community/lovelace-xiaomi-vacuum-card/xiaomi-vacuum-card.js
/config/www/community/lovelace-xiaomi-vacuum-card/vacuum.png
/config/www/community/lovelace-xiaomi-vacuum-card/xiaomi-vacuum-card.js.gz

However, they are not referenced in lovelace_resources, so the frontend doesn’t load them, so I can’t use them.

Installed frontend components and `lovelace_resources` contents
$ ls -1 /config/www/community/
light-entity-card
lovelace-auto-entities
lovelace-more-info-card
lovelace-multiple-entity-row
lovelace-paper-buttons-row
lovelace-slider-entity-row
lovelace-xiaomi-vacuum-card
mini-graph-card
mini-media-player
rgb-light-card
select-list-card
tv-card
vacuum-card

$ fgrep url /config/.storage/lovelace_resources | sed 's/^\s*//' | sort
"url": "/hacsfiles/custom-header/custom-header.js"
"url": "/hacsfiles/light-entity-card/light-entity-card.js"
"url": "/hacsfiles/lovelace-auto-entities/auto-entities.js"
"url": "/hacsfiles/lovelace-more-info-card/more-info-card.js"
"url": "/hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js"
"url": "/hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js"
"url": "/hacsfiles/lovelace-paper-buttons-row/paper-buttons-row.js"
"url": "/hacsfiles/lovelace-slider-entity-row/slider-entity-row.js"
"url": "/hacsfiles/mini-graph-card/mini-graph-card-bundle.js"
"url": "/hacsfiles/mini-media-player/mini-media-player-bundle.js"
"url": "/hacsfiles/select-list-card/select-list-card.js"

$ cat /config/.storage/lovelace_resources
{
    "version": 1,
    "key": "lovelace_resources",
    "data": {
        "items": [
            {
                "id": "928a1d5600534b639e96a039d6fa4612",
                "type": "module",
                "url": "/hacsfiles/lovelace-slider-entity-row/slider-entity-row.js"
            },
            {
                "id": "37fa1eb9f1e8430091d262f6c668b8c0",
                "type": "module",
                "url": "/hacsfiles/lovelace-paper-buttons-row/paper-buttons-row.js"
            },
            {
                "id": "95d36cf3de4749d88ecb8b9d267e25e7",
                "type": "module",
                "url": "/hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js"
            },
            {
                "id": "b40615860046426b994eaa46db3fcf46",
                "type": "module",
                "url": "/hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js"
            },
            {
                "id": "1cfc152bd7d945b88ee083dd3de17a3c",
                "type": "module",
                "url": "/hacsfiles/light-entity-card/light-entity-card.js"
            },
            {
                "id": "d4b90110dea749daa02ced43f1984796",
                "type": "module",
                "url": "/hacsfiles/mini-media-player/mini-media-player-bundle.js"
            },
            {
                "id": "4e110c7cf0824d67aeff8e389d445372",
                "type": "module",
                "url": "/hacsfiles/lovelace-auto-entities/auto-entities.js"
            },
            {
                "id": "2b5f9caea6774e62ba58b1ab8a988ddf",
                "type": "module",
                "url": "/hacsfiles/mini-graph-card/mini-graph-card-bundle.js"
            },
            {
                "id": "3359b5f383cd4398b07aa7376f3b9cff",
                "type": "module",
                "url": "/hacsfiles/lovelace-more-info-card/more-info-card.js"
            },
            {
                "id": "8bfe539e305f4123a64fced5e4713f79",
                "type": "module",
                "url": "/hacsfiles/select-list-card/select-list-card.js"
            },
            {
                "id": "3102bdc061c047a493efe6698ec8d223",
                "type": "module",
                "url": "/hacsfiles/custom-header/custom-header.js"
            }
        ]
    }
}

Now that I pay enough attention, I can see lovelace_resources is still referencing the outdated (and removed) custom-header.js, is referencing multiple-entity-row.js twice, and is not referencing a few other components. So, somehow it got completely out-of-sync with the installed components. And I don’t know why.

I’ve also read https://hacs.xyz/docs/faq/status_not_loaded, but I don’t see any “Not Loaded” message, and I’ve already tried the Reinstall trick. Also, I don’t know which YAML configuration file that page is talking about. Also also, I don’t think my lovelace is using any yaml file (fgrep lovelace /config/*.yaml returns empty).

Debug logs

JavaScript console is mostly empty (except for warning messages about animations, those are unrelated to this issue).

Backend logs were captured using:

ha core logs | fgrep hacs > logs.txt
Logs

2020-11-17 19:00:15 DEBUG (MainThread) [custom_components.hacs.data] Saving data
2020-11-17 19:00:33 DEBUG (MainThread) [custom_components.hacs.api.repository_data] Running install for denysdovhan/vacuum-card
2020-11-17 19:00:33 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:00:33 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:00:34 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running pre installation steps
2020-11-17 19:00:34 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Pre installation steps completed
2020-11-17 19:00:34 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running installation steps
2020-11-17 19:00:34 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:00:35 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:00:36 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] vacuum-card.js
2020-11-17 19:00:36 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Downloading vacuum-card.js
2020-11-17 19:00:36 DEBUG (MainThread) [custom_components.hacs.async_download_file] Downloading https://github.com/denysdovhan/vacuum-card/releases/download/v1.12.0/vacuum-card.js
2020-11-17 19:00:37 DEBUG (MainThread) [custom_components.hacs.download.save] Saving /config/www/community/vacuum-card/vacuum-card.js
2020-11-17 19:00:37 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Download of vacuum-card.js completed
2020-11-17 19:00:37 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Installation steps completed
2020-11-17 19:00:37 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running post installation steps
2020-11-17 19:00:37 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Post installation steps completed
2020-11-17 19:00:37 DEBUG (MainThread) [custom_components.hacs.data] Saving data
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-slider-entity-row/slider-entity-row.js from /config/www/community/lovelace-slider-entity-row/slider-entity-row.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-paper-buttons-row/paper-buttons-row.js from /config/www/community/lovelace-paper-buttons-row/paper-buttons-row.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-multiple-entity-row/multiple-entity-row.js from /config/www/community/lovelace-multiple-entity-row/multiple-entity-row.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-auto-entities/auto-entities.js from /config/www/community/lovelace-auto-entities/auto-entities.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving mini-media-player/mini-media-player-bundle.js from /config/www/community/mini-media-player/mini-media-player-bundle.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving light-entity-card/light-entity-card.js from /config/www/community/light-entity-card/light-entity-card.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving mini-graph-card/mini-graph-card-bundle.js from /config/www/community/mini-graph-card/mini-graph-card-bundle.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving lovelace-more-info-card/more-info-card.js from /config/www/community/lovelace-more-info-card/more-info-card.js.gz
2020-11-17 19:02:28 DEBUG (MainThread) [custom_components.hacs.web.category] Serving select-list-card/select-list-card.js from /config/www/community/select-list-card/select-list-card.js.gz
2020-11-17 19:02:28 ERROR (MainThread) [custom_components.hacs.web.category] Tried to serve up '/config/www/community/custom-header/custom-header.js' but it does not exist
2020-11-17 19:09:15 DEBUG (MainThread) [custom_components.hacs] Nothing in the queue
2020-11-17 19:09:23 DEBUG (MainThread) [custom_components.hacs.api.repository] Running uninstall for denysdovhan/vacuum-card
2020-11-17 19:09:23 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:09:23 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:09:24 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Uninstalling
2020-11-17 19:09:24 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Removing /config/www/community/vacuum-card
2020-11-17 19:09:24 DEBUG (MainThread) [custom_components.hacs.data] Saving data
2020-11-17 19:09:45 DEBUG (MainThread) [custom_components.hacs.api.repository_data] Running install for denysdovhan/vacuum-card
2020-11-17 19:09:45 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:09:45 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:09:46 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running pre installation steps
2020-11-17 19:09:46 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Pre installation steps completed
2020-11-17 19:09:46 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running installation steps
2020-11-17 19:09:46 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Getting repository information
2020-11-17 19:09:47 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running checks against v1.12.0
2020-11-17 19:09:47 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] vacuum-card.js
2020-11-17 19:09:47 DEBUG (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Downloading vacuum-card.js
2020-11-17 19:09:47 DEBUG (MainThread) [custom_components.hacs.async_download_file] Downloading https://github.com/denysdovhan/vacuum-card/releases/download/v1.12.0/vacuum-card.js
2020-11-17 19:09:48 DEBUG (MainThread) [custom_components.hacs.download.save] Saving /config/www/community/vacuum-card/vacuum-card.js
2020-11-17 19:09:48 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Download of vacuum-card.js completed
2020-11-17 19:09:48 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Installation steps completed
2020-11-17 19:09:48 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Running post installation steps
2020-11-17 19:09:48 INFO (MainThread) [custom_components.hacs.repository.plugin.denysdovhan.vacuum-card] Post installation steps completed
2020-11-17 19:09:48 DEBUG (MainThread) [custom_components.hacs.data] Saving data

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ludeeuscommented, Jan 31, 2021

Fixed in HA 2021.2.0 which is currently in beta

1reaction
denilsonsacommented, Dec 1, 2020

My current workaround is to manually add resources using Lovelace configuration UI.

Also, regarding logs, you should try getting logs from the developer tools inside your browser. First enable debug in HACS, then open the browser JavaScript console, and make sure all log messages are visible. You can also double-check the lovelace mode in /config/info.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HACS help please with lovelace elements not loaded properly
So I installed the latest HACs last night…cue many resources now not loading. It seems to be trying to find them in the...
Read more >
Status: Not Loaded - HACS
When you see this message you have one or more resources downloaded with HACS that are not properly loaded in Lovelace. To find...
Read more >
Installing Lovelace Plugins - danimart1991's Blog
Many Plugins can be installed more easily using HACS, the manual ... use the file saved in the local cache and not the...
Read more >
HACS and Mushroom and why am I having trouble? - Reddit
One thing I'd like to do is get Mushroom working via HACS. ... If you want to keep as HACS (so you can...
Read more >
Home assistant lovelace resources
All of you resources definitions (wherever they're configured) aren't correct for HACS installed files.. Lovelace Components Views The ESPHome Dashboard can ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found