Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Manifest creation on the fly #498

Open
lost-hope opened this issue Apr 11, 2024 · 3 comments
Open

Custom Manifest creation on the fly #498

lost-hope opened this issue Apr 11, 2024 · 3 comments

Comments

@lost-hope
Copy link

Hello,
i am currently looking into rebuilding a webinstaller where i would like to have the user select the flash size and some other options that would result in a high number of possible combinations and thus manifest files.

While looking around in the issues, i found this reply (#469 (comment) ) by @balloob.

In my opinion i would be able to craft a manifest string based on the User input, but i cant write that to a file and provide that to the install button.

Is there a way around that, or does this need more development in the install scripts?

@lost-hope
Copy link
Author

lost-hope commented Apr 13, 2024

i have looked into this a bit. with a small change in the install dialog script this is possible.
but my implementation will break the current manifest file method. there might be a way to use a if statement to filter between them.
Is there a technical reason why the code is minified? Ok can answer myself after some research. It can improve performance

@velijv
Copy link

velijv commented Jul 11, 2024

https://veli.ee/esphome/ota.manifest.json?name=TX-Ultimate&chip=esp32&summary=Cool-new-colors&v=1234

  • name
  • chip type
  • summary
  • version (can be omitted, takes from date)
  • automatic path generation (based on my preferences, open to discussion)
  • automatic MD5 checking based on BIN file if found
  • to be open sourced if i clean up the file

ex:

{
    "name": "re5v1c",
    "version": "123",
    "home_assistant_domain": "esphome",
    "builds": [
        {
            "chipFamily": "ESP8266",
            "ota": {
                "md5": "f5fb10347f29d944897db09975b39f29",
                "path": "http://homeassistant.local:8123/local/ota/re5v1c/firmware.ota.bin",
                "release_url": "http://re5v1c.local",
                "summary": "re5v1c has a new Update"
            },
            "parts": [
                {
                    "path": "http://homeassistant.local:8123/local/ota/re5v1c/firmware.factory.bin",
                    "offset": 0
                }
            ]
        }
    ]
}

@pbolduc
Copy link

pbolduc commented Sep 24, 2024

I think a simple way of handling this would be to make manifest property be either a string or a Promise that returns a Manifest.

https://github.com/esphome/esp-web-tools/blob/b7b4b5beba5a496fa4ff29a0df2659364fd57344/src/install-button.ts#L55C3-L55C28

From:

public manifest?: string;

To:

public manifest?: string | Promise<Manifest>;

or

public manifest?: string;
public manifestResolver?: Promise<Manifest>;

If the value is a string, then it would refer to the path to fetch the manifest like it does now. If the value is a Promise , then it await the promise and the resulting should return the manifest value. Alternatively, another property could be added that would return the manifest such as manifestFactory manifestProvider manifestResolver, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants