index.html 16 KB

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