From 250c0440b584d9d577c2e9b418a7f2425d9cc7a0 Mon Sep 17 00:00:00 2001 From: Richard <42204099+rikroe@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:13:31 +0100 Subject: [PATCH] Create issue to stop using custom component --- create_issue.patch | 45 +++++++++++++++++++ .../bmw_connected_drive/__init__.py | 11 +++++ .../bmw_connected_drive/strings.json | 6 +++ 3 files changed, 62 insertions(+) create mode 100644 create_issue.patch diff --git a/create_issue.patch b/create_issue.patch new file mode 100644 index 0000000..b9c9ab6 --- /dev/null +++ b/create_issue.patch @@ -0,0 +1,45 @@ +diff --git a/custom_components/bmw_connected_drive/__init__.py b/custom_components/bmw_connected_drive/__init__.py +index 9e43cfc..9921e3f 100644 +--- a/custom_components/bmw_connected_drive/__init__.py ++++ b/custom_components/bmw_connected_drive/__init__.py +@@ -14,6 +14,7 @@ from homeassistant.helpers import ( + device_registry as dr, + discovery, + entity_registry as er, ++ issue_registry as ir, + ) + import homeassistant.helpers.config_validation as cv + +@@ -130,6 +131,16 @@ async def _async_migrate_entries( + async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: + """Set up BMW Connected Drive from a config entry.""" + ++ ir.async_create_issue( ++ hass, ++ DOMAIN, ++ "stop_using_custom_component", ++ version="2024.12.0", ++ is_fixable=False, ++ severity=ir.IssueSeverity.ERROR, ++ translation_key="stop_using_custom_component", ++ ) ++ + _async_migrate_options_from_data_if_missing(hass, entry) + + await _async_migrate_entries(hass, entry) +diff --git a/custom_components/bmw_connected_drive/strings.json b/custom_components/bmw_connected_drive/strings.json +index 8078971..65be86f 100644 +--- a/custom_components/bmw_connected_drive/strings.json ++++ b/custom_components/bmw_connected_drive/strings.json +@@ -215,5 +215,11 @@ + "missing_captcha": { + "message": "Login requires captcha validation" + } ++ }, ++ "issues": { ++ "stop_using_custom_component": { ++ "title": "Stop using custom component", ++ "description": "The custom component for BMW Connected Drive is outdated. Please remove the custom component and use the version shipped with Home Assistant." ++ } + } + } diff --git a/custom_components/bmw_connected_drive/__init__.py b/custom_components/bmw_connected_drive/__init__.py index 9e43cfc..9921e3f 100644 --- a/custom_components/bmw_connected_drive/__init__.py +++ b/custom_components/bmw_connected_drive/__init__.py @@ -14,6 +14,7 @@ device_registry as dr, discovery, entity_registry as er, + issue_registry as ir, ) import homeassistant.helpers.config_validation as cv @@ -130,6 +131,16 @@ def update_unique_id(entry: er.RegistryEntry) -> dict[str, str] | None: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up BMW Connected Drive from a config entry.""" + ir.async_create_issue( + hass, + DOMAIN, + "stop_using_custom_component", + version="2024.12.0", + is_fixable=False, + severity=ir.IssueSeverity.ERROR, + translation_key="stop_using_custom_component", + ) + _async_migrate_options_from_data_if_missing(hass, entry) await _async_migrate_entries(hass, entry) diff --git a/custom_components/bmw_connected_drive/strings.json b/custom_components/bmw_connected_drive/strings.json index 8078971..65be86f 100644 --- a/custom_components/bmw_connected_drive/strings.json +++ b/custom_components/bmw_connected_drive/strings.json @@ -215,5 +215,11 @@ "missing_captcha": { "message": "Login requires captcha validation" } + }, + "issues": { + "stop_using_custom_component": { + "title": "Stop using custom component", + "description": "The custom component for BMW Connected Drive is outdated. Please remove the custom component and use the version shipped with Home Assistant." + } } }