Updated migration support for Unraid integration and update versioning #65
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.
This pull request includes significant changes to the Unraid custom component for Home Assistant, focusing on migration improvements and entity ID validation. The most important changes include adding migration support with rollback, updating the migration version, and modifying entity ID handling for consistency and validation.
Migration improvements:
custom_components/unraid/__init__.py
: Addedasync_migrate_with_rollback
function to handle data migration with rollback support during the setup process. [1] [2]custom_components/unraid/config_flow.py
: Updated the configuration flow to use the new migration version and added anasync_migrate_entry
method to handle migration of config entries. [1] [2]Entity ID validation:
custom_components/unraid/migrations.py
: Refactored theclean_entity_id
function toclean_and_validate_unique_id
for better unique ID validation and added rollback functionality in case of migration failure. [1] [2]custom_components/unraid/naming.py
: Updated theEntityNaming
class to use theclean_and_validate_unique_id
function for consistent entity ID generation.Version updates:
custom_components/unraid/const.py
: IntroducedMIGRATION_VERSION
to track the migration version and ensure proper updates.