Skip to content

How it works

Joakim Sørensen edited this page Mar 14, 2019 · 15 revisions

General

Since I'm lazy I will reference [cards, components, python_scripts] as element/elements here.

This uses pyupdate to handle most of its functions.

By default this component checks for updates for your elements against two files hosted on GitHub.

There is no default list for python_scripts

These lists are autogenerated by https://github.com/ludeeus/customjson, developers are welcome to add their elements to that tool, the default lists are updated once every hour, and this component checks it on startup, once every day and when you use the service custom_updater.check_all or click the CHECK button if you are using the tracker-card.

Elements not in the default list can also be tracked by adding them to the *_urls options in the config:
For this to work the developer has to make a json file you can add the URL to.

Special notes for custom_cards

In the "early days" of this component (before 4.0.0) it used a ?v=xxx tag at the end of the resources you had in your ui-lovelace.yaml file, this was done to have some sort of "control" of the file version, and it also served as a cache buster when your elements got upgraded.

From version 4.0.0 it now comes with a new endpoint /customcards that are similar to /local but without caching, local version control is also moved to .storage/custom_updater.cards.

To take advantage of this new "cacheless" endpoint you need to use that in the resource section of your lovelace configuration.

resource examples:

Old (pre 4.0.0) style:

resources:
  - url: /local/my-custom-card.js?v=0.0.3
    type: js
  - url: /local/custom-lovelace/my-custom-card.js?v=0.0.3
    type: js
  - url: /local/custom-lovelace/my-custom-card/my-custom-card.js?v=0.0.3
    type: module

New (post4.0.0) style:

resources:
  - url: /customcards/my-custom-card.js
    type: js
  - url: /customcards/custom-lovelace/my-custom-card.js
    type: js
  - url: /customcards/custom-lovelace/my-custom-card/my-custom-card.js
    type: module

So this means when you add a card to be tracked after version 4.0.0 you follow the instructions from the developer of that card, but when you get to the part where you add it to the resources you replace /local/ with /customcards/.

Note: The card should still be under www/,
/customcards/ also uses this directory to serve the files.

When you add a new card, this component will not know the version it has, but it assumes that you downloaded the latest version.

Upgrading from pre 4.0.0 and custom_cards.

First of all you should read this https://github.com/custom-components/custom_updater/releases/tag/4.0.0

The first time you start up it will not know the local version of your cards, to solve this run the service custom_updater.update_all or click the "UPDATE ALL"button if you are using the tracker-card.

The /customcards endpoint

This endpoint are designed to work with custom cards that this component track and update, but you can also use it for other things you don't want to be cached like cards in development, images, and other dynamic/semi-dynamic files.

When using this component, every item you can reference with http(s)://haurl/local/ can also be referenced as http(s)://haurl/customcards/ to skip caching of that resource.

Like with the /local endpoint the resources still need to be in the www directory (folder).

Updating

When you use this to update your elements with the service custom_udater.update_all or the "UPDATE ALL" button in the tracker-card, you need to take an extra manual step for it to take effect.

Components

If you update a component you need to restart Home Assistant.

Cards

If you update cards you need to reload the frontend (F5).

You can’t perform that action at this time.