Skip to content

Fix Apollo Firmware Version sensor showing unknown#59

Merged
bharvey88 merged 6 commits intobetafrom
fix/firmware-version-sensor
Mar 7, 2026
Merged

Fix Apollo Firmware Version sensor showing unknown#59
bharvey88 merged 6 commits intobetafrom
fix/firmware-version-sensor

Conversation

@bharvey88
Copy link
Contributor

@bharvey88 bharvey88 commented Mar 6, 2026

Version:

What does this implement/fix?

Fixes Apollo Firmware Version text sensor showing "unknown" in Home Assistant.

  • Replaced component.update with text_sensor.template.publish for the version sensor in reportAllValues script (Battery.yaml and NonBattery.yaml)
  • Removed update_interval: never so the lambda also fires periodically (every 60s) as a fallback

The root cause is that ESPHome's component.update action silently skips execution when the component's is_ready() check fails (see UpdateComponentAction::play() in esphome/core/base_automation.h). The text_sensor.template.publish action calls publish_state() directly without this guard.

Same fix as ApolloAutomation/AIR-1#87

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

Summary by CodeRabbit

  • Bug Fixes
    • Apollo Firmware Version sensor no longer emits values via the prior automatic update mechanism.
  • New Features
    • PLT-1 family devices now explicitly publish the firmware version at device boot so the version is available on startup.

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

Walkthrough

Removed automated updates to the apollo_firmware_version sensor in report scripts and removed the lambda that populated the Core text_sensor; added on_boot actions (priority 500) across multiple PLT configs to publish the firmware version to the apollo_firmware_version text_sensor.

Changes

Cohort / File(s) Summary
Report scripts (removed sensor update)
Integrations/ESPHome/Battery.yaml, Integrations/ESPHome/NonBattery.yaml
Deleted the component.update/reportAllValues step that updated apollo_firmware_version.
Core sensor definition (lambda removed)
Integrations/ESPHome/Core.yaml
Removed the lambda that returned the Apollo Firmware Version for the text_sensor id apollo_firmware_version; the sensor id remains but no longer emits a lambda-derived value.
PLT on_boot publishing (added)
Integrations/ESPHome/PLT-1.yaml, Integrations/ESPHome/PLT-1_Minimal.yaml, Integrations/ESPHome/PLT-1_BLE.yaml, Integrations/ESPHome/PLT-1B.yaml, Integrations/ESPHome/PLT-1B_Minimal.yaml, Integrations/ESPHome/PLT-1B_BLE.yaml
Added on_boot actions (priority 500) that call text_sensor.template.publish with id: apollo_firmware_version and state: "${version}" to publish firmware version at boot. One file inserts publish before existing lambda/deep-sleep logic; others add the publish alongside existing boot actions. One file explicitly declares the apollo_firmware_version publish entry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰
I nibbled YAML by the moon,
Took a lambda from its tune,
Then on boot I softly sing,
"Version here!"—I publish spring,
A hop, a beep, a tiny rune.

🚥 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 sensor showing unknown' clearly and specifically describes the main change—fixing a bug where the firmware version sensor displayed 'unknown' in Home Assistant. It is concise, directly related to the primary purpose of the changeset, and provides meaningful context about the problem being solved.
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-sensor

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.

@bharvey88
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Per ESPHome dev feedback: the version is a compile-time constant, so
publish it once on_boot rather than using a lambda with periodic updates.
Removed component.update from reportAllValues scripts.
The text sensor component sets up at priority 800 (HARDWARE), so
publishing at the same priority races with component init. Move to
priority 600 so the component is ready when publish fires.
Adding logger.log before text_sensor.template.publish to debug
why the publish isn't working at priority 500.
Add text_sensor.template.publish for apollo_firmware_version
to PLT-1_Minimal, PLT-1B, PLT-1B_Minimal, PLT-1_BLE, and
PLT-1B_BLE. Remove debug log from PLT-1.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
Integrations/ESPHome/PLT-1B.yaml (1)

26-30: Consider centralizing the firmware-version publish.

This exact on_boot publish block now exists across every PLT-1 variant touched by the PR. Moving it into Core.yaml or another shared include would reduce drift the next time this sensor logic changes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Integrations/ESPHome/PLT-1B.yaml` around lines 26 - 30, Duplicate on_boot
firmware publish block (text_sensor.template.publish with id
apollo_firmware_version and state "${version}") should be centralized: remove
the repeated block from each PLT-1 variant and add the single publish definition
into the shared Core.yaml (or another common include) so all variants inherit
it; ensure Core.yaml is included by the variant configs and that the centralized
block uses the same id (apollo_firmware_version) and state expression so
behavior remains identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@Integrations/ESPHome/PLT-1B.yaml`:
- Around line 26-30: Duplicate on_boot firmware publish block
(text_sensor.template.publish with id apollo_firmware_version and state
"${version}") should be centralized: remove the repeated block from each PLT-1
variant and add the single publish definition into the shared Core.yaml (or
another common include) so all variants inherit it; ensure Core.yaml is included
by the variant configs and that the centralized block uses the same id
(apollo_firmware_version) and state expression so behavior remains identical.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 165e329c-feeb-467a-8fcc-0b93f332cabe

📥 Commits

Reviewing files that changed from the base of the PR and between a81a49d and e8820f7.

📒 Files selected for processing (6)
  • Integrations/ESPHome/PLT-1.yaml
  • Integrations/ESPHome/PLT-1B.yaml
  • Integrations/ESPHome/PLT-1B_BLE.yaml
  • Integrations/ESPHome/PLT-1B_Minimal.yaml
  • Integrations/ESPHome/PLT-1_BLE.yaml
  • Integrations/ESPHome/PLT-1_Minimal.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • Integrations/ESPHome/PLT-1.yaml

@bharvey88
Copy link
Contributor Author

confirmed working with sleep as well!

@bharvey88 bharvey88 merged commit 21771d3 into beta Mar 7, 2026
20 checks passed
@bharvey88 bharvey88 deleted the fix/firmware-version-sensor branch March 7, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants