feat: OTA firmware update per device with auto config backup

- Upload .bin firmware files via web UI
- Update individual devices (button per device in table)
- Auto config backup before each update
- Shows current version vs available firmware
- Firmware file management (upload/delete)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 13:08:38 +02:00
co-authored by Claude Opus 4.6
parent 0d6c03049c
commit 9218d10540
4 changed files with 182 additions and 2 deletions
+16
View File
@@ -69,3 +69,19 @@ def restore_wled_config(hostname, config_json):
return r.status_code == 200, f"{r.status_code} {r.reason}"
except requests.exceptions.RequestException as e:
return False, str(e)
def ota_update_wled(hostname, firmware_path):
"""Push firmware binary to WLED device via OTA. Returns (success, message)."""
try:
with open(firmware_path, "rb") as f:
r = requests.post(
f"http://{hostname}/update",
files={"update": ("firmware.bin", f, "application/octet-stream")},
timeout=120,
)
if r.status_code == 200:
return True, "Update erfolgreich, Geraet startet neu"
return False, f"{r.status_code} {r.reason}"
except requests.exceptions.RequestException as e:
return False, str(e)