Skip to content

fix: raise ConfigEntryNotReady when amp is unreachable at startup#24

Closed
steve28 wants to merge 1 commit into
theharshl:mainfrom
steve28:fix/config-entry-not-ready
Closed

fix: raise ConfigEntryNotReady when amp is unreachable at startup#24
steve28 wants to merge 1 commit into
theharshl:mainfrom
steve28:fix/config-entry-not-ready

Conversation

@steve28

@steve28 steve28 commented Jul 12, 2026

Copy link
Copy Markdown

async_setup_entry let async_get_client's ValueError (device not detected, e.g. amp powered off) propagate as a raw exception, which HA treats as a hard setup failure with no auto-retry. Reload was required manually once the amp came back on.

Wrap the connection/probe logic and re-raise as ConfigEntryNotReady so HA's built-in retry-with-backoff picks the entry back up on its own once the device responds again.

fixes #23

async_setup_entry let async_get_client's ValueError (device not
detected, e.g. amp powered off) propagate as a raw exception, which
HA treats as a hard setup failure with no auto-retry. Reload was
required manually once the amp came back on.

Wrap the connection/probe logic and re-raise as ConfigEntryNotReady
so HA's built-in retry-with-backoff picks the entry back up on its
own once the device responds again.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@theharshl

Copy link
Copy Markdown
Owner

This response largely written by Claude but offer some decent detail.

Thanks for digging into this, @steve28, I appreciate you taking the time to submit a fix.

This issue is hopefully now fixed as of htd-home-assistant v0.0.36 (paired with python-htd v0.1.6), so I'm going to close this PR as superseded. The shipped fix takes a similar approach to yours, catching a connection failure in async_setup_entry and raising ConfigEntryNotReady so Home Assistant retries with exponential backoff, but scopes the catch more narrowly: the library now raises a dedicated HtdConnectionError only when the initial device probe/connect fails, and the integration catches only that specific exception rather than any Exception raised during setup. That keeps genuine bugs elsewhere in setup (e.g. in the source/zone name queries) visible as real errors instead of being silently swallowed into "retry forever."

One thing your PR got right that the shipped fix doesn't yet cover: wrapping the post-connect source/zone-name queries too, so a device that connects fine but drops mid-setup also retries gracefully. I've opened #25 to track that as a scoped follow-up.

Thanks again for the report and the fix! Closing this in favor of v0.0.36, but your PR helped confirm the right shape for the solution.

@theharshl theharshl closed this Jul 13, 2026
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.

Amp not on on HA start raises failure

2 participants