Skip to content

Add migration to migrate 'homewizard_energy' to 'homewizard'#65594

Merged
balloob merged 1 commit intohome-assistant:devfrom
DCSBL:feature/migrate-custom-to-core
Feb 4, 2022
Merged

Add migration to migrate 'homewizard_energy' to 'homewizard'#65594
balloob merged 1 commit intohome-assistant:devfrom
DCSBL:feature/migrate-custom-to-core

Conversation

@DCSBL
Copy link
Copy Markdown
Contributor

@DCSBL DCSBL commented Feb 3, 2022

Proposed change

Users that used the custom integration (link) have to migrate the component because the domain is changes from homewizard_energy to homewizard. They have to reconfigure the integration and match the entity ID's to preserve history and all configurations.

This adds the possibility for the custom component to trigger a migration. This migration is based on #59698

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

"""Handle a flow initiated by older `homewizard_energy` component."""
_LOGGER.debug("config_flow async_step_import")

self.hass.components.persistent_notification.async_create(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this a persistent notification or a log?

We general log these

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fine! Just took over the same behaviour from this migration: #59698

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a persistent notification is better, easy to miss a log.

"""Initialize the HomeWizard config flow."""
self.config: dict[str, str | int] = {}

async def async_step_import(self, import_config: dict) -> FlowResult:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What triggers this import step? I'm not seeing it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I will push it into the next patch release to make migration easier.

@balloob balloob added this to the 2022.2.2 milestone Feb 4, 2022
@balloob balloob merged commit a97e691 into home-assistant:dev Feb 4, 2022
@DCSBL DCSBL deleted the feature/migrate-custom-to-core branch February 4, 2022 17:23
@DCSBL
Copy link
Copy Markdown
Contributor Author

DCSBL commented Feb 4, 2022

Awesome! Thanks for the fast merge 🚀

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the comments in a new PR. Thanks!

@DCSBL
Copy link
Copy Markdown
Contributor Author

DCSBL commented Feb 4, 2022

@MartinHjelmare Addressed your comments in #65718

balloob pushed a commit that referenced this pull request Feb 4, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants