fix: deprecate async_load_platform
#2576
Merged
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.
Reasoning Behind Changes
Deprecation Compliance: By replacing
async_load_platform
withasync_forward_entry_setups
, the integration adheres to Home Assistant's evolving architecture, ensuring long-term compatibility and reducing the risk of integration breakage in future updates.Performance Enhancement: Loading multiple platforms concurrently minimizes the time taken for the setup process, leading to a more responsive and efficient integration, especially beneficial for users with numerous Alexa devices.
Maintainability and Readability: Consolidating platform initialization into a single, clear method call simplifies the codebase, making it easier for future developers to understand and maintain the integration.
Robust Error Handling: Enhanced
try-except
blocks around platform setup ensure that any issues are promptly logged and handled, providing better feedback to users and preventing partial or failed integrations from proceeding unnoticed.Improved Logging: Clear debug statements regarding platform loading facilitate easier troubleshooting and provide transparency during the setup process, aiding both developers and users in identifying and resolving potential issues.
Affected Files
__init__.py
:async_load_platform
calls.async_forward_entry_setups
for loading multiple platforms.