index.html 21 KB

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