From a8ce1e3acb10cb485a2244e5e83c2ed2b9b73ac0 Mon Sep 17 00:00:00 2001 From: Stephen Papierski Date: Thu, 11 Jul 2024 17:41:40 -0600 Subject: [PATCH] Initial commit --- .github/workflows/ci.yml | 22 ++++++++++ .github/workflows/publish.yml | 15 +++++++ .gitignore | 5 +++ README.md | 26 ++++++++++++ project-template-esp32-adopt.yaml | 41 +++++++++++++++++++ project-template-esp32-c3-adopt.yaml | 35 ++++++++++++++++ project-template-esp32-c3-release.yaml | 55 +++++++++++++++++++++++++ project-template-esp32-release.yaml | 55 +++++++++++++++++++++++++ project-template-esp32-s3-adopt.yaml | 36 +++++++++++++++++ project-template-esp32-s3-release.yaml | 56 ++++++++++++++++++++++++++ static/_config.yml | 4 ++ static/index.md | 11 +++++ 12 files changed, 361 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 project-template-esp32-adopt.yaml create mode 100644 project-template-esp32-c3-adopt.yaml create mode 100644 project-template-esp32-c3-release.yaml create mode 100644 project-template-esp32-release.yaml create mode 100644 project-template-esp32-s3-adopt.yaml create mode 100644 project-template-esp32-s3-release.yaml create mode 100644 static/_config.yml create mode 100644 static/index.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1d1f851 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI + +on: + pull_request: + +jobs: + ci: + name: Building ${{ matrix.file }} + runs-on: ubuntu-latest + strategy: + matrix: + file: + - project-template-esp32-release.yaml + - project-template-esp32-c3-release.yaml + - project-template-esp32-s3-release.yaml + steps: + - name: Checkout source code + uses: actions/checkout@v4.1.7 + - name: Build ESPHome firmware to verify configuration + uses: esphome/build-action@v3.2.0 + with: + yaml_file: ${{ matrix.file }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8930f63 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,15 @@ +name: Build and Publish ESPHome firmware and website + +on: + push: + branches: + - main + +jobs: + build: + uses: esphome/workflows/.github/workflows/publish.yml@main + with: + # CHANGEME: Set the filenames of your config files here: + files: project-template-esp32-release.yaml,project-template-esp32-c3-release.yaml,project-template-esp32-s3-release.yaml + # CHANGEME: Set the name of your project here: + name: Template Project diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8b4157 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Gitignore settings for ESPHome +# This is an example and may include too much for your use-case. +# You can modify this file to suit your needs. +/.esphome/ +/secrets.yaml diff --git a/README.md b/README.md new file mode 100644 index 0000000..56a2f1f --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# ESPHome Project Template + +This repo serves as a template for creating a new ESPHome project. + +It includes a GitHub workflow that will automatically build the configuration(s) and then deploys a simple +website via GitHub pages that utilises [ESP Web Tools](https://esphome.github.io/esp-web-tools/) for users to +easily install your project onto their device. + +## Instructions + +1. Use this repo template to [generate](https://github.com/esphome/esphome-project-template/generate) your own repository. + - Make sure to check `Include all branches` so that GitHub Pages is automatically enabled. +2. Clone your new repository. +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. +4. + a. Update [.github/workflows/publish.yml](.github/workflows/publish.yml) to contain your own YAML config filename(s). + b. Update [.github/workflows/ci.yml](.github/workflows/ci.yml) to contain your own YAML config filename(s). +5. Update [static/_config.yml](static/_config.yml) to change the title, description and basic theme of the generated website. +6. Add more content to the [static/index.md](static/index.md) file to explain your project. + Make sure to leave the installation code tags in place so users get the install button. +7. Add permission to github-actions[bot] + a. go to your project Settings, under the Actions collapsible, click on General. + b. scroll down until you find Workflow permissions and mark the option Read and write permissions. + c. Hit the save button +8. Push your changes to the repository and GitHub Actions will automatically build and deploy your project. + diff --git a/project-template-esp32-adopt.yaml b/project-template-esp32-adopt.yaml new file mode 100644 index 0000000..73460f3 --- /dev/null +++ b/project-template-esp32-adopt.yaml @@ -0,0 +1,41 @@ +esphome: + name: project-template + friendly_name: Project Template + # Automatically add the mac address to the name + # so you can use a single firmware for all devices + name_add_mac_suffix: true + + # This will allow for project identification, + # configuration and updates. + project: + name: esphome.project-template + version: "1.0" + +esp32: + board: esp32dev + framework: + type: esp-idf + +# To be able to get logs from the device via serial and api. +logger: + +# API is a requirement of the dashboard import. +api: + +# OTA is required for Over-the-Air updating +ota: + - platform: esphome + +wifi: + # Set up a wifi access point using the device name above + ap: + +# In combination with the `ap` this allows the user +# to provision wifi credentials to the device. +captive_portal: + +########################################################## +# Most projects should not remove anything from above here +# and should just modify the name, project name/version +# and git url for the dashboard_import +########################################################## diff --git a/project-template-esp32-c3-adopt.yaml b/project-template-esp32-c3-adopt.yaml new file mode 100644 index 0000000..2ffbee7 --- /dev/null +++ b/project-template-esp32-c3-adopt.yaml @@ -0,0 +1,35 @@ +esphome: + name: project-template + friendly_name: Project Template + # Automatically add the mac address to the name + # so you can use a single firmware for all devices + name_add_mac_suffix: true + + # This will allow for project identification, + # configuration and updates. + project: + name: esphome.project-template + version: "1.0" + +esp32: + board: esp32-c3-devkitm-1 + framework: + type: esp-idf + +# To be able to get logs from the device via serial and api. +logger: + +# API is a requirement of the dashboard import. +api: + +# OTA is required for Over-the-Air updating +ota: + - platform: esphome + +wifi: + # Set up a wifi access point using the device name above + ap: + +# In combination with the `ap` this allows the user +# to provision wifi credentials to the device. +captive_portal: diff --git a/project-template-esp32-c3-release.yaml b/project-template-esp32-c3-release.yaml new file mode 100644 index 0000000..5b3e008 --- /dev/null +++ b/project-template-esp32-c3-release.yaml @@ -0,0 +1,55 @@ +esphome: + name: project-template + friendly_name: Project Template + # Automatically add the mac address to the name + # so you can use a single firmware for all devices + name_add_mac_suffix: true + + # This will allow for project identification, + # configuration and updates. + project: + name: esphome.project-template + version: "1.0" + +esp32: + board: esp32-c3-devkitm-1 + framework: + type: esp-idf + +# To be able to get logs from the device via serial and api. +logger: + +# API is a requirement of the dashboard import. +api: + +# OTA is required for Over-the-Air updating +ota: + - platform: esphome + +# This should point to the public location of this yaml file. +dashboard_import: + package_import_url: github://esphome/esphome-project-template/project-template-esp32-c3-adopt.yaml@main + +wifi: + # Set up a wifi access point using the device name above + ap: + +# In combination with the `ap` this allows the user +# to provision wifi credentials to the device. +captive_portal: + +########################################################## +# Most projects should not remove anything from above here +# and should just modify the name, project name/version +# and git url for the dashboard_import +########################################################## + + +# Sets up Bluetooth LE (Only on ESP32) to allow the user +# to provision wifi credentials to the device. +esp32_improv: + authorizer: none + +# Sets up the improv via serial client for Wi-Fi provisioning. +# Handy if your device has a usb port for the user to add credentials when they first get it. +improv_serial: diff --git a/project-template-esp32-release.yaml b/project-template-esp32-release.yaml new file mode 100644 index 0000000..14576b3 --- /dev/null +++ b/project-template-esp32-release.yaml @@ -0,0 +1,55 @@ +esphome: + name: project-template + friendly_name: Project Template + # Automatically add the mac address to the name + # so you can use a single firmware for all devices + name_add_mac_suffix: true + + # This will allow for project identification, + # configuration and updates. + project: + name: esphome.project-template + version: "1.0" + +esp32: + board: esp32dev + framework: + type: esp-idf + +# To be able to get logs from the device via serial and api. +logger: + +# API is a requirement of the dashboard import. +api: + +# OTA is required for Over-the-Air updating +ota: + - platform: esphome + +# This should point to the public location of this yaml file. +dashboard_import: + package_import_url: github://esphome/esphome-project-template/project-template-esp32-adopt.yaml@main + +wifi: + # Set up a wifi access point using the device name above + ap: + +# In combination with the `ap` this allows the user +# to provision wifi credentials to the device. +captive_portal: + +########################################################## +# Most projects should not remove anything from above here +# and should just modify the name, project name/version +# and git url for the dashboard_import +########################################################## + + +# Sets up Bluetooth LE (Only on ESP32) to allow the user +# to provision wifi credentials to the device. +esp32_improv: + authorizer: none + +# Sets up the improv via serial client for Wi-Fi provisioning. +# Handy if your device has a usb port for the user to add credentials when they first get it. +improv_serial: diff --git a/project-template-esp32-s3-adopt.yaml b/project-template-esp32-s3-adopt.yaml new file mode 100644 index 0000000..8c0ad01 --- /dev/null +++ b/project-template-esp32-s3-adopt.yaml @@ -0,0 +1,36 @@ +esphome: + name: project-template + friendly_name: Project Template + # Automatically add the mac address to the name + # so you can use a single firmware for all devices + name_add_mac_suffix: true + + # This will allow for project identification, + # configuration and updates. + project: + name: esphome.project-template + version: "1.0" + +esp32: + board: esp32-s3-devkitc-1 + variant: esp32s3 + framework: + type: esp-idf + +# To be able to get logs from the device via serial and api. +logger: + +# API is a requirement of the dashboard import. +api: + +# OTA is required for Over-the-Air updating +ota: + - platform: esphome + +wifi: + # Set up a wifi access point using the device name above + ap: + +# In combination with the `ap` this allows the user +# to provision wifi credentials to the device. +captive_portal: diff --git a/project-template-esp32-s3-release.yaml b/project-template-esp32-s3-release.yaml new file mode 100644 index 0000000..b4fe3bf --- /dev/null +++ b/project-template-esp32-s3-release.yaml @@ -0,0 +1,56 @@ +esphome: + name: project-template + friendly_name: Project Template + # Automatically add the mac address to the name + # so you can use a single firmware for all devices + name_add_mac_suffix: true + + # This will allow for project identification, + # configuration and updates. + project: + name: esphome.project-template + version: "1.0" + +esp32: + board: esp32-s3-devkitc-1 + variant: esp32s3 + framework: + type: esp-idf + +# To be able to get logs from the device via serial and api. +logger: + +# API is a requirement of the dashboard import. +api: + +# OTA is required for Over-the-Air updating +ota: + - platform: esphome + +# This should point to the public location of this yaml file. +dashboard_import: + package_import_url: github://esphome/esphome-project-template/project-template-esp32-s3-adopt.yaml@main + +wifi: + # Set up a wifi access point using the device name above + ap: + +# In combination with the `ap` this allows the user +# to provision wifi credentials to the device. +captive_portal: + +########################################################## +# Most projects should not remove anything from above here +# and should just modify the name, project name/version +# and git url for the dashboard_import +########################################################## + + +# Sets up Bluetooth LE (Only on ESP32) to allow the user +# to provision wifi credentials to the device. +esp32_improv: + authorizer: none + +# Sets up the improv via serial client for Wi-Fi provisioning. +# Handy if your device has a usb port for the user to add credentials when they first get it. +improv_serial: diff --git a/static/_config.yml b/static/_config.yml new file mode 100644 index 0000000..be78388 --- /dev/null +++ b/static/_config.yml @@ -0,0 +1,4 @@ +# CHANGEME: Set these variable to your liking +title: ESPHome Project Template +description: Powered by ESPHome and ESP Web Tools +theme: jekyll-theme-slate diff --git a/static/index.md b/static/index.md new file mode 100644 index 0000000..8d4764a --- /dev/null +++ b/static/index.md @@ -0,0 +1,11 @@ +# About + +Add some information about your project here. + +# Installation + +You can use the button below to install the pre-built firmware directly to your device via USB from the browser. + + + +