fix: Apollo firmware version always showing unknown - #85
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAn action to update the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
Problem
The
Apollo Firmware Versiontext 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 whencomponent.update: apollo_firmware_versionis explicitly called. That call only exists insidereportAllValues— butreportAllValuesis gated behind theelsebranch ofon_client_connected:prevent_sleepORota_modeis ON → only prevents deep sleep,reportAllValuesnever runsreportAllValuesruns, then device sleepsprevent_sleephasrestore_mode: RESTORE_DEFAULT_ON, so it defaults to ON for any device in always-on mode (which is the common case). Result:reportAllValuesnever executes, the sensor never gets a value, and HA shows "unknown" indefinitely.Fix
Add
component.update: apollo_firmware_versionat the start ofon_client_connected, before the 90s delay and the conditional. This fires unconditionally on every HA connection regardless of sleep mode.The existing call in
reportAllValuesis kept as-is (harmless, provides an extra update on sleep-cycle wakes).Test Plan
prevent_sleepON (default after first boot/factory reset)Apollo Firmware Versionshows the version string in HA immediately after connectingprevent_sleepOFF (sleep cycle mode)Summary by CodeRabbit