Improve Webflash

This commit is contained in:
iranl
2025-04-13 21:46:26 +02:00
parent cc118edbfb
commit ea192d3c0d
5 changed files with 111 additions and 51 deletions

View File

@@ -113,23 +113,22 @@ jobs:
run: | run: |
mkdir -p ota/beta/ mkdir -p ota/beta/
mkdir -p ota/master/ mkdir -p ota/master/
mkdir -p webflash/
mkdir -p resources/ mkdir -p resources/
mkdir -p src/ mkdir -p src/
cp -vf release/*/nuki_hub_*.bin ota/beta/ cp -vf release/*/nuki_hub_*.bin ota/beta/
cp -vf master/resources/ota_manifest.py resources/ota_manifest.py cp -vf master/resources/ota_manifest.py resources/ota_manifest.py
cp -vf master/src/Config.h src/Config.h cp -vf master/src/Config.h src/Config.h
python3 resources/ota_manifest.py beta $Version python3 resources/ota_manifest.py beta $Version
find * -not -path "ota*" -not -path "webflash*" -delete find * -not -path "ota*" -delete
rm -rf .github .gitignore .gitmodules rm -rf .github .gitignore .gitmodules
touch ota/beta/empty touch ota/beta/empty
touch ota/beta/dummy.bin
touch ota/master/empty touch ota/master/empty
touch webflash/empty
- name: Commit binaries to binary - name: Commit binaries to binary
uses: stefanzweifel/git-auto-commit-action@v5 uses: stefanzweifel/git-auto-commit-action@v5
with: with:
commit_message: "Update binaries" commit_message: "Update binaries"
file_pattern: 'ota/* ota/master/* ota/beta/* webflash/*' file_pattern: 'ota/* ota/master/* ota/beta/*'
branch: binary branch: binary
skip_dirty_check: true skip_dirty_check: true
skip_fetch: true skip_fetch: true

View File

@@ -136,23 +136,21 @@ jobs:
run: | run: |
mkdir -p ota/beta/ mkdir -p ota/beta/
mkdir -p ota/master/ mkdir -p ota/master/
mkdir -p webflash/
mkdir -p resources/ mkdir -p resources/
mkdir -p src/ mkdir -p src/
cp -vf release/*/nuki_hub_*.bin ota/master/ cp -vf release/*/nuki_hub_*.bin ota/master/
cp -vf master/resources/ota_manifest.py resources/ota_manifest.py cp -vf master/resources/ota_manifest.py resources/ota_manifest.py
cp -vf master/src/Config.h src/Config.h cp -vf master/src/Config.h src/Config.h
python3 resources/ota_manifest.py master $Version python3 resources/ota_manifest.py master $Version
find * -not -path "ota*" -not -path "webflash*" -delete find * -not -path "ota*" -delete
rm -rf .github .gitignore .gitmodules rm -rf .github .gitignore .gitmodules
touch ota/beta/empty touch ota/beta/empty
touch ota/master/empty touch ota/master/empty
touch webflash/empty
- name: Commit binaries to binary - name: Commit binaries to binary
uses: stefanzweifel/git-auto-commit-action@v5 uses: stefanzweifel/git-auto-commit-action@v5
with: with:
commit_message: "Update binaries" commit_message: "Update binaries"
file_pattern: 'ota/* ota/master/* ota/beta/* webflash/*' file_pattern: 'ota/* ota/master/* ota/beta/*'
branch: binary branch: binary
skip_dirty_check: true skip_dirty_check: true
skip_fetch: true skip_fetch: true

View File

