1
0

index.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <html>
  2. <head>
  3. <title>ESP Web Tools</title>
  4. <style>
  5. body {
  6. font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI",
  7. Roboto, Ubuntu, sans-serif;
  8. padding: 0;
  9. margin: 0;
  10. line-height: 1.4;
  11. }
  12. .content {
  13. max-width: 600px;
  14. margin: 0 auto;
  15. padding: 12px;
  16. }
  17. esp-web-flash-log {
  18. margin-top: 8px;
  19. }
  20. a {
  21. color: #03a9f4;
  22. }
  23. .footer {
  24. margin-top: 24px;
  25. border-top: 1px solid #ccc;
  26. padding-top: 24px;
  27. text-align: center;
  28. }
  29. .footer .initiative {
  30. font-style: italic;
  31. margin-top: 16px;
  32. }
  33. </style>
  34. <script module>
  35. import(
  36. // In development we import locally.
  37. window.location.hostname === "localhost"
  38. ? "/dist/web/install-button.js"
  39. : "https://unpkg.com/esp-web-tools@2.0.1/dist/web/install-button.js?module"
  40. );
  41. </script>
  42. </head>
  43. <body>
  44. <div class="content">
  45. <h1>ESP Web Tools</h1>
  46. <p>
  47. ESP Web Tools is a set of open source tools to allow working with ESP
  48. devices in the browser.
  49. <a href="https://github.com/esphome/esp-web-tools"
  50. >The code is available on GitHub.</a
  51. >
  52. </p>
  53. <p>
  54. To try it out and install
  55. <a href="https://esphome.io">the ESPHome firmware</a>, connect an ESP to
  56. your computer and hit the button:
  57. </p>
  58. <esp-web-install-button
  59. erase-first
  60. manifest="firmware_build/manifest.json"
  61. ></esp-web-install-button>
  62. <p>
  63. <i>
  64. Note, this only works in desktop Chrome and Edge. Android support
  65. should be possible but has not been implemented yet.
  66. </i>
  67. </p>
  68. <p>
  69. This works by combining
  70. <a
  71. href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API"
  72. >Web Serial</a
  73. >
  74. with a manifest which describes the firmware. It will automatically
  75. detect the type of the connected ESP device and find the right firmware
  76. files in the manifest.
  77. </p>
  78. <h2>Using ESP Web Tools on your website</h2>
  79. <p>
  80. To add this to your own website, create a manifest and add the button to
  81. your website. Make sure you update the manifest attribute to point at
  82. your manifest.
  83. </p>
  84. <pre>
  85. &lt;script
  86. type="module"
  87. src="https://unpkg.com/esp-web-tools@1.0.3/dist/web/install-button.js?module"
  88. >&lt;/script>
  89. &lt;esp-web-install-button
  90. manifest="firmware_build/manifest.json"
  91. >&lt;/esp-web-install-button></pre
  92. >
  93. <p>
  94. Your website needs to be served over <code>https://</code>. If your
  95. manifest is hosted on another server, make sure you configure
  96. <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS"
  97. >the CORS-headers</a
  98. >
  99. for your manifest and firmware files such that your website is allowed
  100. to fetch those files by adding the header
  101. <code
  102. >Access-Control-Allow-Origin: https://domain-of-your-website.com</code
  103. >.
  104. </p>
  105. <p>
  106. Add the attribute <code>erase-first</code> if you want to first fully
  107. erase the ESP prior to installation.
  108. </p>
  109. <p>
  110. ESP Web Tools can also be integrated in your projects by installing it
  111. via NPM:<br />
  112. <code>npm install --save esp-web-tools</code>
  113. </p>
  114. <h3 id="manifest">Creating your manifest</h3>
  115. <p>
  116. ESP Web Tools manifest describe the firmware that you want to install.
  117. It allows specifying different builds for the different types of ESP
  118. devices. Current supported devices are ESP8266, ESP32 and ESP32-S2. The
  119. correct build will be automatically selected based on the type of the
  120. ESP device we detect via the serial port.
  121. </p>
  122. <pre>
  123. {
  124. "name": "ESPHome",
  125. "builds": [
  126. {
  127. "chipFamily": "ESP32",
  128. "improv": true,
  129. "parts": [
  130. { "path": "bootloader.bin", "offset": 4096 },
  131. { "path": "partitions.bin", "offset": 32768 },
  132. { "path": "ota.bin", "offset": 57344 },
  133. { "path": "firmware.bin", "offset": 65536 }
  134. ]
  135. },
  136. {
  137. "chipFamily": "ESP8266",
  138. "parts": [
  139. { "path": "esp8266.bin", "offset": 0 }
  140. ]
  141. }
  142. ]
  143. }</pre
  144. >
  145. <p>
  146. Each build contains a list of parts to be flashed to the ESP device.
  147. Each part consists of a path to the file and an offset on the flash
  148. where it should be installed. Part paths are resolved relative to the
  149. path of the manifest, but can also be URLs to other hosts.
  150. </p>
  151. <p>
  152. Each build also allows you to specify if it supports
  153. <a href="https://www.improv-wifi.com">the Improv WiFi standard</a>. If
  154. it does, the user will be offered to configure the WiFi after flashing
  155. is done.
  156. </p>
  157. <h3>Customizing the look and feel</h3>
  158. <p>
  159. You can customize both the activation button and the message that is
  160. shown when the user uses an unsupported browser. This can be done using
  161. the <code>activate</code> and <code>unsupported</code> slots:
  162. </p>
  163. <pre>
  164. &lt;esp-web-install-button
  165. manifest="firmware_build/manifest.json"
  166. erase-first
  167. >
  168. &lt;button slot="activate">Custom install button&lt;/button>
  169. &lt;span slot="unsupported">Ah snap, your browser doesn't work!&lt;/span>
  170. &lt;/esp-web-install-button>
  171. </pre
  172. >
  173. <div class="footer">
  174. <div>
  175. ESP Web Tools –
  176. <a href="https://github.com/esphome/esp-web-tools">GitHub</a>
  177. </div>
  178. <div class="initiative">
  179. ESP Web Tools is a project by
  180. <a href="https://esphome.io">ESPHome</a>.<br />
  181. Development is funded by
  182. <a href="https://www.nabucasa.com">Nabu Casa</a>.
  183. </div>
  184. </div>
  185. </div>
  186. </body>
  187. </html>