index.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <html>
  2. <head>
  3. <meta charset="utf-8" />
  4. <title>ESP Web Tools</title>
  5. <meta name="viewport" content="width=device-width" />
  6. <meta
  7. name="description"
  8. content="Easily allow users to flash new firmware for their ESP-devices on the web."
  9. />
  10. <style>
  11. body {
  12. font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI",
  13. Roboto, Ubuntu, sans-serif;
  14. padding: 0;
  15. margin: 0;
  16. line-height: 1.4;
  17. }
  18. .content {
  19. max-width: 600px;
  20. margin: 0 auto;
  21. padding: 12px;
  22. }
  23. .project .logo {
  24. float: right;
  25. width: 200px;
  26. }
  27. .project .logo img {
  28. width: 100%;
  29. }
  30. esp-web-flash-log {
  31. margin-top: 8px;
  32. }
  33. a {
  34. color: #03a9f4;
  35. }
  36. .videoWrapper {
  37. position: relative;
  38. padding-bottom: 56.25%; /* 16:9 */
  39. height: 0;
  40. margin-bottom: 25px;
  41. background: #000;
  42. }
  43. .videoWrapper iframe {
  44. position: absolute;
  45. top: 0;
  46. left: 0;
  47. width: 100%;
  48. height: 100%;
  49. }
  50. .content pre {
  51. max-width: 100%;
  52. overflow-y: scroll;
  53. }
  54. .footer {
  55. margin-top: 24px;
  56. border-top: 1px solid #ccc;
  57. padding-top: 24px;
  58. text-align: center;
  59. }
  60. .footer .initiative {
  61. font-style: italic;
  62. margin-top: 16px;
  63. }
  64. </style>
  65. <script module>
  66. import(
  67. // In development we import locally.
  68. window.location.hostname === "localhost"
  69. ? "/dist/web/install-button.js"
  70. : "https://unpkg.com/esp-web-tools@2.0.2/dist/web/install-button.js?module"
  71. );
  72. </script>
  73. </head>
  74. <body>
  75. <div class="content">
  76. <h1>ESP Web Tools</h1>
  77. <p>
  78. ESP Web Tools is a set of open source tools to allow working with ESP
  79. devices in the browser.
  80. <a href="https://github.com/esphome/esp-web-tools"
  81. >The code is available on GitHub.</a
  82. >
  83. </p>
  84. <p>
  85. To try it out and install
  86. <a href="https://esphome.io">the ESPHome firmware</a>, connect an ESP to
  87. your computer and hit the button:
  88. </p>
  89. <esp-web-install-button
  90. erase-first
  91. manifest="static/firmware_build/manifest.json"
  92. ></esp-web-install-button>
  93. <p>
  94. <i>
  95. Note, this only works in desktop Chrome and Edge. Android support
  96. should be possible but has not been implemented yet.
  97. </i>
  98. </p>
  99. <p>
  100. This works by combining
  101. <a
  102. href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API"
  103. >Web Serial</a
  104. >
  105. with a manifest which describes the firmware. It will automatically
  106. detect the type of the connected ESP device and find the right firmware
  107. files in the manifest.
  108. </p>
  109. <div class="videoWrapper">
  110. <iframe
  111. width="560"
  112. height="315"
  113. src="https://www.youtube-nocookie.com/embed/jGfa0xMhUn4"
  114. title="YouTube video player"
  115. frameborder="0"
  116. allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  117. allowfullscreen
  118. ></iframe>
  119. </div>
  120. <h2>Projects using ESP Web Tools</h2>
  121. <div class="project">
  122. <div class="logo">
  123. <img src="static/wled.png" alt="WLED logo" />
  124. </div>
  125. <h3>WLED</h3>
  126. <p>
  127. A fast and feature-rich implementation of an ESP8266/ESP32 firmware to
  128. control NeoPixel (WS2812B, WS2811, SK6812) LEDs or also SPI based
  129. chipsets like the WS2801 and APA102.
  130. </p>
  131. <p>
  132. <a href="https://flash.wled.me" target="_blank"
  133. >Installation Website</a
  134. >
  135. </p>
  136. </div>
  137. <h2>Adding ESP Web Tools to your website</h2>
  138. <p>
  139. To add this to your own website, create a manifest and add the button to
  140. your website. Make sure you update the manifest attribute to point at
  141. your manifest.
  142. </p>
  143. <p>
  144. You can import ESP Web Tools directly from the unpkg CDN or
  145. <a href="https://unpkg.com/browse/esp-web-tools/dist/web/"
  146. >download the files</a
  147. >
  148. and put them on your website.
  149. </p>
  150. <pre>
  151. &lt;script
  152. type="module"
  153. src="https://unpkg.com/esp-web-tools@2.0.2/dist/web/install-button.js?module"
  154. >&lt;/script>
  155. &lt;esp-web-install-button
  156. manifest="static/firmware_build/manifest.json"
  157. >&lt;/esp-web-install-button></pre
  158. >
  159. <p>
  160. Your website needs to be served over <code>https://</code>. If your
  161. manifest is hosted on another server, make sure you configure
  162. <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS"
  163. >the CORS-headers</a
  164. >
  165. for your manifest and firmware files such that your website is allowed
  166. to fetch those files by adding the header
  167. <code
  168. >Access-Control-Allow-Origin: https://domain-of-your-website.com</code
  169. >.
  170. </p>
  171. <p>
  172. Add the attribute <code>erase-first</code> if you want to first fully
  173. erase the ESP prior to installation.
  174. </p>
  175. <p>
  176. ESP Web Tools can also be integrated in your projects by installing it
  177. via NPM:<br />
  178. <code>npm install --save esp-web-tools</code>
  179. </p>
  180. <h3 id="manifest">Creating your manifest</h3>
  181. <p>
  182. ESP Web Tools manifest describe the firmware that you want to install.
  183. It allows specifying different builds for the different types of ESP
  184. devices. Current supported devices are ESP8266, ESP32 and ESP32-S2. The
  185. correct build will be automatically selected based on the type of the
  186. ESP device we detect via the serial port.
  187. </p>
  188. <pre>
  189. {
  190. "name": "ESPHome",
  191. "builds": [
  192. {
  193. "chipFamily": "ESP32",
  194. "improv": true,
  195. "parts": [
  196. { "path": "bootloader.bin", "offset": 4096 },
  197. { "path": "partitions.bin", "offset": 32768 },
  198. { "path": "ota.bin", "offset": 57344 },
  199. { "path": "firmware.bin", "offset": 65536 }
  200. ]
  201. },
  202. {
  203. "chipFamily": "ESP8266",
  204. "parts": [
  205. { "path": "esp8266.bin", "offset": 0 }
  206. ]
  207. }
  208. ]
  209. }</pre
  210. >
  211. <p>
  212. Each build contains a list of parts to be flashed to the ESP device.
  213. Each part consists of a path to the file and an offset on the flash
  214. where it should be installed. Part paths are resolved relative to the
  215. path of the manifest, but can also be URLs to other hosts.
  216. </p>
  217. <p>
  218. Each build also allows you to specify if it supports
  219. <a href="https://www.improv-wifi.com">the Improv WiFi standard</a>. If
  220. it does, the user will be offered to configure the WiFi after
  221. installation is done as can be seen in the video below.
  222. </p>
  223. <div class="videoWrapper">
  224. <iframe
  225. width="560"
  226. height="315"
  227. src="https://www.youtube-nocookie.com/embed/jGfa0xMhUn4?start=186"
  228. title="YouTube video player"
  229. frameborder="0"
  230. allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  231. allowfullscreen
  232. ></iframe>
  233. </div>
  234. <h3>Customizing the look and feel</h3>
  235. <p>
  236. You can customize both the activation button and the message that is
  237. shown when the user uses an unsupported browser. This can be done using
  238. the <code>activate</code> and <code>unsupported</code> slots:
  239. </p>
  240. <pre>
  241. &lt;esp-web-install-button
  242. manifest="static/firmware_build/manifest.json"
  243. erase-first
  244. >
  245. &lt;button slot="activate">Custom install button&lt;/button>
  246. &lt;span slot="unsupported">Ah snap, your browser doesn't work!&lt;/span>
  247. &lt;/esp-web-install-button>
  248. </pre
  249. >
  250. <div class="footer">
  251. <div>
  252. ESP Web Tools –
  253. <a href="https://github.com/esphome/esp-web-tools">GitHub</a>
  254. </div>
  255. <div class="initiative">
  256. ESP Web Tools is a project by
  257. <a href="https://esphome.io">ESPHome</a>.<br />
  258. Development is funded by
  259. <a href="https://www.nabucasa.com">Nabu Casa</a>.
  260. </div>
  261. </div>
  262. </div>
  263. </body>
  264. </html>