Skip to content

fix: Apollo firmware version always showing unknown - #85

Merged
TrevorSchirmer merged 1 commit into
betafrom
fix-firmware-version-unknown
Mar 5, 2026
Merged

fix: Apollo firmware version always showing unknown#85
TrevorSchirmer merged 1 commit into
betafrom
fix-firmware-version-unknown

Conversation

@bharvey88

@bharvey88 bharvey88 commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Problem

The Apollo Firmware Version text sensor always shows unknown in Home Assistant, even after the device connects and appears online.

Root Cause

The sensor uses update_interval: never, so it only publishes a value when component.update: apollo_firmware_version is explicitly called. That call only exists inside reportAllValues — but reportAllValues is gated behind the else branch of on_client_connected:

  • If prevent_sleep OR ota_mode is ON → only prevents deep sleep, reportAllValues never runs
  • If both are OFF → reportAllValues runs, then device sleeps

prevent_sleep has restore_mode: RESTORE_DEFAULT_ON, so it defaults to ON for any device in always-on mode (which is the common case). Result: reportAllValues never executes, the sensor never gets a value, and HA shows "unknown" indefinitely.

Fix

Add component.update: apollo_firmware_version at the start of on_client_connected, before the 90s delay and the conditional. This fires unconditionally on every HA connection regardless of sleep mode.

api:
  on_client_connected:
    - component.update: apollo_firmware_version  # ← added
    - delay: 90s
    - if: ...

The existing call in reportAllValues is kept as-is (harmless, provides an extra update on sleep-cycle wakes).

Test Plan

  • Flash to AIR-1 with prevent_sleep ON (default after first boot/factory reset)
  • Confirm Apollo Firmware Version shows the version string in HA immediately after connecting
  • Confirm same behavior with prevent_sleep OFF (sleep cycle mode)

Summary by CodeRabbit

  • Bug Fixes
    • Improved Apollo firmware version refresh to ensure it updates when clients connect.

The sensor uses update_interval: never and only updated via reportAllValues,
which is gated behind the prevent_sleep=OFF branch of on_client_connected.
Since prevent_sleep defaults to RESTORE_DEFAULT_ON, the sensor never got
a value in always-on mode and showed "unknown" in HA.

Fix by calling component.update unconditionally at the start of
on_client_connected, before the 90s delay and sleep conditional.
@coderabbitai

coderabbitai Bot commented Mar 4, 2026

Copy link
Copy Markdown

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: 441d16ce-2757-4f94-af6e-c61388ae3147

📥 Commits

Reviewing files that changed from the base of the PR and between 75a08bb and f33a39d.

📒 Files selected for processing (1)
  • Integrations/ESPHome/Core.yaml

Walkthrough

An action to update the apollo_firmware_version component was added to the on_client_connected event handler in the ESPHome Core configuration, ensuring firmware version information is refreshed when a client connects.

Changes

Cohort / File(s) Summary
ESPHome Client Connection Handler
Integrations/ESPHome/Core.yaml
Added apollo_firmware_version update action to on_client_connected event handler to refresh firmware version upon client connection.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 When clients hop along the wire,
A firmware check we now require,
Apollo's version, fresh and bright,
Updates at connection's light! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: Apollo firmware version always showing unknown' directly and accurately summarizes the main change in this PR—fixing a bug where the Apollo firmware version sensor always displayed 'unknown'.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-firmware-version-unknown

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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 and usage tips.

@TrevorSchirmer
TrevorSchirmer merged commit 610954b into beta Mar 5, 2026
12 checks passed
@TrevorSchirmer
TrevorSchirmer deleted the fix-firmware-version-unknown branch March 5, 2026 00:10
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.

2 participants