Pārlūkot izejas kodu

Allow skipping erasing on new installations (#102)

Paulus Schoutsen 3 gadi atpakaļ
vecāks
revīzija
c0813275b0
4 mainītis faili ar 12 papildinājumiem un 1 dzēšanām
  1. 9 0
      index.html
  2. 1 0
      src/const.ts
  3. 1 1
      src/install-dialog.ts
  4. 1 0
      static/firmware_build/manifest.json

+ 9 - 0
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 <code>home_assistant_domain</code>. If present, ESP Web
         Tools will link the user to add this device to Home Assistant.
       </p>
+      <p>
+        By default a new installation will erase the entire flash. If you want
+        to skip this step, set the optional key
+        <code>new_install_skip_erase</code> to <code>true</code>. 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.
+      </p>
       <h3 id="improv">Wi-Fi provisioning</h3>
       <p>
         ESP Web Tools has support for the

+ 1 - 0
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[];
 }
 

+ 1 - 1
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);
         }
       }
     }

+ 1 - 0
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",