-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Fix Shelly RPC cover update when the device is not initialized #154159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fixes a bug where Shelly RPC cover entities would crash with NotInitialized exception when the device connection is closed. The issue occurs when the device pushes an update notification after closing the connection, causing the entity to try accessing device status data that's no longer available.
- Added early return in
_update_callbackwhen device is not initialized - Added test case to verify the fix handles uninitialized device updates properly
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| homeassistant/components/shelly/cover.py | Added initialization check in _update_callback to prevent accessing device status when not available |
| tests/components/shelly/test_cover.py | Added test case and import for STATE_UNAVAILABLE to verify proper handling of uninitialized device updates |
|
Hey there @bieniu, @chemelli74, @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Thanks for the fast review |
Proposed change
Fix bug introduced due to #139008, when device closes the connection we push an update from
aioshellyto notify listeners that the device is disconnected/unavailable, this causes an exception since we try to access data from the device:I reviewed other places and this is the only problematic case.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: