Skip to content

Commit 76d940b

Browse files
authored
Initial commit
0 parents  commit 76d940b

8 files changed

+192
-0
lines changed

.github/workflows/ci.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
ci:
8+
name: Building ${{ matrix.file }}
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
file:
13+
- project-template-esp32.yaml
14+
- project-template-esp8266.yaml
15+
steps:
16+
- name: Checkout source code
17+
uses: actions/checkout@v2
18+
- name: Build ESPHome firmware to verify configuration
19+
uses: esphome/[email protected]
20+
with:
21+
yaml_file: ${{ matrix.file }}

.github/workflows/publish.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build and Publish ESPHome firmware and website
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
uses: esphome/workflows/.github/workflows/publish.yml@main
11+
with:
12+
# CHANGEME: Set the filenames of your config files here:
13+
files: project-template-esp32.yaml,project-template-esp8266.yaml
14+
# CHANGEME: Set the name of your project here:
15+
name: Template Project

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Gitignore settings for ESPHome
2+
# This is an example and may include too much for your use-case.
3+
# You can modify this file to suit your needs.
4+
/.esphome/
5+
/secrets.yaml

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# ESPHome Project Template
2+
3+
This repo serves as a template for creating a new ESPHome project.
4+
5+
It includes a GitHub workflow that will automatically build the configuration(s) and then deploys a simple
6+
website via GitHub pages that utilises [ESP Web Tools](https://esphome.github.io/esp-web-tools/) for users to
7+
easily install your project onto their device.
8+
9+
## Instructions
10+
11+
1. Use this repo template to [generate](https://github.com/esphome/esphome-project-template/generate) your own repository.
12+
- Make sure to check `Include all branches` so that GitHub Pages is automatically enabled.
13+
2. Clone your new repository.
14+
3. Add your project specific YAML configuration(s) along with the contents of the `project-template-....yaml` files, taking note of the comments in this template file and name accordingly.
15+
4.
16+
a. Update [.github/workflows/publish.yml](.github/workflows/publish.yml) to contain your own YAML config filename(s).
17+
b. Update [.github/workflows/ci.yml](.github/workflows/ci.yml) to contain your own YAML config filename(s).
18+
5. Update [static/_config.yml](static/_config.yml) to change the title, description and basic theme of the generated website.
19+
6. Add more content to the [static/index.md](static/index.md) file to explain your project.
20+
Make sure to leave the installation code tags in place so users get the install button.
21+
7. Add permission to github-actions[bot]
22+
a. go to your project Settings, under the Actions collapsible, click on General.
23+
b. scroll down until you find Workflow permissions and mark the option Read and write permissions.
24+
c. Hit the save button
25+
8. Push your changes to the repository and GitHub Actions will automatically build and deploy your project.
26+

project-template-esp32.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# These substitutions allow the end user to override certain values
2+
substitutions:
3+
name: "project-template"
4+
5+
esphome:
6+
name: "${name}"
7+
# Automatically add the mac address to the name
8+
# so you can use a single firmware for all devices
9+
name_add_mac_suffix: true
10+
11+
# This will allow for (future) project identification,
12+
# configuration and updates.
13+
project:
14+
name: esphome.project-template
15+
version: "1.0"
16+
17+
esp32:
18+
board: esp32dev
19+
framework:
20+
type: arduino
21+
22+
# To be able to get logs from the device via serial and api.
23+
logger:
24+
25+
# API is a requirement of the dashboard import.
26+
api:
27+
28+
# OTA is required for Over-the-Air updating
29+
ota:
30+
31+
# This should point to the public location of this yaml file.
32+
dashboard_import:
33+
package_import_url: github://esphome/esphome-project-template/project-template-esp32.yaml@main
34+
35+
wifi:
36+
# Set up a wifi access point using the device name above
37+
ap:
38+
password: "12345678"
39+
40+
# In combination with the `ap` this allows the user
41+
# to provision wifi credentials to the device.
42+
captive_portal:
43+
44+
##########################################################
45+
# Most projects should not remove anything from above here
46+
# and should just modify the name, project name/version
47+
# and git url for the dashboard_import
48+
##########################################################
49+
50+
51+
# Sets up Bluetooth LE (Only on ESP32) to allow the user
52+
# to provision wifi credentials to the device.
53+
esp32_improv:
54+
authorizer: none
55+
56+
# Sets up the improv via serial client for Wi-Fi provisioning.
57+
# Handy if your device has a usb port for the user to add credentials when they first get it.
58+
improv_serial:

project-template-esp8266.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# These substitutions allow the end user to override certain values
2+
substitutions:
3+
name: "project-template"
4+
5+
esphome:
6+
name: "${name}"
7+
# Automatically add the mac address to the name
8+
# so you can use a single firmware for all devices
9+
name_add_mac_suffix: true
10+
11+
# This will allow for (future) project identification,
12+
# configuration and updates.
13+
project:
14+
name: esphome.project-template
15+
version: "1.0"
16+
17+
esp8266:
18+
board: d1_mini
19+
20+
# To be able to get logs from the device via serial and api.
21+
logger:
22+
23+
# API is a requirement of the dashboard import.
24+
api:
25+
26+
# OTA is required for Over-the-Air updating
27+
ota:
28+
29+
# This should point to the public location of this yaml file.
30+
dashboard_import:
31+
package_import_url: github://esphome/esphome-project-template/project-template-esp8266.yaml@main
32+
33+
wifi:
34+
# Set up a wifi access point using the device name above
35+
ap:
36+
password: "12345678"
37+
38+
# In combination with the `ap` this allows the user
39+
# to provision wifi credentials to the device.
40+
captive_portal:
41+
42+
43+
##########################################################
44+
# Most projects should not remove anything from above here
45+
# and should just modify the name, project name/version
46+
# and git url for the dashboard_import
47+
##########################################################
48+
49+
50+
# Sets up the improv via serial client for Wi-Fi provisioning.
51+
# Handy if your device has a usb port for the user to add credentials when they first get it.
52+
improv_serial:

static/_config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# CHANGEME: Set these variable to your liking
2+
title: ESPHome Project Template
3+
description: Powered by ESPHome and ESP Web Tools
4+
theme: jekyll-theme-slate

static/index.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# About
2+
3+
Add some information about your project here.
4+
5+
# Installation
6+
7+
You can use the button below to install the pre-built firmware directly to your device via USB from the browser.
8+
9+
<esp-web-install-button manifest="./manifest.json"></esp-web-install-button>
10+
11+
<script type="module" src="https://unpkg.com/esp-web-tools@9/dist/web/install-button.js?module"></script>

0 commit comments

Comments
 (0)