Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions custom_components/diveracontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from homeassistant.helpers import entity_registry as er

from .const import (
BASE_API_URL,
D_API_KEY,
D_BASE_API_URL,
D_CLUSTER_NAME,
Expand Down Expand Up @@ -128,9 +129,11 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->

"""

integrated_version = config_entry.data.get(D_INTEGRATION_VERSION, "0.0.0")

# changing to v1.2.0
# all versions before 1.2.0 do not have PATCH_VERSION set
if VERSION == 1 and MINOR_VERSION == 2 and not PATCH_VERSION:
# all versions before 1.2.0 do not have an integrated version
if integrated_version == "0.0.0":
_LOGGER.info(
"Migrating config entry to version %s.%s.%s",
VERSION,
Expand Down Expand Up @@ -187,8 +190,9 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
"Failed to remove old entity registry entries during migration"
)

# v1.2.1: add new base_url parameter to config entry
if VERSION == 1 and MINOR_VERSION == 2 and PATCH_VERSION == 1:
# changing to v1.2.1
# add new base_url parameter to config entry
if integrated_version == "1.2.0":
_LOGGER.info(
"Migrating config entry to version %s.%s.%s",
VERSION,
Expand All @@ -203,7 +207,7 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
config_entry,
data={
**config_entry.data,
D_BASE_API_URL: "https://api.divera247.com",
D_BASE_API_URL: BASE_API_URL,
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 BASE_API_URL constant ('https://app.divera247.com/') differs from the hardcoded value it replaces ('https://api.divera247.com'). The subdomain changed from 'api' to 'app' and a trailing slash was added. This will cause existing users migrating to v1.2.1 to have a different base URL than intended, potentially breaking API functionality. Use the original URL 'https://api.divera247.com' or verify that 'app.divera247.com' is the correct migration target.

Suggested change
D_BASE_API_URL: BASE_API_URL,
D_BASE_API_URL: "https://api.divera247.com",

Copilot uses AI. Check for mistakes.
},
version=VERSION,
minor_version=MINOR_VERSION,
Expand Down
Loading