index.html 16 KB

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