index.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <html>
  2. <head>
  3. <meta charset="utf-8" />
  4. <title>ESP Web Tools</title>
  5. <meta
  6. name="description"
  7. content="Easily allow users to flash new firmware for their ESP-devices on the web."
  8. />
  9. <meta name="viewport" content="width=device-width" />
  10. <meta property="og:title" content="ESP Web Tools" />
  11. <meta property="og:site_name" content="ESP Web Tools" />
  12. <meta
  13. property="og:url"
  14. content="https://esphome.github.io/esp-web-tools/"
  15. />
  16. <meta property="og:type" content="website" />
  17. <meta
  18. property="og:description"
  19. content="Easily allow users to flash new firmware for their ESP-devices on the web."
  20. />
  21. <meta
  22. property="og:image"
  23. content="https://esphome.github.io/esp-web-tools/static/social.png"
  24. />
  25. <meta name="twitter:card" content="summary_large_image" />
  26. <meta name="twitter:title" content="ESP Web Tools" />
  27. <meta
  28. name="twitter:description"
  29. content="Easily allow users to flash new firmware for their ESP-devices on the web."
  30. />
  31. <meta
  32. name="twitter:image"
  33. content="https://esphome.github.io/esp-web-tools/static/social.png"
  34. />
  35. <meta name="color-scheme" content="dark light" />
  36. <style>
  37. body {
  38. font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI",
  39. Roboto, Ubuntu, sans-serif;
  40. padding: 0;
  41. margin: 0;
  42. line-height: 1.4;
  43. }
  44. .content {
  45. max-width: 600px;
  46. margin: 0 auto;
  47. padding: 12px;
  48. }
  49. .project .logo {
  50. float: right;
  51. }
  52. .project .logo img {
  53. height: 50px;
  54. }
  55. a {
  56. color: #03a9f4;
  57. }
  58. .screenshot {
  59. text-align: center;
  60. }
  61. .screenshot img {
  62. max-width: 100%;
  63. box-shadow: rgb(0 0 0 / 20%) 0px 2px 1px -1px,
  64. rgb(0 0 0 / 14%) 0px 1px 1px 0px, rgb(0 0 0 / 12%) 0px 1px 3px 0px;
  65. border-radius: 4px;
  66. }
  67. .screenshot i {
  68. margin-top: 4px;
  69. display: block;
  70. }
  71. .videoWrapper {
  72. position: relative;
  73. padding-bottom: 56.25%; /* 16:9 */
  74. height: 0;
  75. margin-bottom: 25px;
  76. background: #ccc;
  77. }
  78. .hidden {
  79. display: none;
  80. }
  81. .supported-info {
  82. display: none;
  83. }
  84. esp-web-install-button[install-supported] + .supported-info {
  85. display: block;
  86. }
  87. .content pre {
  88. max-width: 100%;
  89. overflow-y: scroll;
  90. }
  91. .footer {
  92. margin-top: 24px;
  93. border-top: 1px solid #ccc;
  94. padding-top: 24px;
  95. text-align: center;
  96. }
  97. .footer .initiative {
  98. font-style: italic;
  99. margin-top: 16px;
  100. }
  101. table {
  102. border-spacing: 0;
  103. }
  104. td {
  105. padding: 8px;
  106. border-bottom: 1px solid #ccc;
  107. }
  108. @media (prefers-color-scheme: dark) {
  109. body {
  110. background-color: #333;
  111. color: #fff;
  112. }
  113. a {
  114. color: #58a6ff;
  115. }
  116. }
  117. </style>
  118. <script
  119. type="module"
  120. src="https://unpkg.com/@justinribeiro/lite-youtube@1.3.0/lite-youtube.js"
  121. ></script>
  122. <script module>
  123. import(
  124. // In development we import locally.
  125. window.location.hostname === "localhost"
  126. ? "/dist/web/install-button.js"
  127. : "https://unpkg.com/esp-web-tools@7.1.0/dist/web/install-button.js?module"
  128. );
  129. </script>
  130. </head>
  131. <body>
  132. <div class="content">
  133. <h1>ESP Web Tools</h1>
  134. <p>
  135. ESP Web Tools allows you to manage ESP8266 and ESP32 devices in the
  136. browser: install new firmware, update firmware, connect device to the
  137. Wi-Fi network, visit the device's hosted web interface and add devices
  138. to <a href="https://www.home-assistant.io">Home Assistant</a>.
  139. </p>
  140. <div class="videoWrapper">
  141. <lite-youtube
  142. videoid="E8bdATqXM8c"
  143. videotitle="ESP Web Tools in action"
  144. ></lite-youtube>
  145. </div>
  146. <p>
  147. ESP Web Tools works by combining
  148. <a
  149. href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API"
  150. >Web Serial</a
  151. >, <a href="https://www.improv-wifi.com/">Improv Wi-Fi</a> (optional),
  152. and a manifest which describes the firmware. It will automatically find
  153. the supported firmware files from the manifest by detecting the chipset
  154. of the connected ESP device.
  155. </p>
  156. <p>
  157. Web Serial is available in Google Chrome and Microsoft Edge
  158. browsers<span class="not-supported-i hidden">
  159. (but not on your iOS device)</span
  160. >. Android support should be possible but has not been implemented yet.
  161. </p>
  162. <h2 id="demo">Try a live demo</h2>
  163. <p>
  164. This demo will install
  165. <a href="https://esphome.io">ESPHome</a>. To get started, connect an ESP
  166. device to your computer and hit the button:
  167. </p>
  168. <esp-web-install-button manifest="static/firmware_build/manifest.json">
  169. <i slot="unsupported">
  170. The demo is not available because your browser does not support Web
  171. Serial. Open this page in Google Chrome or Microsoft Edge instead<span
  172. class="not-supported-i hidden"
  173. >
  174. (but not on your iOS device)</span
  175. >.
  176. </i>
  177. </esp-web-install-button>
  178. <p class="supported-info">
  179. If you don't see your ESP device in the list of devices to choose, you
  180. might need to install
  181. <a href="#drivers">the drivers</a>.
  182. </p>
  183. <h2 id="used-by">Products using ESP Web Tools</h2>
  184. <div class="project">
  185. <a href="https://wled.me" class="logo"
  186. ><img src="static/logos/wled.png" alt="WLED logo"
  187. /></a>
  188. <h3>WLED</h3>
  189. <p>
  190. Fast and feature-rich firmware to control NeoPixel (WS2812B, WS2811,
  191. SK6812) LEDs and SPI based chipsets like the WS2801 and APA102.
  192. </p>
  193. <p>
  194. <a href="https://install.wled.me" target="_blank"
  195. >Installation Website</a
  196. >
  197. </p>
  198. </div>
  199. <div class="project">
  200. <a href="https://tasmota.github.io" class="logo"
  201. ><img src="static/logos/tasmota.svg" alt="Tasmota logo"
  202. /></a>
  203. <h3>Tasmota</h3>
  204. <p>
  205. Firmware with easy configuration using webUI, OTA updates, automation
  206. using timers or rules, expandability and entirely local control over
  207. MQTT, HTTP, Serial or KNX.
  208. </p>
  209. <p>
  210. <a href="https://arendst.github.io/Tasmota-firmware/" target="_blank"
  211. >Installation Website</a
  212. >
  213. </p>
  214. </div>
  215. <div class="project">
  216. <a href="http://www.espeasy.com/" class="logo"
  217. ><img src="static/logos/espeasy.png" alt="ESPEasy logo"
  218. /></a>
  219. <h3>ESPEasy</h3>
  220. <p>Easy MultiSensor device based on ESP8266/ESP32.</p>
  221. <p>
  222. <a href="https://td-er.nl/ESPEasy/" target="_blank"
  223. >Installation Website</a
  224. >
  225. </p>
  226. </div>
  227. <div class="project">
  228. <a href="https://canair.io" class="logo"
  229. ><img src="static/logos/canairio.png" alt="CanAirIO logo"
  230. /></a>
  231. <h3>CanAirIO</h3>
  232. <p>
  233. Citizen science initiative for monitoring air quality. CanAirIO uses
  234. mobile and fixed sensors to measure air quality with smartphones and
  235. ESP32 devices.
  236. </p>
  237. <p>
  238. <a href="https://canair.io/installer.html" target="_blank"
  239. >Installation Website</a
  240. >
  241. </p>
  242. </div>
  243. <div class="project">
  244. <a href="https://esphome.io" class="logo"
  245. ><img src="static/logos/esphome.svg" alt="ESPHome logo"
  246. /></a>
  247. <h3>ESPHome</h3>
  248. <p>
  249. No-code platform for ESP devices. Uses ESP Web Tools in their
  250. dashboard to install ESPHome on devices.
  251. </p>
  252. <p>
  253. <a href="https://esphome.io" target="_blank">Website</a>
  254. </p>
  255. </div>
  256. <h2 id="add-website">Adding ESP Web Tools to your website</h2>
  257. <p>
  258. To add this to your own website, you need to include the ESP Web Tools
  259. JavaScript files on your website, create a manifest file and render the
  260. ESP Web Tools button.
  261. </p>
  262. <p>
  263. You can import the JavaScript files directly from the unpkg CDN or
  264. <a href="https://unpkg.com/browse/esp-web-tools/dist/web/"
  265. >download the files</a
  266. >
  267. and put them on your website.
  268. </p>
  269. <pre>
  270. &lt;script
  271. type="module"
  272. src="https://unpkg.com/esp-web-tools@7.1.0/dist/web/install-button.js?module"
  273. >&lt;/script></pre
  274. >
  275. <p>
  276. Find a place on your page where you want the button to appear and
  277. include the following bit of HTML. Update the
  278. <code>manifest</code> attribute to point at your manifest file.
  279. </p>
  280. <pre>
  281. &lt;esp-web-install-button
  282. manifest="/static/firmware_build/manifest.json"
  283. >&lt;/esp-web-install-button></pre
  284. >
  285. <p>
  286. ESP Web Tools requires that your website is served over
  287. <code>https://</code> to work. This is a Web Serial security limitation.
  288. </p>
  289. <p>
  290. If your manifest or the firmware files are hosted on another server,
  291. make sure you configure
  292. <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS"
  293. >the CORS-headers</a
  294. >
  295. such that your website is allowed to fetch those files by adding the
  296. header
  297. <code
  298. >Access-Control-Allow-Origin: https://domain-of-your-website.com</code
  299. >.
  300. </p>
  301. <p>
  302. ESP Web Tools can also be integrated in your projects by installing it
  303. <a href="https://www.npmjs.com/package/esp-web-tools">via NPM</a>.
  304. </p>
  305. <h3 id="manifest">Creating your manifest</h3>
  306. <p>
  307. Manifests describe the firmware that you want to offer the user to
  308. install. It allows specifying different builds for the different types
  309. of ESP devices. Current supported chip families are
  310. <code>ESP8266</code>, <code>ESP32</code>, <code>ESP32-C3</code> and
  311. <code>ESP32-S2</code>. The correct build will be automatically selected
  312. based on the type of the ESP device we detect via the serial port.
  313. </p>
  314. <pre>
  315. {
  316. "name": "ESPHome",
  317. "version": "2021.11.0",
  318. "home_assistant_domain": "esphome",
  319. "new_install_prompt_erase": false,
  320. "builds": [
  321. {
  322. "chipFamily": "ESP32",
  323. "parts": [
  324. { "path": "bootloader.bin", "offset": 4096 },
  325. { "path": "partitions.bin", "offset": 32768 },
  326. { "path": "ota.bin", "offset": 57344 },
  327. { "path": "firmware.bin", "offset": 65536 }
  328. ]
  329. },
  330. {
  331. "chipFamily": "ESP8266",
  332. "parts": [
  333. { "path": "esp8266.bin", "offset": 0 }
  334. ]
  335. }
  336. ]
  337. }</pre
  338. >
  339. <p>
  340. Each build contains a list of parts to be installed to the ESP device.
  341. Each part consists of a path to the file and an offset on the flash
  342. where it should be installed. Part paths are resolved relative to the
  343. path of the manifest, but can also be URLs to other hosts.
  344. </p>
  345. <p>
  346. If your firmware is supported by Home Assistant, you can add the
  347. optional key <code>home_assistant_domain</code>. If present, ESP Web
  348. Tools will link the user to add this device to Home Assistant.
  349. </p>
  350. <p>
  351. By default a new installation will erase all data before installation.
  352. If you want to leave this choice to the user, set the optional manifest
  353. key
  354. <code>new_install_prompt_erase</code> to <code>true</code>. ESP Web
  355. Tools offers users a new installation if it is unable to detect the
  356. current firmware of the device (via Improv Serial) or if the detected
  357. firmware does not match the name specififed in the manifest.
  358. </p>
  359. <p>
  360. When a firmware is first installed on a device, it might need to do some
  361. time consuming tasks like initializing the file system. By default ESP
  362. Web Tools will wait 10 seconds to receive an Improv Serial response to
  363. indicate that the boot is completed. You can increase this timeout by
  364. setting the optional manifest key
  365. <code>new_install_improv_wait_time</code> to the number of seconds to
  366. wait. Set to <code>0</code> to disable Improv Serial detection.
  367. </p>
  368. <h2 id="improv">Configuring Wi-Fi</h2>
  369. <p>
  370. ESP Web Tools supports the
  371. <a href="https://www.improv-wifi.com/serial"
  372. >Improv Wi-Fi serial standard</a
  373. >. This is an open standard to allow configuring Wi-Fi via the serial
  374. port.
  375. </p>
  376. <p>
  377. If the firmware supports Improv, a user will be asked to connect the
  378. device to the network after installing the firmware. Once connected, the
  379. device can send the user to a URL to finish configuration. For example,
  380. this can be a link to the device's IP address where it serves a local
  381. UI.
  382. </p>
  383. <p>
  384. At any time in the future a user can use ESP Web Tools to find the
  385. device link or to reconfigure the Wi-Fi settings without doing a
  386. reinstall.
  387. </p>
  388. <p class="screenshot">
  389. <img
  390. src="./static/screenshots/dashboard.png"
  391. 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."
  392. />
  393. <i>Screenshot showing the ESP Web Tools interface</i>
  394. </p>
  395. <h3 id="customize">Customizing the look and feel</h3>
  396. <p>
  397. You can change the colors of the default UI elements with CSS custom
  398. properties (variables), the following variables are available:
  399. </p>
  400. <ul>
  401. <li><code>--esp-tools-button-color</code></li>
  402. <li><code>--esp-tools-button-text-color</code></li>
  403. </ul>
  404. <p>There are also some attributes that can be used for styling:</p>
  405. <table>
  406. <tr>
  407. <td><code>install-supported</code></td>
  408. <td>Added if installing firmware is supported</td>
  409. </tr>
  410. <tr>
  411. <td>
  412. <code>install-unsupported</code>
  413. </td>
  414. <td>Added if installing firmware is not supported</td>
  415. </tr>
  416. </table>
  417. <h4>Replace the button and message with a custom one</h4>
  418. <p>
  419. You can replace both the activation button and the message that is shown
  420. when the user uses an unsupported browser or non-secure context with
  421. your own elements. This can be done using the <code>activate</code>,
  422. <code>unsupported</code> and <code>not-allowed</code> slots:
  423. </p>
  424. <pre>
  425. &lt;esp-web-install-button
  426. manifest="/static/firmware_build/manifest.json"
  427. >
  428. &lt;button slot="activate">Custom install button&lt;/button>
  429. &lt;span slot="unsupported">Ah snap, your browser doesn't work!&lt;/span>
  430. &lt;span slot="not-allowed">Ah snap, you are not allowed to use this on HTTP!&lt;/span>
  431. &lt;/esp-web-install-button>
  432. </pre
  433. >
  434. <h2 id="logs">Viewing logs & sending commands</h2>
  435. <p>
  436. ESP Web Tools allows users to open a serial console to see the logs and
  437. send commands.
  438. </p>
  439. <p class="screenshot">
  440. <img
  441. src="./static/screenshots/logs.png"
  442. alt="Screenshot showing ESP Web Tools dialog with a console showing ESPHome logs and a terminal prompt to sent commands."
  443. />
  444. <i>Screenshot showing the ESP Web Tools logs & console</i>
  445. </p>
  446. <h2 id="drivers">USB Serial Drivers</h2>
  447. <p>
  448. If the serial port is not showing up, your computer might be missing the
  449. drivers for the USB serial chip used in your ESP device. These drivers
  450. work for most ESP devices:
  451. </p>
  452. <ul>
  453. <li>
  454. CP2102 (square chip):
  455. <a
  456. href="https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers"
  457. >driver</a
  458. >
  459. </li>
  460. <li>
  461. CH341:
  462. <a
  463. href="https://github.com/nodemcu/nodemcu-devkit/tree/master/Drivers"
  464. >driver</a
  465. >
  466. </li>
  467. </ul>
  468. <h2>Why we created ESP Web Tools</h2>
  469. <div class="videoWrapper">
  470. <lite-youtube
  471. videoid="6ZMXE5PXPqU"
  472. videotitle="Why we created ESP Web Tools"
  473. videoStartAt="1255"
  474. ></lite-youtube>
  475. </div>
  476. <div class="footer">
  477. <div>
  478. ESP Web Tools –
  479. <a href="https://github.com/esphome/esp-web-tools">GitHub</a>
  480. </div>
  481. <div class="initiative">
  482. ESP Web Tools is a project by
  483. <a href="https://esphome.io">ESPHome</a>.<br />
  484. Development is funded by
  485. <a href="https://www.nabucasa.com">Nabu Casa</a>.
  486. </div>
  487. </div>
  488. </div>
  489. <script>
  490. if (/iPad|iPhone|iPod/.test(navigator.userAgent)) {
  491. document.querySelector(".not-supported-i").classList.remove("hidden");
  492. }
  493. </script>
  494. </body>
  495. </html>