Skip to content

Add an API endpoint for upstream update URL retrieval #4470

Open
@fonix232

Description

@fonix232

Is your feature request related to a problem? Please describe.

With all the usermods floating around, it's getting harder and harder to track which specific build one needs and how one can check if there are updates. Many clients (incl. wled-native, the Home Assistant integration, or anyone utilising libraries like Frenck's python-wled) have now built-in update pathways, however these are currently hard-coded to using the main repo - not exactly optimal to have HA or wled-native prompt you to update your device to a potentially incompatible build. An example would be my neat little 64^2 HUB75 matrix for which I'm using an Adafruit MatrixPortal S3, and the MoonModules fork that supports the protocol - which is still on 0.14.5, yet I'm getting constantly notified that there's an update.

Describe the solution you'd like

Add a simple API endpoint that returns a hardcoded value set during compilation, so that forks can provide their own GitHub address, which in turn can be used to check for new releases and updates.

Describe alternatives you've considered

I initially thought of adding fork detection + hardcoded update paths to the clients themselves, however upon seeing frenck/python-wled#1597 (which, based on Frenck's comments, I believe was the same core idea as mine), I realised that that idea pushes the responsibility of maintenance of the client developers. By having the firmware+device combo be able to tell "hey I'm this fork, and you can find updates for me [here]", this issue is alleviated, and is the superior solution.

Additional context

Obviously this would be a change that needs to propagate to the forks and would only become useful once widely adopted - therefore I think the sooner this gets pushed to main, the better.

On the technical side, this is a relatively straightforward thing to add, with the following steps:

  1. Create a new const (say, WLED_OTA_REPO)
  2. Assign a value to this const during the build process using build flags, otherwise leave it as an empty string.
  3. in wled00/json.cpp's serializeInfo method, add a new entry to the root JSON object:
root[F("ota_repo")] = F(WLED_OTA_REPO);

And from this point on, any client library can utilise this field's value to check for OTA updates instead of relying on hardcoded URLs.

Caveats:

  • all usermod builds/forks need to implement this step in their build process
  • all clients need to transition to this approach while also keeping the legacy way of hardcoded base URL
  • the above two means this change needs to be well communicated to all parties affected
  • this would only support public GitHub projects as an update source

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions