Fix crash on setup from removed hass.components.persistent_notification - #10
Merged
Conversation
jsight
pushed a commit
that referenced
this pull request
Jul 30, 2026
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
hass.components was removed from modern Home Assistant core, so every persistent notification call (no devices found, connection failure, invalid/read-only property, failed switch/select control) raised AttributeError and aborted config entry setup entirely. Switch to homeassistant.components.persistent_notification.async_create(hass, ...). This was masking the real error message in GH#8 (API error 5014/5041: No permission), turning a soft failure into a hard setup crash. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
jsight
force-pushed
the
fix/persistent-notification-crash
branch
from
July 30, 2026 23:19
b5e6a23 to
c13bc9c
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hass.components.persistent_notificationwas removed from modern Home Assistant core. Every persistent-notification call site in__init__.py,switch.py, andselect.pystill used the old accessor, so any code path that tried to show a notification (no devices found, initial connection failure, invalid/read-only property, failed switch/select control) raisedAttributeError: 'HomeAssistant' object has no attribute 'components'and aborted config entry setup entirely.homeassistant.components.persistent_notification.async_create(hass, ...).AttributeError, masking the real error message. The underlying cloud-side "No permission" error itself is still open and needs further investigation with the reporter's account, but setup no longer crashes and the real error now reaches the log/user.Relates to #8.
Test plan
ruff format+ruff checkclean (aside from one pre-existing unrelated unused import)pytest— all 43 existing tests pass🤖 Generated with Claude Code