esp-web-tools/index.html
2021-06-10 15:17:51 -07:00

268 lines
8.2 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<meta charset="utf-8" />
<title>ESP Web Tools</title>
<meta name="viewport" content="width=device-width" />
<meta
name="description"
content="Easily allow users to flash new firmware for their ESP-devices on the web."
/>
<style>
body {
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI",
Roboto, Ubuntu, sans-serif;
padding: 0;
margin: 0;
line-height: 1.4;
}
.content {
max-width: 600px;
margin: 0 auto;
padding: 12px;
}
.project .logo {
float: right;
width: 200px;
}
.project .logo img {
width: 100%;
}
esp-web-flash-log {
margin-top: 8px;
}
a {
color: #03a9f4;
}
.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
height: 0;
margin-bottom: 25px;
background: #000;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.content pre {
max-width: 100%;
overflow-y: scroll;
}
.footer {
margin-top: 24px;
border-top: 1px solid #ccc;
padding-top: 24px;
text-align: center;
}
.footer .initiative {
font-style: italic;
margin-top: 16px;
}
</style>
<script module>
import(
// In development we import locally.
window.location.hostname === "localhost"
? "/dist/web/install-button.js"
: "https://unpkg.com/esp-web-tools@2.0.2/dist/web/install-button.js?module"
);
</script>
</head>
<body>
<div class="content">
<h1>ESP Web Tools</h1>
<p>
ESP Web Tools is a set of open source tools to allow working with ESP
devices in the browser.
<a href="https://github.com/esphome/esp-web-tools"
>The code is available on GitHub.</a
>
</p>
<p>
To try it out and install
<a href="https://esphome.io">the ESPHome firmware</a>, connect an ESP to
your computer and hit the button:
</p>
<esp-web-install-button
erase-first
manifest="static/firmware_build/manifest.json"
></esp-web-install-button>
<p>
<i>
Note, this only works in desktop Chrome and Edge. Android support
should be possible but has not been implemented yet.
</i>
</p>
<p>
This works by combining
<a
href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API"
>Web Serial</a
>
with a manifest which describes the firmware. It will automatically
detect the type of the connected ESP device and find the right firmware
files in the manifest.
</p>
<div class="videoWrapper">
<iframe
width="560"
height="315"
src="https://www.youtube-nocookie.com/embed/jGfa0xMhUn4"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>
</div>
<h2>Projects using ESP Web Tools</h2>
<div class="project">
<div class="logo">
<img src="static/wled.png" alt="WLED logo" />
</div>
<h3>WLED</h3>
<p>
A fast and feature-rich implementation of an ESP8266/ESP32 firmware to
control NeoPixel (WS2812B, WS2811, SK6812) LEDs or also SPI based
chipsets like the WS2801 and APA102.
</p>
<p>
<a href="https://flash.wled.me" target="_blank"
>Installation Website</a
>
</p>
</div>
<h2>Adding ESP Web Tools to your website</h2>
<p>
To add this to your own website, create a manifest and add the button to
your website. Make sure you update the manifest attribute to point at
your manifest.
</p>
<p>
You can import ESP Web Tools directly from the unpkg CDN or
<a href="https://unpkg.com/browse/esp-web-tools/dist/web/"
>download the files</a
>
and put them on your website.
</p>
<pre>
&lt;script
type="module"
src="https://unpkg.com/esp-web-tools@2.0.2/dist/web/install-button.js?module"
>&lt;/script>
&lt;esp-web-install-button
manifest="static/firmware_build/manifest.json"
>&lt;/esp-web-install-button></pre
>
<p>
Your website needs to be served over <code>https://</code>. If your
manifest is hosted on another server, make sure you configure
<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS"
>the CORS-headers</a
>
for your manifest and firmware files such that your website is allowed
to fetch those files by adding the header
<code
>Access-Control-Allow-Origin: https://domain-of-your-website.com</code
>.
</p>
<p>
Add the attribute <code>erase-first</code> if you want to first fully
erase the ESP prior to installation.
</p>
<p>
ESP Web Tools can also be integrated in your projects by installing it
via NPM:<br />
<code>npm install --save esp-web-tools</code>
</p>
<h3 id="manifest">Creating your manifest</h3>
<p>
ESP Web Tools manifest describe the firmware that you want to install.
It allows specifying different builds for the different types of ESP
devices. Current supported devices are ESP8266, ESP32 and ESP32-S2. The
correct build will be automatically selected based on the type of the
ESP device we detect via the serial port.
</p>
<pre>
{
"name": "ESPHome",
"builds": [
{
"chipFamily": "ESP32",
"improv": true,
"parts": [
{ "path": "bootloader.bin", "offset": 4096 },
{ "path": "partitions.bin", "offset": 32768 },
{ "path": "ota.bin", "offset": 57344 },
{ "path": "firmware.bin", "offset": 65536 }
]
},
{
"chipFamily": "ESP8266",
"parts": [
{ "path": "esp8266.bin", "offset": 0 }
]
}
]
}</pre
>
<p>
Each build contains a list of parts to be flashed to the ESP device.
Each part consists of a path to the file and an offset on the flash
where it should be installed. Part paths are resolved relative to the
path of the manifest, but can also be URLs to other hosts.
</p>
<p>
Each build also allows you to specify if it supports
<a href="https://www.improv-wifi.com">the Improv WiFi standard</a>. If
it does, the user will be offered to configure the WiFi after
installation is done as can be seen in the video below.
</p>
<div class="videoWrapper">
<iframe
width="560"
height="315"
src="https://www.youtube-nocookie.com/embed/jGfa0xMhUn4?start=186"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>
</div>
<h3>Customizing the look and feel</h3>
<p>
You can customize both the activation button and the message that is
shown when the user uses an unsupported browser. This can be done using
the <code>activate</code> and <code>unsupported</code> slots:
</p>
<pre>
&lt;esp-web-install-button
manifest="static/firmware_build/manifest.json"
erase-first
>
&lt;button slot="activate">Custom install button&lt;/button>
&lt;span slot="unsupported">Ah snap, your browser doesn't work!&lt;/span>
&lt;/esp-web-install-button>
</pre
>
<div class="footer">
<div>
ESP Web Tools
<a href="https://github.com/esphome/esp-web-tools">GitHub</a>
</div>
<div class="initiative">
ESP Web Tools is a project by
<a href="https://esphome.io">ESPHome</a>.<br />
Development is funded by
<a href="https://www.nabucasa.com">Nabu Casa</a>.
</div>
</div>
</div>
</body>
</html>