Repository navigation
Add firmware notification system for OTA updates - #9
Merged
Merged
Conversation
- Parse firmware version format '<project>@<semver>+<hash>' in TCP login (opcode 0x09) - Store parsed project and semver on device sessions - Add POST /api/firmware/:project/notify endpoint with admin auth - Support optional notify flag on upload/current endpoints (?notify=true) - Add --notify option to tools/firmware/upload.ts CLI - Expose updateAvailable in GET /telemetry/devices - Record firmware_notify telemetry events - Send updateReady API call to devices via opcode 0x04 - Skip legacy firmware formats (never break old devices) - Comprehensive tests for version parsing, selection logic, auth, and 0x04 send - Document complete OTA flow in docs/firmware-ota.md Co-authored-by: James Brown <JamesSmartCell@users.noreply.github.com>
- Extract semver from any format (plain, v-prefix, @project, +build) - compareSemver/isOlder handle different version formats - Treat unparseable latest versions as error (do not notify) - Validate upload version is plain semver MAJOR.MINOR.PATCH - Reject v-prefix, @project prefix, +build suffix at upload - Add validation in POST /firmware/:project endpoint - Add validation in tools/firmware/upload.ts with clear error messages - Update docs: version must equal device FIRMWARE_SEMVER exactly - Comprehensive tests for extractSemver, isPlainSemver, format mixing - Tests for upload validation and unparseable version handling - All 196 tests pass, typecheck passes Co-authored-by: James Brown <JamesSmartCell@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Implements a complete firmware notification system to enable Over-The-Air (OTA) updates for SmartLayer IoT devices. This adds the "notify devices" step to the existing firmware upload infrastructure.
Changes
Core Features
<project>@<semver>+<hash>from TCP login (opcode 0x09)POST /api/firmware/:project/notifywith admin authentication?notify=trueflag on upload/current endpoints--notifyoption totools/firmware/upload.tsupdateAvailableinGET /telemetry/devicesfirmware_notifytelemetry eventsupdateReadyAPI call to devices via opcode 0x04Implementation Details
Version Format
New-style GarageDoor firmware uses:
Legacy firmware (opcode 0x07, non-standard versions) is never notified and continues to work unchanged.
Selection Logic
The notify endpoint:
force: trueto notify all devicesdevices: [...]array to target specific devicesAPI Flow
POST /api/firmware/:project?version=1.2.0¬ify=truePOST /api/firmware/:project/notifyupdateReadycall via opcode 0x04GET /api/firmware/:project/latestto get metadataTesting
Documentation
Complete documentation added in
docs/firmware-ota.md:Security
Breaking Changes
None. This is purely additive. Legacy devices are unaffected.