index.html 16 KB

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