Skip to content

Add Firmware Channel switching from HA#110

Closed
bharvey88 wants to merge 1 commit into
betafrom
firmware-channel
Closed

Add Firmware Channel switching from HA#110
bharvey88 wants to merge 1 commit into
betafrom
firmware-channel

Conversation

@bharvey88

@bharvey88 bharvey88 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Version: 26.7.7.1

What does this implement/fix?

Same Stable/Beta firmware switching as CAST-1 (naming per ApolloAutomation/CAST-1#43):

  • Firmware Channel select (Stable/Beta) sets the OTA manifest URL via a new apply_ota_source script. Stable = GitHub Pages (main branch builds), Beta = rolling beta pre-release assets. Each image tracks its own variant's manifests through a build-time ble_firmware substitution; there is no user-facing variant switching.
  • Firmware Update button force-installs the selected channel's firmware. It re-applies the manifest URL first (so a just-switched channel is fetched before forcing) and temporarily disables BLE during the download to free heap for TLS (no-op on non-BLE images).
  • build-beta.yml (new): pushes to beta build the end-user images and publish them to a rolling beta pre-release, with manifests rewritten to absolute URLs and bins prefixed per variant.
  • Updates now serve the end-user image: CI builds AIR-1.yaml as firmware/ and moves the Factory image to firmware-factory/, which only the web installer uses. On their next update, fielded devices leave the Factory image, drop improv BLE, and reclaim flash.

Supersedes #107 (fresh minimal port against current beta; the variant-switching scope from that PR is not included).

All three variants config-validated on ESPHome 2026.6.4. Not yet tested on hardware.

Types of changes

  • Bugfix (fixed change that fixes an issue)
  • New feature (thanks!)
  • Breaking change (repair/feature that breaks existing functionality)
  • Dependency Update - Does not publish
  • Other - Does not publish
  • Website of github readme file update - Does not publish
  • Github workflows - Does not publish

Checklist / Checklijst:

  • The code change has been tested and works locally
  • The code change has not yet been tested

If user-visible functionality or configuration variables are added/modified:

  • Added/updated documentation for the web page

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added beta firmware channel support with separate standard and BLE builds.
    • Introduced on-device firmware update controls, including a Stable/Beta firmware channel selector.
    • Updated the update process to use channel-specific OTA manifests.
  • Bug Fixes
    • Improved OTA update behavior (device wake handling and safer BLE/deep-sleep coordination).
  • Style
    • Updated web installer behavior to reference the factory firmware manifest for first-time setup.
    • Refined firmware versioning and naming for clearer release selection.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8581c13f-674a-48a1-addd-94c8d06cf534

📥 Commits

Reviewing files that changed from the base of the PR and between 51ad52d and 67033a8.

📒 Files selected for processing (7)
  • .github/workflows/build-beta.yml
  • .github/workflows/build.yml
  • Integrations/ESPHome/AIR-1_BLE.yaml
  • Integrations/ESPHome/Core.yaml
  • Integrations/ESPHome/beta-channel/AIR-1.yaml
  • Integrations/ESPHome/beta-channel/AIR-1_BLE.yaml
  • static/index.html
✅ Files skipped from review due to trivial changes (1)
  • Integrations/ESPHome/beta-channel/AIR-1.yaml
🚧 Files skipped from review as they are similar to previous changes (5)
  • static/index.html
  • .github/workflows/build-beta.yml
  • Integrations/ESPHome/AIR-1_BLE.yaml
  • .github/workflows/build.yml
  • Integrations/ESPHome/Core.yaml

Walkthrough

This PR adds beta build-and-publish automation, updates AIR-1 build mappings, and introduces ESPHome firmware channel selection with OTA manifest switching and a factory-manifest web installer path.

Changes

Beta Release Pipeline and Firmware Channel Switching

Layer / File(s) Summary
Beta build and publish workflow
.github/workflows/build-beta.yml
The new GitHub Actions workflow extracts the firmware version, builds standard and BLE beta artifacts, creates the rolling beta pre-release, rewrites manifest URLs, and uploads the published assets.
AIR-1 build mapping
.github/workflows/build.yml, Integrations/ESPHome/AIR-1_BLE.yaml
The reusable build workflow now includes the AIR-1 end-user YAML and maps firmware names for the main, factory, and BLE variants.
Firmware channel and OTA routing
Integrations/ESPHome/Core.yaml, Integrations/ESPHome/beta-channel/AIR-1.yaml, Integrations/ESPHome/beta-channel/AIR-1_BLE.yaml, static/index.html
Core.yaml adds firmware identity and manifest base substitutions, the firmware update button, the Stable/Beta channel select, and the OTA source script; beta-channel YAML files set Beta defaults and the web installer points to the factory manifest.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: TrevorSchirmer

Poem

A rabbit hops through YAML lines anew,
Beta winds and stable paths both grew.
Manifests now point just where they should,
OTA bounds dance as firmware would,
And boots from factory start the view.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: adding firmware channel switching from Home Assistant.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch firmware-channel

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/build-beta.yml (1)

29-34: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Fragile version extraction via awk.

This works today because version: is the first key after substitutions: and no other line in that block contains the literal substring version:. Any reordering of substitutions, or adding a key whose value contains version:, will silently produce a wrong/empty v, which flows straight into release-version for the reusable build workflow. Consider yq for structural correctness (e.g. yq '.substitutions.version' Integrations/ESPHome/Core.yaml).

♻️ Suggested fix using yq
-          v=$(awk '/substitutions:/ {f=1} f && /version:/ {print $2; exit}' \
-            Integrations/ESPHome/Core.yaml | tr -d '"')
+          v=$(yq -r '.substitutions.version' Integrations/ESPHome/Core.yaml)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build-beta.yml around lines 29 - 34, The version lookup in
the build-beta workflow is too fragile because the awk-based parsing in the read
step depends on key order and can break if the substitutions block changes.
Update the read step to use a संरuctural YAML parser such as yq to read the
version field directly from the substitutions object in Core.yaml, and keep the
output assignment to GITHUB_OUTPUT in the same step so release-version receives
the correct value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/build-beta.yml:
- Around line 29-34: The version lookup in the build-beta workflow is too
fragile because the awk-based parsing in the read step depends on key order and
can break if the substitutions block changes. Update the read step to use a
संरuctural YAML parser such as yq to read the version field directly from the
substitutions object in Core.yaml, and keep the output assignment to
GITHUB_OUTPUT in the same step so release-version receives the correct value.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 98ff22f3-80b4-404b-95e5-f88c7cad0474

📥 Commits

Reviewing files that changed from the base of the PR and between 1b86a0c and 51ad52d.

📒 Files selected for processing (5)
  • .github/workflows/build-beta.yml
  • .github/workflows/build.yml
  • Integrations/ESPHome/AIR-1_BLE.yaml
  • Integrations/ESPHome/Core.yaml
  • static/index.html

Same Stable/Beta channel switching as CAST-1 (ApolloAutomation/CAST-1#43
naming):

- Firmware Channel select (Stable/Beta) sets the OTA manifest URL via a
  new apply_ota_source script; each image tracks its own variant's
  manifests through the ble_firmware substitution.
- Firmware Update button force-installs the selected channel's firmware.
- build-beta.yml publishes beta builds to a rolling beta pre-release.
- build.yml now builds AIR-1.yaml as firmware/ so updates serve the
  end-user image; the Factory image moves to firmware-factory/ for the
  web installer only.

Beta-channel builds compile thin beta-channel/ wrapper yamls so the
Firmware Channel select defaults to Beta on firmware obtained from the
beta channel (fresh flashes only; stored choices still win).

Version: 26.7.8.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@bharvey88

Copy link
Copy Markdown
Contributor Author

Superseded by #111. MSR-1 shipped the unified redesign as 26.7.9.1 (one image per channel, runtime Bluetooth Proxy switch instead of the ble_firmware substitution split), so this two-image channel architecture is retired before merging. #111 carries the same beta pipeline plus the http_request buffer fixes this branch predates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant