1
0

index.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>ESP Web Tools</title>
  6. <meta
  7. name="description"
  8. content="Easily allow users to flash new firmware for their ESP-devices on the web."
  9. />
  10. <meta name="viewport" content="width=device-width" />
  11. <meta property="og:title" content="ESP Web Tools" />
  12. <meta property="og:site_name" content="ESP Web Tools" />
  13. <meta
  14. property="og:url"
  15. content="https://esphome.github.io/esp-web-tools/"
  16. />
  17. <meta property="og:type" content="website" />
  18. <meta
  19. property="og:description"
  20. content="Easily allow users to flash new firmware for their ESP-devices on the web."
  21. />
  22. <meta
  23. property="og:image"
  24. content="https://esphome.github.io/esp-web-tools/static/social.png"
  25. />
  26. <meta name="twitter:card" content="summary_large_image" />
  27. <meta name="twitter:title" content="ESP Web Tools" />
  28. <meta
  29. name="twitter:description"
  30. content="Easily allow users to flash new firmware for their ESP-devices on the web."
  31. />
  32. <meta
  33. name="twitter:image"
  34. content="https://esphome.github.io/esp-web-tools/static/social.png"
  35. />
  36. <meta name="color-scheme" content="dark light" />
  37. <style>
  38. body {
  39. font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI",
  40. Roboto, Ubuntu, sans-serif;
  41. padding: 0;
  42. margin: 0;
  43. line-height: 1.4;
  44. }
  45. .content {
  46. max-width: 600px;
  47. margin: 0 auto;
  48. padding: 12px;
  49. }
  50. h2 {
  51. margin-top: 2em;
  52. }
  53. h3 {
  54. margin-top: 1.5em;
  55. }
  56. .projects {
  57. display: flex;
  58. text-align: center;
  59. flex-wrap: wrap;
  60. gap: 24px;
  61. justify-content: center;
  62. }
  63. .projects a {
  64. color: initial;
  65. text-decoration: none;
  66. }
  67. .project .logo img {
  68. height: 50px;
  69. }
  70. .project .name {
  71. margin-top: 8px;
  72. }
  73. a {
  74. color: #03a9f4;
  75. }
  76. .screenshot {
  77. text-align: center;
  78. }
  79. .screenshot img {
  80. max-width: 100%;
  81. box-shadow: rgb(0 0 0 / 20%) 0px 2px 1px -1px,
  82. rgb(0 0 0 / 14%) 0px 1px 1px 0px, rgb(0 0 0 / 12%) 0px 1px 3px 0px;
  83. border-radius: 4px;
  84. }
  85. .screenshot i {
  86. margin-top: 4px;
  87. display: block;
  88. }
  89. .videoWrapper {
  90. position: relative;
  91. padding-bottom: 56.25%; /* 16:9 */
  92. height: 0;
  93. margin-bottom: 25px;
  94. background: #ccc;
  95. }
  96. .hidden {
  97. display: none;
  98. }
  99. .content pre {
  100. display: block;
  101. padding-left: 8px;
  102. overflow-y: scroll;
  103. }
  104. .footer {
  105. margin-top: 24px;
  106. border-top: 1px solid #ccc;
  107. padding-top: 24px;
  108. text-align: center;
  109. }
  110. .footer .initiative {
  111. font-style: italic;
  112. margin-top: 16px;
  113. }
  114. table {
  115. border-spacing: 0;
  116. }
  117. td {
  118. padding: 8px;
  119. border-bottom: 1px solid #ccc;
  120. }
  121. @media (prefers-color-scheme: dark) {
  122. body {
  123. background-color: #333;
  124. color: #fff;
  125. }
  126. a {
  127. color: #58a6ff;
  128. }
  129. }
  130. </style>
  131. <script
  132. type="module"
  133. src="https://unpkg.com/@justinribeiro/lite-youtube@1.4.0/lite-youtube.js"
  134. ></script>
  135. <script module>
  136. import(
  137. // In development we import locally.
  138. window.location.hostname === "localhost"
  139. ? "/dist/web/install-button.js"
  140. : "https://unpkg.com/esp-web-tools/dist/web/install-button.js?module"
  141. );
  142. </script>
  143. </head>
  144. <body>
  145. <div class="content">
  146. <h1>ESP Web Tools</h1>
  147. <p>
  148. User friendly tools to manage ESP8266 and ESP32 devices in the browser:
  149. </p>
  150. <ul>
  151. <li>Install &amp; update firmware</li>
  152. <li>Connect device to the Wi-Fi network</li>
  153. <li>Visit the device's hosted web interface</li>
  154. <li>Access logs and send terminal commands</li>
  155. <li>
  156. Add devices to
  157. <a href="https://www.home-assistant.io">Home Assistant</a>
  158. </li>
  159. </ul>
  160. <div class="videoWrapper">
  161. <lite-youtube
  162. videoid="E8bdATqXM8c"
  163. videotitle="ESP Web Tools in action"
  164. ></lite-youtube>
  165. </div>
  166. <h2 id="demo">Try a live demo</h2>
  167. <p>
  168. This demo will install
  169. <a href="https://esphome.io">ESPHome</a>. To get started, connect an ESP
  170. device to your computer and hit the button:
  171. </p>
  172. <esp-web-install-button
  173. manifest="https://firmware.esphome.io/esphome-web/manifest.json"
  174. >
  175. <i slot="unsupported">
  176. The demo is not available because your browser does not support Web
  177. Serial. Open this page in Google Chrome or Microsoft Edge instead<span
  178. class="not-supported-i hidden"
  179. >
  180. (but not on your iOS device)</span
  181. >.
  182. </i>
  183. </esp-web-install-button>
  184. <h2 id="used-by">Products using ESP Web Tools</h2>
  185. <div class="projects">
  186. <a href="https://install.wled.me" target="_blank" class="project">
  187. <div class="logo">
  188. <img src="static/logos/wled.png" alt="WLED logo" />
  189. </div>
  190. <div class="name">WLED</div>
  191. </a>
  192. <a
  193. href="https://arendst.github.io/Tasmota-firmware/"
  194. target="_blank"
  195. class="project"
  196. >
  197. <div class="logo">
  198. <img src="static/logos/tasmota.svg" alt="Tasmota logo" />
  199. </div>
  200. <div class="name">Tasmota</div>
  201. </a>
  202. <a href="https://td-er.nl/ESPEasy/" target="_blank" class="project">
  203. <div class="logo">
  204. <img src="static/logos/espeasy.png" alt="ESPEasy logo" />
  205. </div>
  206. <div class="name">ESPEasy</div>
  207. </a>
  208. <a
  209. href="https://canair.io/installer.html"
  210. target="_blank"
  211. class="project"
  212. >
  213. <div class="logo">
  214. <img src="static/logos/canairio.png" alt="CanAirIO logo" />
  215. </div>
  216. <div class="name">CanAirIO</div>
  217. </a>
  218. <a href="https://web.esphome.io" target="_blank" class="project">
  219. <div class="logo">
  220. <img src="static/logos/esphome.svg" alt="ESPHome logo" />
  221. </div>
  222. <div class="name">ESPHome</div>
  223. </a>
  224. <a
  225. href="https://sle118.github.io/squeezelite-esp32-installer/"
  226. target="_blank"
  227. class="project"
  228. >
  229. <div class="logo">
  230. <img
  231. src="static/logos/squeezelite-esp32.png"
  232. alt="Squeezelite-ESP32 logo"
  233. />
  234. </div>
  235. <div class="name">Squeezelite-ESP32</div>
  236. </a>
  237. <a
  238. href="https://2smart.com/docs-resources/platform-updates/platform-updates-13-07-2022"
  239. target="_blank"
  240. class="project"
  241. >
  242. <div class="logo">
  243. <img src="static/logos/2smart.png" alt="2Smart logo" />
  244. </div>
  245. <div class="name">2Smart</div>
  246. </a>
  247. <a href="https://clockwise.page" target="_blank" class="project">
  248. <div class="logo">
  249. <img src="static/logos/clockwise.png" alt="Clockwise logo" />
  250. </div>
  251. <div class="name">Clockwise</div>
  252. </a>
  253. <a
  254. href="https://sblantipodi.github.io/glow_worm_luciferin"
  255. target="_blank"
  256. class="project"
  257. >
  258. <div class="logo">
  259. <img
  260. src="static/logos/luciferin_logo.png"
  261. alt="Firefly Luciferin logo"
  262. />
  263. </div>
  264. <div class="name">Luciferin</div>
  265. </a>
  266. <a href="https://install.openepaperlink.de" target="_blank" class="project">
  267. <div class="logo">
  268. <img src="static/logos/openepaperlink.png" alt="OpenEpaperLink logo" />
  269. </div>
  270. <div class="name">OpenEpaperLink</div>
  271. </a>
  272. </div>
  273. <h2>How it works</h2>
  274. <p>
  275. ESP Web Tools works by combining
  276. <a href="https://developer.mozilla.org/docs/Web/API/Web_Serial_API"
  277. >Web Serial</a
  278. >, <a href="https://www.improv-wifi.com/">Improv Wi-Fi</a> (optional),
  279. and a manifest which describes the firmware. ESP Web Tools detects the
  280. chipset of the connected ESP device and automatically selects the right
  281. firmware variant from the manifest.
  282. </p>
  283. <p>
  284. Web Serial is available in Google Chrome and Microsoft Edge
  285. browsers<span class="not-supported-i hidden">
  286. (but not on your iOS device)</span
  287. >. Android support should be possible but has not been implemented yet.
  288. </p>
  289. <h3 id="improv">Configuring Wi-Fi</h3>
  290. <p>
  291. ESP Web Tools supports the
  292. <a href="https://www.improv-wifi.com/serial"
  293. >Improv Wi-Fi serial standard</a
  294. >. This is an open standard to allow configuring Wi-Fi via the serial
  295. port.
  296. </p>
  297. <p>
  298. If the firmware supports Improv, a user will be asked to connect the
  299. device to the network after installing the firmware. Once connected, the
  300. device can send the user to a URL to finish configuration. For example,
  301. this can be a link to the device's IP address where it serves a local
  302. UI.
  303. </p>
  304. <p>
  305. At any time in the future a user can use ESP Web Tools to find the
  306. device link or to reconfigure the Wi-Fi settings without doing a
  307. reinstall.
  308. </p>
  309. <p class="screenshot">
  310. <img
  311. src="./static/screenshots/dashboard.png"
  312. alt="Screenshot showing ESP Web Tools dialog offering visting the device, adding it to Home Assistant, change Wi-Fi, show logs and console and reset data."
  313. />
  314. <i>Screenshot showing the ESP Web Tools interface</i>
  315. </p>
  316. <h3 id="logs">Viewing logs & sending commands</h3>
  317. <p>
  318. ESP Web Tools allows users to open a serial console to see the logs and
  319. send commands.
  320. </p>
  321. <p class="screenshot">
  322. <img
  323. src="./static/screenshots/logs.png"
  324. alt="Screenshot showing ESP Web Tools dialog with a console showing ESPHome logs and a terminal prompt to sent commands."
  325. />
  326. <i>Screenshot showing the ESP Web Tools logs & console</i>
  327. </p>
  328. <h2 id="add-website">Adding ESP Web Tools to your website</h2>
  329. <p>
  330. To add this to your own website, you need to include the ESP Web Tools
  331. JavaScript files on your website, create a manifest file and add the ESP
  332. Web Tools button HTML.
  333. </p>
  334. <p>
  335. <a href="https://github.com/balloob/squeezelite-esp32-install"
  336. >Click here to see a full example.</a
  337. >
  338. </p>
  339. <p>
  340. <b>Step 1:</b> Load ESP Web Tools JavaScript on your website by adding
  341. the following HTML snippet.
  342. </p>
  343. <pre>
  344. &lt;script
  345. type="module"
  346. src="https://unpkg.com/esp-web-tools@9/dist/web/install-button.js?module"
  347. >&lt;/script></pre
  348. >
  349. <p>
  350. (If you prefer to locally host the JavaScript,
  351. <a href="https://unpkg.com/browse/esp-web-tools/dist/web/"
  352. >download it here</a
  353. >)
  354. </p>
  355. <p>
  356. <b>Step 2:</b> Find a place on your page where you want the button to
  357. appear and include the following bit of HTML. Update the
  358. <code>manifest</code> attribute to point at your manifest file.
  359. </p>
  360. <pre>
  361. &lt;esp-web-install-button
  362. manifest="https://firmware.esphome.io/esphome-web/manifest.json"
  363. >&lt;/esp-web-install-button></pre
  364. >
  365. <p>
  366. <b>Note:</b> ESP Web Tools requires that your website is served over
  367. <code>https://</code> to work. This is a Web Serial security
  368. requirement.
  369. </p>
  370. <p>
  371. If your manifest or the firmware files are hosted on another server,
  372. make sure you configure
  373. <a href="https://developer.mozilla.org/docs/Web/HTTP/CORS"
  374. >the CORS-headers</a
  375. >
  376. such that your website is allowed to fetch those files by adding the
  377. header
  378. <code
  379. >Access-Control-Allow-Origin: https://domain-of-your-website.com</code
  380. >.
  381. </p>
  382. <p>
  383. ESP Web Tools can also be integrated in your projects by installing it
  384. <a href="https://www.npmjs.com/package/esp-web-tools">via NPM</a>.
  385. </p>
  386. <h3 id="preparing-firmware">Preparing your firmware</h3>
  387. <p>
  388. If you have ESP32 firmware and are using ESP-IDF framework v4 or later,
  389. you will need to create a merged version of your firmware before being
  390. able to use it with ESP Web Tools. If you use ESP8266 or ESP32 with
  391. ESP-IDF v3 or earlier, you can skip this section.
  392. </p>
  393. <p>
  394. ESP32 firmware is split into 4 different files. When these files are
  395. installed using the command-line tool <code>esptool</code>, it will
  396. patch flash frequency, flash size and flash mode to match the target
  397. device. ESP Web Tools is not able to do this on the fly, so you will
  398. need to use <code>esptool</code> to create the single binary file and
  399. use that with ESP Web Tools.
  400. </p>
  401. <p>
  402. Create a single binary using <code>esptool</code> with the following
  403. command:
  404. </p>
  405. <pre>
  406. esptool --chip esp32 merge_bin \
  407. -o merged-firmware.bin \
  408. --flash_mode dio \
  409. --flash_freq 40m \
  410. --flash_size 4MB \
  411. 0x1000 bootloader.bin \
  412. 0x8000 partitions.bin \
  413. 0xe000 boot.bin \
  414. 0x10000 your_app.bin</pre
  415. >
  416. <p>
  417. If your memory type is <code>opi_opi</code> or <code>opi_qspi</code>,
  418. set your flash mode to be <code>dout</code>. Else, if your flash mode is
  419. <code>qio</code> or <code>qout</code>, override your flash mode to be
  420. <code>dio</code>.
  421. </p>
  422. <h3 id="manifest">Creating your manifest</h3>
  423. <p>
  424. Manifests describe the firmware that you want to offer the user to
  425. install. It allows specifying different builds for the different types
  426. of ESP devices. Current supported chip families are
  427. <code>ESP8266</code>, <code>ESP32</code>, <code>ESP32-C3</code>,
  428. <code>ESP32-S2</code> and <code>ESP32-S3</code>. The correct build will
  429. be automatically selected based on the type of the connected ESP device.
  430. </p>
  431. <pre>
  432. {
  433. "name": "ESPHome",
  434. "version": "2021.11.0",
  435. "home_assistant_domain": "esphome",
  436. "funding_url": "https://esphome.io/guides/supporters.html",
  437. "new_install_prompt_erase": false,
  438. "builds": [
  439. {
  440. "chipFamily": "ESP32",
  441. "parts": [
  442. { "path": "merged-firmware.bin", "offset": 0 },
  443. ]
  444. },
  445. {
  446. "chipFamily": "ESP8266",
  447. "parts": [
  448. { "path": "esp8266.bin", "offset": 0 }
  449. ]
  450. }
  451. ]
  452. }</pre
  453. >
  454. <p>
  455. Each build contains a list of parts to be installed to the ESP device.
  456. Each part consists of a path to the file and an offset on the flash
  457. where it should be installed. Part paths are resolved relative to the
  458. path of the manifest, but can also be URLs to other hosts.
  459. </p>
  460. <p>
  461. If your firmware is supported by Home Assistant, you can add the
  462. optional key <code>home_assistant_domain</code>. If present, ESP Web
  463. Tools will link the user to add this device to Home Assistant.
  464. </p>
  465. <p>
  466. By default a new installation will erase all data before installation.
  467. If you want to leave this choice to the user, set the optional manifest
  468. key
  469. <code>new_install_prompt_erase</code> to <code>true</code>. ESP Web
  470. Tools offers users a new installation if it is unable to detect the
  471. current firmware of the device (via Improv Serial) or if the detected
  472. firmware does not match the name specififed in the manifest.
  473. </p>
  474. <p>
  475. When a firmware is first installed on a device, it might need to do some
  476. time consuming tasks like initializing the file system. By default ESP
  477. Web Tools will wait 10 seconds to receive an Improv Serial response to
  478. indicate that the boot is completed. You can increase this timeout by
  479. setting the optional manifest key
  480. <code>new_install_improv_wait_time</code> to the number of seconds to
  481. wait. Set to <code>0</code> to disable Improv Serial detection.
  482. </p>
  483. <p>
  484. If your product accepts donations you can add
  485. <code>funding_url</code> to your manifest. This allows you to link to
  486. your page explaining the user how they can fund development. This link
  487. is visible in the ESP Web Tools menu when connected to a device running
  488. your firmware (as detected via Improv).
  489. </p>
  490. <p>
  491. ESP Web Tools allows you to provide your own check if the device is
  492. running the same firmware as specified in the manifest. This check can
  493. be setting the <code>overrides</code> property on
  494. <code>&lt;esp-web-install-button&gt;</code>. The value is an object
  495. containing a
  496. <code>checkSameFirmware(manifest, improvInfo)</code> function. The
  497. <code>manifest</code> parameter is your manifest and
  498. <code>improvInfo</code> is the information returned from Improv:
  499. <code>{ name, firmware, version, chipFamily }</code>. This check is only
  500. called if the device firmware was detected via Improv.
  501. </p>
  502. <pre>
  503. const button = document.querySelector('esp-web-install-button');
  504. button.overrides = {
  505. checkSameFirmware(manifest, improvInfo) {
  506. const manifestFirmware = manifest.name.toLowerCase();
  507. const deviceFirmware = improvInfo.firmware.toLowerCase();
  508. return manifestFirmware.includes(deviceFirmware);
  509. }
  510. };</pre
  511. >
  512. <h3 id="customize">Customizing the look and feel</h3>
  513. <p>
  514. You can change the colors of the default UI elements with CSS custom
  515. properties (variables), the following variables are available:
  516. </p>
  517. <ul>
  518. <li><code>--esp-tools-button-color</code></li>
  519. <li><code>--esp-tools-button-text-color</code></li>
  520. </ul>
  521. <p>There are also some attributes that can be used for styling:</p>
  522. <table>
  523. <tr>
  524. <td><code>install-supported</code></td>
  525. <td>Added if installing firmware is supported</td>
  526. </tr>
  527. <tr>
  528. <td>
  529. <code>install-unsupported</code>
  530. </td>
  531. <td>Added if installing firmware is not supported</td>
  532. </tr>
  533. </table>
  534. <h4>Replace the button and message with a custom one</h4>
  535. <p>
  536. You can replace both the activation button and the message that is shown
  537. when the user uses an unsupported browser or non-secure context with
  538. your own elements. This can be done using the <code>activate</code>,
  539. <code>unsupported</code> and <code>not-allowed</code> slots:
  540. </p>
  541. <pre>
  542. &lt;esp-web-install-button
  543. manifest="https://firmware.esphome.io/esphome-web/manifest.json"
  544. >
  545. &lt;button slot="activate">Custom install button&lt;/button>
  546. &lt;span slot="unsupported">Ah snap, your browser doesn't work!&lt;/span>
  547. &lt;span slot="not-allowed">Ah snap, you are not allowed to use this on HTTP!&lt;/span>
  548. &lt;/esp-web-install-button>
  549. </pre
  550. >
  551. <h2>Why we created ESP Web Tools</h2>
  552. <div class="videoWrapper">
  553. <lite-youtube
  554. videoid="6ZMXE5PXPqU"
  555. videotitle="Why we created ESP Web Tools"
  556. videoStartAt="1255"
  557. ></lite-youtube>
  558. </div>
  559. <div class="footer">
  560. <div class="initiative">
  561. ESP Web Tools is a project by
  562. <a href="https://esphome.io">ESPHome</a>.<br />
  563. Development is funded by
  564. <a href="https://www.nabucasa.com">Nabu Casa</a>.
  565. </div>
  566. <div>
  567. ESP Web Tools is
  568. <a href="https://github.com/esphome/esp-web-tools">open source</a>.
  569. </div>
  570. </div>
  571. </div>
  572. <script>
  573. if (/iPad|iPhone|iPod/.test(navigator.userAgent)) {
  574. document.querySelector(".not-supported-i").classList.remove("hidden");
  575. }
  576. </script>
  577. </body>
  578. </html>