-
-
Notifications
You must be signed in to change notification settings - Fork 36.3k
Do not create restart button for sleeping gen2+ Shelly devices
#158047
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
|
Hey there @thecode, @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.
Pull request overview
This PR fixes a bug introduced in #154673 where the restart button was incorrectly created for sleeping gen2+ Shelly devices. Since these devices sleep most of the time, the restart button is practically unusable and should not be created.
Key changes:
- Added a
supportedcondition to the restart button descriptor that prevents creation for devices withsleep_period > 0 - Implemented cleanup logic to remove existing incorrect restart buttons from sleeping gen2+ devices
- Added comprehensive test coverage for the removal functionality
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
homeassistant/components/shelly/button.py |
Added supported lambda to restart button descriptor checking sleep_period == 0, implemented cleanup logic to remove existing restart buttons for sleeping RPC devices, refactored to use entry_sleep_period variable for better readability |
tests/components/shelly/test_button.py |
Added test case test_rpc_remove_restart_button_for_sleeping_devices to verify restart button is properly removed for sleeping devices during setup |
Breaking change
Proposed change
After merge #154673, the
restartbutton is created for sleeping gen2+ devices, which is incorrect. These devices sleep almost all the time, so using therestartbutton is practically impossible.This PR:
restartbuttons for sleeping gen2 devicesI don't think this change is a breaking change because it was practically impossible to use incorrectly created entities. If I'm wrong, please let me know and I'll add a description in the breaking change section.
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: