Skip to content

Conversation

@moehrem
Copy link
Owner

@moehrem moehrem commented Nov 3, 2025

Changes to be committed:
modified: custom_components/diveracontrol/init.py

Changes to be committed:
	modified:   custom_components/diveracontrol/__init__.py
Copilot AI review requested due to automatic review settings November 3, 2025 11:09
Copy link

Copilot AI left a 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 adds migration logic for version 1.2.1 to include a new base_url parameter in the config entry data. The migration sets a default value of https://api.divera247.com for existing installations that lack this parameter.

  • Added migration handler for v1.2.1 that adds the base_url field to config entries
  • Sets default base_url to "https://api.divera247.com" for backwards compatibility
  • Updates config entry version metadata to reflect the new patch version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 191 to 211
if VERSION == 1 and MINOR_VERSION == 2 and PATCH_VERSION == 1:
_LOGGER.info(
"Migrating config entry to version %s.%s.%s",
VERSION,
MINOR_VERSION,
PATCH_VERSION,
)

if D_BASE_API_URL not in config_entry.data:
_LOGGER.info("Adding base_url to existing config entry")

hass.config_entries.async_update_entry(
config_entry,
data={
**config_entry.data,
D_BASE_API_URL: "https://api.divera247.com",
},
version=VERSION,
minor_version=MINOR_VERSION,
patch_version=PATCH_VERSION,
)
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

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

The migration logic always logs 'Migrating config entry' (line 192-197) even when the base_url already exists and no migration is needed. Consider moving the log statement inside the conditional check at line 199 to only log when actual migration occurs, similar to how the v1.2.0 migration is structured (lines 140-151).

Copilot uses AI. Check for mistakes.
update: tests for config flow

Changes to be committed:
	modified:   custom_components/diveracontrol/__init__.py
	modified:   tests/test_config_flow.py
@moehrem moehrem merged commit 8160a81 into main Nov 3, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants