From c0813275b05665f81ff1d5928cddd286b95e77aa Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 10 Nov 2021 20:02:19 -0800 Subject: [PATCH] Allow skipping erasing on new installations (#102) --- index.html | 9 +++++++++ src/const.ts | 1 + src/install-dialog.ts | 2 +- static/firmware_build/manifest.json | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index c291b72..b145902 100644 --- a/index.html +++ b/index.html @@ -267,6 +267,7 @@ "name": "ESPHome", "version": "2021.11.0", "home_assistant_domain": "esphome", + "new_install_skip_erase": false, "builds": [ { "chipFamily": "ESP32", @@ -297,6 +298,14 @@ optional key home_assistant_domain. If present, ESP Web Tools will link the user to add this device to Home Assistant.

+

+ By default a new installation will erase the entire flash. If you want + to skip this step, set the optional key + new_install_skip_erase to true. ESP Web Tools + considers it a new installation if it is unable to detect the current + firmware of the device (via Improv Serial) or if the detected firmware + does not match the name specififed in the manifest. +

Wi-Fi provisioning

ESP Web Tools has support for the diff --git a/src/const.ts b/src/const.ts index b9eb4d1..985d1b4 100644 --- a/src/const.ts +++ b/src/const.ts @@ -16,6 +16,7 @@ export interface Manifest { name: string; version: string; home_assistant_domain?: string; + new_install_skip_erase?: boolean; builds: Build[]; } diff --git a/src/install-dialog.ts b/src/install-dialog.ts index 04250e8..c759e1c 100644 --- a/src/install-dialog.ts +++ b/src/install-dialog.ts @@ -580,7 +580,7 @@ class EwtInstallDialog extends LitElement { // When it can't detect improv (ie because install failed) // We shouldn't reset settings but instead show the error if (this._state !== "INSTALL") { - this._startInstall(true); + this._startInstall(!this._manifest.new_install_skip_erase); } } } diff --git a/static/firmware_build/manifest.json b/static/firmware_build/manifest.json index d0b205b..e6afdc4 100644 --- a/static/firmware_build/manifest.json +++ b/static/firmware_build/manifest.json @@ -2,6 +2,7 @@ "name": "ESPHome", "version": "2021.11.0-dev", "home_assistant_domain": "esphome", + "new_install_skip_erase": true, "builds": [ { "chipFamily": "ESP32",