@@ -124,7 +124,7 @@ jobs:
echo "${FOLDER} -- ${ZIPFILE}" echo "${FOLDER} -- ${ZIPFILE}"
cd $FOLDER cd $FOLDER
zip -9r ../../${ZIPFILE} * -x "webflash_nuki_hub_*.bin" zip -9r ../../${ZIPFILE} *
ARTIFACTS="${ARTIFACTS}${ZIPFILE}," ARTIFACTS="${ARTIFACTS}${ZIPFILE},"
cd ../.. cd ../..
@@ -148,13 +148,12 @@ jobs:
artifacts: ${{ steps.zip.outputs.artifacts }} artifacts: ${{ steps.zip.outputs.artifacts }}
artifactContentType: application/zip artifactContentType: application/zip
tag: ${{ steps.get_version.outputs.VERSION }} tag: ${{ steps.get_version.outputs.VERSION }}
- name: Copy binaries to ota and webflash and remove beta - name: Copy binaries to ota and remove beta
env: env:
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
run: | run: |
mkdir -p ota/beta/ mkdir -p ota/beta/
mkdir -p ota/master/ mkdir -p ota/master/
mkdir -p webflash/
mkdir -p resources/ mkdir -p resources/
mkdir -p src/ mkdir -p src/
cp -vf release/*/nuki_hub_*.bin ota/ cp -vf release/*/nuki_hub_*.bin ota/
@@ -162,17 +161,16 @@ jobs:
cp -vf master/src/Config.h src/Config.h cp -vf master/src/Config.h src/Config.h
python3 resources/ota_manifest.py release $Version python3 resources/ota_manifest.py release $Version
python3 resources/ota_manifest.py beta none python3 resources/ota_manifest.py beta none
find * -not -path "ota*" -not -path "webflash*" -delete find * -not -path "ota*" -delete
rm -rf ota/beta/*.bin rm -rf ota/beta/*.bin
rm -rf .github .gitignore .gitmodules rm -rf .github .gitignore .gitmodules
touch ota/beta/empty touch ota/beta/empty
touch ota/master/empty touch ota/master/empty
touch webflash/empty
- name: Commit binaries to binary - name: Commit binaries to binary
uses: stefanzweifel/git-auto-commit-action@v5 uses: stefanzweifel/git-auto-commit-action@v5
with: with:
commit_message: "Update binaries" commit_message: "Update binaries"
file_pattern: 'ota/* ota/master/* ota/beta/* webflash/*' file_pattern: 'ota/* ota/master/* ota/beta/*'
branch: binary branch: binary
skip_dirty_check: true skip_dirty_check: true
skip_fetch: true skip_fetch: true

View File

@@ -129,7 +129,6 @@ This project is free to use for everyone. However if you feel like donating, you
Flash the firmware to an ESP32. The easiest way to install is to use the web installer using a compatible browser like Chrome/Opera/Edge:<br> Flash the firmware to an ESP32. The easiest way to install is to use the web installer using a compatible browser like Chrome/Opera/Edge:<br>
https://technyon.github.io/nuki_hub/<br> https://technyon.github.io/nuki_hub/<br>
NOTE: Webflash is not available for the ESP32-Solo1<br>
<br> <br>
Alternatively download the latest release for your ESP32 model from https://github.com/technyon/nuki_hub/releases<br> Alternatively download the latest release for your ESP32 model from https://github.com/technyon/nuki_hub/releases<br>
Unpack the zip archive and read the included how-to-flash.txt for installation instructions for either "Espressif Flash Download Tools" or "esptool".<br> Unpack the zip archive and read the included how-to-flash.txt for installation instructions for either "Espressif Flash Download Tools" or "esptool".<br>
@@ -212,7 +211,6 @@ You can check on the info page of the Web configurator if PSRAM is available.
Note that there are two builds of Nuki Hub for the ESP32-S3 available.<br> Note that there are two builds of Nuki Hub for the ESP32-S3 available.<br>
One for devices with no or Quad SPI PSRAM and one for devices with Octal SPI PSRAM.<br> One for devices with no or Quad SPI PSRAM and one for devices with Octal SPI PSRAM.<br>
Webflash will automatically flash the no/Quad SPI PSRAM build when an ESP32-S3 is connected.<br>
If your ESP32-S3 device has PSRAM but it is not detected please switch to the other S3 binary.<br> If your ESP32-S3 device has PSRAM but it is not detected please switch to the other S3 binary.<br>
You can do this by flashing the correct binaries manually or by selecting the option to switch S3 binary build from the Firmware Update page of the Web Configurator. You can do this by flashing the correct binaries manually or by selecting the option to switch S3 binary build from the Firmware Update page of the Web Configurator.

View File

@@ -1,37 +1,104 @@
<!DOCTYPE html> <!DOCTYPE html>
<title>Nuki Hub web installer</title> <html lang="en" class="">
<html> <head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
<title>Install NukiHub</title>
<style>
div,input,select{padding:5px;font-size:1em;}
input{width:100%;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;background:#dddddd;color:#000000;}
input[type=checkbox],input[type=radio]{width:1em;margin-right:6px;vertical-align:-1px;}
input[type=range]{width:99%;}
select{width:100%;background:#dddddd;color:#000000;}
body{text-align:center;font-family:verdana,sans-serif;background:#252525;}
button{border:0;border-radius:0.3rem;background:#1fa3ec;color:#faffff;line-height:2.4rem;font-size:1.2rem;width:100%;-webkit-transition-duration:0.4s;transition-duration:0.4s;cursor:pointer;}
button:hover{background:#0e70a4;}
a{color:#1fa3ec;text-decoration:none;}
.pick-variant{margin-bottom:16px;}
</style>
<script type="module" src="https://unpkg.com/esp-web-tools/dist/web/install-button.js?module"></script>
<script>
window.addEventListener("load", function(event) {
const button = document.querySelector("esp-web-install-button");
const selectEl = document.querySelector("#pick-variant-selector");
fetch("https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/dummy.bin").then(function(response) {
<body> if (!response.ok) {
<h1>Nuki Hub</h1> throw new Error("Not 2xx response", {cause: response});
}
<div id="main" style="display: none;"> else {
for (let i = 0; i < selectEl.options.length; i++) {
<br> const text = selectEl.options[i].value;
<script if (text == '') {
type="module" selectEl.remove(i);
src="https://unpkg.com/esp-web-tools/dist/web/install-button.js?module"> i--;
</script> }
<esp-web-install-button id="installButton" manifest="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/webflash_manifest.json"></esp-web-install-button> }
<br><br><br><br> }
Note: If flashing doesn't work, press and hold the "BOOT" switch, then click "Install". }).catch(function(err) {
</div> for (let i = 0; i < selectEl.options.length; i++) {
<div id="notSupported" style="display: none;"> const text = selectEl.options[i].value;
Your browser does not support the Web Serial API. Try a different browser like Chrome, Opera, Edge. if (text.includes('/beta/')) {
</div> selectEl.remove(i);
i--;
}
<script> }
if(navigator.serial){ });
document.getElementById("notSupported").style.display = 'none'; try{
document.getElementById("main").style.display = 'block'; button.manifest = "https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/webflash_manifest.json";
} else { selectEl.addEventListener("change", () => {
document.getElementById("notSupported").style.display = 'block'; button.manifest = selectEl.value;
document.getElementById("main").style.display = 'none'; });
} }
</script> catch(e){
console.log(e);
</body> }
},{ once: true });
</html> </script>
</head>
<body>
<div style='display:inline-block;color:#eaeaea;min-width:340px;'>
<h1>Install NukiHub</h1>
<div class='pick-variant'>
<ol style='text-align:left'>
<li>Connect the ESP device to your computer</br>using USB or serial-to-USB adapter</li></br>
<li>Select the firmware variant suitable for</br>your device</li></br>
<li>Click "Connect" and select the correct port</br>or find help if <a href="https://github.com/technyon/nuki_hub" target='_blank' style='color:#aaa;'>no device found</a></li>
</ol>
</br>
</br>
<div id="URL_based_input" class="collapsible">
<select id="pick-variant-selector">
<optgroup label="Release version">
<option label="NukiHub Default (ESP32, ESP32-C3, ESP32-C6, ESP32-S3, ESP32-P4)" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/webflash_manifest.json"></option>
<option label="NukiHub ESP32-S3 OCTAL PSRAM" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/webflash_manifest_s3octal.json"></option>
<option label="NukiHub ESP32-SOLO1" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/webflash_manifest_solo1.json"></option>
<option label="NukiHub GL-S10" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/webflash_manifest_gls10.json"></option>
</optgroup>
<optgroup label="Beta version">
<option class="beta" label="NukiHub Default (ESP32, ESP32-C3, ESP32-C6, ESP32-S3, ESP32-P4)" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/webflash_manifest.json"></option>
<option class="beta" label="NukiHub ESP32-S3 OCTAL PSRAM" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/webflash_manifest_s3octal.json"></option>
<option class="beta" label="NukiHub GL-S10" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/webflash_manifest_gls10.json"></option>
<option class="beta" label="NukiHub ESP32-SOLO1" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/webflash_manifest_solo1.json"></option>
<option class="beta" label="No Beta available" disabled value=""></option>
</optgroup>
<optgroup label="Development version">
<option label="NukiHub Default (ESP32, ESP32-C3, ESP32-C6, ESP32-S3, ESP32-P4)" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/webflash_manifest.json"></option>
<option label="NukiHub ESP32-S3 OCTAL PSRAM" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/webflash_manifest_s3octal.json"></option>
<option label="NukiHub ESP32-SOLO1" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/webflash_manifest_solo1.json"></option>
<option label="NukiHub GL-S10" value="https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/webflash_manifest_gls10.json"></option>
</optgroup>
</select>
</div>
</br>
<esp-web-install-button id="inst" style='text-align:center'>
<i slot="unsupported">Your browser does not support Web Serial.</br>Open this page in Google Chrome or</br>Microsoft Edge instead.</i>
</esp-web-install-button>
</div>
<div style='text-align:right;font-size:11px;'>
<hr/>
<a href="https://esphome.github.io/esp-web-tools/" target='_blank' style='color:#aaa;'>NukiHub Installer inspired by Tasmota and ESP Web Tools</a>
</div>
</div>
</body>
</html>